Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ import (
ibctransferkeeper "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/apps/transfer/keeper"
ibctransfertypes "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/apps/transfer/types"
ibc "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core"
ibcclient "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core/02-client"
ibcclientclient "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core/02-client/client"
ibcclienttypes "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core/02-client/types"
ibcporttypes "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core/05-port/types"
ibchost "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core/24-host"
ibckeeper "github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core/keeper"
Expand Down Expand Up @@ -193,8 +190,6 @@ func getGovProposalHandlers() []govclient.ProposalHandler {
distrclient.ProposalHandler,
upgradeclient.ProposalHandler,
upgradeclient.CancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
mintclient.UpdateMinterHandler,
// this line is used by starport scaffolding # stargate/app/govProposalHandler
)
Expand Down Expand Up @@ -847,7 +842,6 @@ func New(
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
Comment thread
masih marked this conversation as resolved.
AddRoute(minttypes.RouterKey, mint.NewProposalHandler(app.MintKeeper)).
AddRoute(tokenfactorytypes.RouterKey, tokenfactorymodule.NewProposalHandler(app.TokenFactoryKeeper)).
AddRoute(evmtypes.RouterKey, evm.NewProposalHandler(app.EvmKeeper))
Expand Down
22 changes: 22 additions & 0 deletions sei-ibc-go/modules/apps/transfer/keeper/deprecated_msg_server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package keeper

import (
"context"

"github.com/sei-protocol/sei-chain/sei-ibc-go/modules/apps/transfer/types"
)

// DeprecatedMsgServer is a types.MsgServer that rejects every message with
// types.ErrTransferDeprecated.
//
// It is registered as the transfer module's message server so that submitted
// transactions are rejected, while Keeper retains the executable transfer
// logic for the versioned EVM precompiles that replay historical blocks.
type DeprecatedMsgServer struct{}

var _ types.MsgServer = DeprecatedMsgServer{}

// Transfer defines an RPC handler for MsgTransfer.
func (DeprecatedMsgServer) Transfer(context.Context, *types.MsgTransfer) (*types.MsgTransferResponse, error) {
return nil, types.ErrTransferDeprecated
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package keeper

import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/sei-protocol/sei-chain/sei-ibc-go/modules/apps/transfer/types"
)

func TestDeprecatedMessages(t *testing.T) {
response, err := DeprecatedMsgServer{}.Transfer(context.Background(), &types.MsgTransfer{})

require.Nil(t, response)
require.ErrorIs(t, err, types.ErrTransferDeprecated)
}
4 changes: 3 additions & 1 deletion sei-ibc-go/modules/apps/transfer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ func (am AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier {

// RegisterServices registers module services.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
// Transactions are rejected as deprecated; Keeper.Transfer stays executable
// for the versioned EVM precompiles that replay historical blocks.
types.RegisterMsgServer(cfg.MsgServer(), keeper.DeprecatedMsgServer{})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] The comment says Keeper.Transfer stays executable only for versioned precompiles replaying historical blocks, but the current precompile also calls it directly: precompiles/ibc/ibc.go:169 and :255 invoke p.transferKeeper.Transfer(...), bypassing the msg-service router and therefore DeprecatedMsgServer. So a live EVM IBC.transfer call still attempts a real transfer and fails deeper down with ibc-channel: ibc outbound disabled rather than ErrTransferDeprecated.

Given the PR's goal of a stable deprecation error for transfer writes, consider gating the live precompile too (and adjusting this comment, which currently reads as if only legacy versions reach the keeper).

types.RegisterQueryServer(cfg.QueryServer(), am.keeper)

m := keeper.NewMigrator(am.keeper)
Expand Down
2 changes: 2 additions & 0 deletions sei-ibc-go/modules/apps/transfer/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ var (
ErrReceiveDisabled = sdkerrors.Register(ModuleName, 8, "fungible token transfers to this chain are disabled")
ErrMaxTransferChannels = sdkerrors.Register(ModuleName, 9, "max transfer channels")
ErrInvalidMemo = sdkerrors.Register(ModuleName, 10, "invalid memo")
// ErrTransferDeprecated indicates that the transfer module is deprecated.
ErrTransferDeprecated = sdkerrors.Register(ModuleName, 11, "transfer module is deprecated")
)
165 changes: 0 additions & 165 deletions sei-ibc-go/modules/core/02-client/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"

"github.com/sei-protocol/sei-chain/sei-cosmos/client"
"github.com/sei-protocol/sei-chain/sei-cosmos/client/flags"
"github.com/sei-protocol/sei-chain/sei-cosmos/client/tx"
"github.com/sei-protocol/sei-chain/sei-cosmos/codec"
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/version"
govcli "github.com/sei-protocol/sei-chain/sei-cosmos/x/gov/client/cli"
govtypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/gov/types"
upgradetypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/upgrade/types"
"github.com/spf13/cobra"

"github.com/sei-protocol/sei-chain/sei-ibc-go/modules/core/02-client/types"
Expand Down Expand Up @@ -233,163 +228,3 @@ func NewUpgradeClientCmd() *cobra.Command {

return cmd
}

// NewCmdSubmitUpdateClientProposal implements a command handler for submitting an update IBC client proposal transaction.
func NewCmdSubmitUpdateClientProposal() *cobra.Command {
cmd := &cobra.Command{
Use: "update-client [subject-client-id] [substitute-client-id]",
Args: cobra.ExactArgs(2),
Short: "Submit an update IBC client proposal",
Long: "Submit an update IBC client proposal along with an initial deposit.\n" +
"Please specify a subject client identifier you want to update..\n" +
"Please specify the substitute client the subject client will be updated to.",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

title, err := cmd.Flags().GetString(govcli.FlagTitle)
if err != nil {
return err
}

description, err := cmd.Flags().GetString(govcli.FlagDescription)
if err != nil {
return err
}

subjectClientID := args[0]
substituteClientID := args[1]

content := types.NewClientUpdateProposal(title, description, subjectClientID, substituteClientID)

from := clientCtx.GetFromAddress()

depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit)
if err != nil {
return err
}
deposit, err := sdk.ParseCoinsNormalized(depositStr)
if err != nil {
return err
}

msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from)
if err != nil {
return err
}

if err = msg.ValidateBasic(); err != nil {
return err
}

return tx.GenerateOrBroadcastTxCLI(cmd.Context(), clientCtx, cmd.Flags(), msg)
},
}

cmd.Flags().String(govcli.FlagTitle, "", "title of proposal")
cmd.Flags().String(govcli.FlagDescription, "", "description of proposal")
cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal")

return cmd
}

