From 5ed0a27eceff3af4698ccd6753c72c45edc0c0cf Mon Sep 17 00:00:00 2001 From: Anh Minh <1phamminh0811@gmail.com> Date: Mon, 6 May 2024 22:53:00 +0700 Subject: [PATCH 1/4] use wasmkeeper.Option instead of deprecated one --- app/app.go | 3 ++- app/keepers/routers.go | 3 ++- app/sim_test.go | 3 +-- app/testing/test_suite.go | 4 ++-- cmd/terrad/root.go | 7 +++---- custom/auth/ante/ante_test.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/app.go b/app/app.go index 55251df59..577780632 100644 --- a/app/app.go +++ b/app/app.go @@ -61,6 +61,7 @@ import ( customauthtx "github.com/classic-terra/core/v3/custom/auth/tx" "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" // unnamed import of statik for swagger UI support _ "github.com/classic-terra/core/v3/client/docs/statik" @@ -122,7 +123,7 @@ func init() { func NewTerraApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string, encodingConfig terraappparams.EncodingConfig, appOpts servertypes.AppOptions, - wasmOpts []wasm.Option, baseAppOptions ...func(*baseapp.BaseApp), + wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *TerraApp { appCodec := encodingConfig.Marshaler legacyAmino := encodingConfig.Amino diff --git a/app/keepers/routers.go b/app/keepers/routers.go index a735bf5f9..c52eff163 100644 --- a/app/keepers/routers.go +++ b/app/keepers/routers.go @@ -22,6 +22,7 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/CosmWasm/wasmd/x/wasm" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7" ) @@ -72,7 +73,7 @@ func (appKeepers *AppKeepers) newIBCRouter() *porttypes.Router { ibcRouter := porttypes.NewRouter() ibcRouter. AddRoute(ibctransfertypes.ModuleName, transferHookFeeStack). - AddRoute(wasm.ModuleName, wasmStack). + AddRoute(wasmtypes.ModuleName, wasmStack). AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). AddRoute(icahosttypes.SubModuleName, icaHostStack) diff --git a/app/sim_test.go b/app/sim_test.go index fb6c3e87d..144b73f0a 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" terraapp "github.com/classic-terra/core/v3/app" helpers "github.com/classic-terra/core/v3/app/testing" @@ -136,7 +135,7 @@ func TestAppStateDeterminism(t *testing.T) { } db := dbm.NewMemDB() - var emptyWasmOpts []wasm.Option + var emptyWasmOpts []wasmkeeper.Option app := terraapp.NewTerraApp( logger, db, nil, true, map[int64]bool{}, terraapp.DefaultNodeHome, terraapp.MakeEncodingConfig(), diff --git a/app/testing/test_suite.go b/app/testing/test_suite.go index aa3ea943d..8809a70ba 100644 --- a/app/testing/test_suite.go +++ b/app/testing/test_suite.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/classic-terra/core/v3/app" appparams "github.com/classic-terra/core/v3/app/params" @@ -43,7 +43,7 @@ const ( SimAppChainID = "terra-app" ) -var emptyWasmOpts []wasm.Option +var emptyWasmOpts []wasmkeeper.Option // EmptyBaseAppOptions is a stub implementing AppOptions type EmptyBaseAppOptions struct{} diff --git a/cmd/terrad/root.go b/cmd/terrad/root.go index 874be47a3..93c31a9ca 100644 --- a/cmd/terrad/root.go +++ b/cmd/terrad/root.go @@ -44,7 +44,7 @@ import ( core "github.com/classic-terra/core/v3/types" "github.com/CosmWasm/wasmd/x/wasm" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" ) // NewRootCmd creates a new root command for terrad. It is called once in the @@ -58,7 +58,6 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { sdkConfig.SetBech32PrefixForAccount(core.Bech32PrefixAccAddr, core.Bech32PrefixAccPub) sdkConfig.SetBech32PrefixForValidator(core.Bech32PrefixValAddr, core.Bech32PrefixValPub) sdkConfig.SetBech32PrefixForConsensusNode(core.Bech32PrefixConsAddr, core.Bech32PrefixConsPub) - sdkConfig.SetAddressVerifier(wasmtypes.VerifyAddressLen()) sdkConfig.Seal() initClientCtx := client.Context{}. @@ -261,7 +260,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a ) // TODO: We want to parse legacy wasm options from app.toml in [wasm] section here or not? - var wasmOpts []wasm.Option + var wasmOpts []wasmkeeper.Option return terraapp.NewTerraApp( logger, db, traceStore, true, skipUpgradeHeights, @@ -290,7 +289,7 @@ func (a appCreator) appExport( logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, appOpts servertypes.AppOptions, modulesToExport []string, ) (servertypes.ExportedApp, error) { - var wasmOpts []wasm.Option + var wasmOpts []wasmkeeper.Option homePath, ok := appOpts.Get(flags.FlagHome).(string) if !ok || homePath == "" { return servertypes.ExportedApp{}, errors.New("application home not set") diff --git a/custom/auth/ante/ante_test.go b/custom/auth/ante/ante_test.go index 16773f8e2..ba3d58677 100644 --- a/custom/auth/ante/ante_test.go +++ b/custom/auth/ante/ante_test.go @@ -24,7 +24,7 @@ import ( terraapp "github.com/classic-terra/core/v3/app" treasurytypes "github.com/classic-terra/core/v3/x/treasury/types" - "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" ) // AnteTestSuite is a test suite to be used with ante handler tests. @@ -41,7 +41,7 @@ type AnteTestSuite struct { // returns context and app with params set on account keeper func createTestApp(isCheckTx bool, tempDir string) (*terraapp.TerraApp, sdk.Context) { // TODO: we need to feed in custom binding here? - var wasmOpts []wasm.Option + var wasmOpts []wasmkeeper.Option app := terraapp.NewTerraApp( log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, tempDir, terraapp.MakeEncodingConfig(), From c264e0d5d20b10b38e1f6f2866fc176da9c1d9ad Mon Sep 17 00:00:00 2001 From: Anh Minh <1phamminh0811@gmail.com> Date: Mon, 6 May 2024 22:53:27 +0700 Subject: [PATCH 2/4] set Localhost params in client --- app/upgrades/v8/upgrades.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/upgrades/v8/upgrades.go b/app/upgrades/v8/upgrades.go index 36bb20852..9bb79a995 100644 --- a/app/upgrades/v8/upgrades.go +++ b/app/upgrades/v8/upgrades.go @@ -18,6 +18,7 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/cosmos/ibc-go/v7/modules/core/exported" ) func CreateV8UpgradeHandler( @@ -61,6 +62,10 @@ func CreateV8UpgradeHandler( legacyBaseAppSubspace := keepers.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &keepers.ConsensusParamsKeeper) + + params := keepers.IBCKeeper.ClientKeeper.GetParams(ctx) + params.AllowedClients = append(params.AllowedClients, exported.Localhost) + keepers.IBCKeeper.ClientKeeper.SetParams(ctx, params) return mm.RunMigrations(ctx, cfg, fromVM) } } From febdbe891d41b7349328f7e4f7200fc62ee6c5a8 Mon Sep 17 00:00:00 2001 From: Anh Minh <1phamminh0811@gmail.com> Date: Mon, 6 May 2024 22:53:42 +0700 Subject: [PATCH 3/4] fix ante_test in dyncom --- x/dyncomm/ante/ante_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/dyncomm/ante/ante_test.go b/x/dyncomm/ante/ante_test.go index 24e96f863..98a19ba3a 100644 --- a/x/dyncomm/ante/ante_test.go +++ b/x/dyncomm/ante/ante_test.go @@ -7,7 +7,7 @@ import ( "cosmossdk.io/math" "github.com/classic-terra/core/v3/app" core "github.com/classic-terra/core/v3/types" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/client" From ca067e4ae91a40a23e1d7fba117e8ea630856048 Mon Sep 17 00:00:00 2001 From: Anh Minh <1phamminh0811@gmail.com> Date: Tue, 7 May 2024 00:10:16 +0700 Subject: [PATCH 4/4] update go mod --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index e4b5ab41f..c93d5daa9 100644 --- a/go.mod +++ b/go.mod @@ -225,12 +225,12 @@ replace ( ) replace ( - github.com/CosmWasm/wasmd => github.com/classic-terra/wasmd v0.45.0-classic + github.com/CosmWasm/wasmd => github.com/classic-terra/wasmd v0.45.0-terra1 // use cometbft - github.com/cometbft/cometbft => github.com/classic-terra/cometbft v0.37.4-classic + github.com/cometbft/cometbft => github.com/classic-terra/cometbft v0.37.4-terra1 github.com/cometbft/cometbft-db => github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-sdk => github.com/classic-terra/cosmos-sdk v0.47.10-classic - github.com/cosmos/ibc-go/v7 => github.com/classic-terra/ibc-go/v7 v7.0.0-20240419072319-aa9d74dc39ae + github.com/cosmos/cosmos-sdk => github.com/classic-terra/cosmos-sdk v0.47.10-terra + github.com/cosmos/ibc-go/v7 => github.com/classic-terra/ibc-go/v7 v7.4.0-terra github.com/cosmos/ledger-cosmos-go => github.com/terra-money/ledger-terra-go v0.11.2 // replace goleveldb to optimized one github.com/syndtr/goleveldb => github.com/classic-terra/goleveldb v0.0.0-20230914223247-2b28f6655121 diff --git a/go.sum b/go.sum index 25664a20b..381cc44d3 100644 --- a/go.sum +++ b/go.sum @@ -348,16 +348,16 @@ github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/classic-terra/cometbft v0.37.4-classic h1:7HfuM/VfD7hBTIiF/pCWsyH6gh9YrsD05Xv1TErEwN8= -github.com/classic-terra/cometbft v0.37.4-classic/go.mod h1:Cmg5Hp4sNpapm7j+x0xRyt2g0juQfmB752ous+pA0G8= -github.com/classic-terra/cosmos-sdk v0.47.10-classic h1:HJMcVfw4b3t9jOFUxwQuFwgxO49mmojLP2pr4vo6FNk= -github.com/classic-terra/cosmos-sdk v0.47.10-classic/go.mod h1:fLbF9OIrgXq5W7LxvOSzAM9tOMfqxYeprlMH7RFmozs= +github.com/classic-terra/cometbft v0.37.4-terra1 h1:eT5B2n5KKi5WVW+3ZNOVTmtfKKaZrXOLX9G80m9mhZo= +github.com/classic-terra/cometbft v0.37.4-terra1/go.mod h1:vFqj7Qe3uFFJvHZleTJPQDmJ/WscXHi4rKWqiCAaNZk= +github.com/classic-terra/cosmos-sdk v0.47.10-terra h1:5Kbe5ys+buLGH60lg6dWX938ajPUMFnDTCMA3/PsnKo= +github.com/classic-terra/cosmos-sdk v0.47.10-terra/go.mod h1:4mBvTB8zevoeTuQufWwTcNnthGG2afXO+9D42BKzlRo= github.com/classic-terra/goleveldb v0.0.0-20230914223247-2b28f6655121 h1:fjpWDB0hm225wYg9vunyDyTH8ftd5xEUgINJKidj+Tw= github.com/classic-terra/goleveldb v0.0.0-20230914223247-2b28f6655121/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/classic-terra/ibc-go/v7 v7.0.0-20240419072319-aa9d74dc39ae h1:dPxkxNcORnKN/ZWqzH4zxfi42FK2bes02LgIj5P/f4k= -github.com/classic-terra/ibc-go/v7 v7.0.0-20240419072319-aa9d74dc39ae/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= -github.com/classic-terra/wasmd v0.45.0-classic h1:6yZZuYybnzg5nOo6bHHO7/In/XJJDuPwfIewmW3PYuY= -github.com/classic-terra/wasmd v0.45.0-classic/go.mod h1:h+dgrilC9naGP0NKFWOZ691qpY07BMbWnF4X1FwPVik= +github.com/classic-terra/ibc-go/v7 v7.4.0-terra h1:hawaq62XKlxyc8xLyIcc6IujDDEbqDBU+2U15SF+hj8= +github.com/classic-terra/ibc-go/v7 v7.4.0-terra/go.mod h1:s0lxNkjVIqsb8AVltL0qhzxeLgOKvWZrknPuvgjlEQ8= +github.com/classic-terra/wasmd v0.45.0-terra1 h1:0QT9ViBy2kFDqGhcbTXvIuwgycVAWmAWemMV1PmOlWQ= +github.com/classic-terra/wasmd v0.45.0-terra1/go.mod h1:n1BJiGOIkPR3dZyQCfNAO2k2bPC/lnxZLIBMA1PM6/A= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304=