// NewCmdSubmitUpgradeProposal implements a command handler for submitting an upgrade IBC client proposal transaction.
func NewCmdSubmitUpgradeProposal() *cobra.Command {
cmd := &cobra.Command{
Use: "ibc-upgrade [name] [height] [path/to/upgraded_client_state.json] [flags]",
Args: cobra.ExactArgs(3),
Short: "Submit an IBC upgrade proposal",
Long: "Submit an IBC client breaking upgrade proposal along with an initial deposit.\n" +
"The client state specified is the upgraded client state representing the upgraded chain\n" +
`Example Upgraded Client State JSON:
{
"@type":"/ibc.lightclients.tendermint.v1.ClientState",
"chain_id":"testchain1",
"unbonding_period":"1814400s",
"latest_height":{"revision_number":"0","revision_height":"2"},
"proof_specs":[{"leaf_spec":{"hash":"SHA256","prehash_key":"NO_HASH","prehash_value":"SHA256","length":"VAR_PROTO","prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":33,"min_prefix_length":4,"max_prefix_length":12,"empty_child":null,"hash":"SHA256"},"max_depth":0,"min_depth":0},{"leaf_spec":{"hash":"SHA256","prehash_key":"NO_HASH","prehash_value":"SHA256","length":"VAR_PROTO","prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":32,"min_prefix_length":1,"max_prefix_length":1,"empty_child":null,"hash":"SHA256"},"max_depth":0,"min_depth":0}],
"upgrade_path":["upgrade","upgradedIBCState"],
}
`,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
cdc := codec.NewProtoCodec(clientCtx.InterfaceRegistry)

title, err := cmd.Flags().GetString(govcli.FlagTitle)
if err != nil {
return err
}

description, err := cmd.Flags().GetString(govcli.FlagDescription)
if err != nil {
return err
}

name := args[0]

height, err := strconv.ParseInt(args[1], 10, 64)
if err != nil {
return err
}

plan := upgradetypes.Plan{
Name: name,
Height: height,
}

// attempt to unmarshal client state argument
var clientState exported.ClientState
clientContentOrFileName := args[2]
if err := cdc.UnmarshalInterfaceJSON([]byte(clientContentOrFileName), &clientState); err != nil {

// check for file path if JSON input is not provided
contents, err := os.ReadFile(filepath.Clean(clientContentOrFileName))
if err != nil {
return fmt.Errorf("neither JSON input nor path to .json file for client state were provided: %w", err)
}

if err := cdc.UnmarshalInterfaceJSON(contents, &clientState); err != nil {
return fmt.Errorf("error unmarshalling client state file: %w", err)
}
}

content, err := types.NewUpgradeProposal(title, description, plan, clientState)
if err != nil {
return err
}

from := clientCtx.GetFromAddress()

depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit)
if err != nil {
return err
}
deposit, err := sdk.ParseCoinsNormalized(depositStr)
if err != nil {
return err
}

msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from)
if err != nil {
return err
}

if err = msg.ValidateBasic(); err != nil {
return err
}

return tx.GenerateOrBroadcastTxCLI(cmd.Context(), clientCtx, cmd.Flags(), msg)
},
}

cmd.Flags().String(govcli.FlagTitle, "", "title of proposal")
cmd.Flags().String(govcli.FlagDescription, "", "description of proposal")
cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal")

return cmd
}
26 changes: 0 additions & 26 deletions sei-ibc-go/modules/core/02-client/client/proposal_handler.go

This file was deleted.

Loading
Loading