diff --git a/Makefile b/Makefile index 28c96ab3..9aaac731 100644 --- a/Makefile +++ b/Makefile @@ -158,4 +158,16 @@ ictest-push-wasm: .PHONY: ictest-start-cosmos ictest-start-polkadot ictest-ibc ictest-push-wasm ictest-all -include contrib/make/release.mk \ No newline at end of file +include contrib/make/release.mk + + +test-upgrade: clean-testing-data + @echo "Starting upgrade test" + ./scripts/tweak-test-upgrade.sh + + +clean-testing-data: + @echo "Killing binary and removing previous data" + -@pkill centaurid 2>/dev/null + -@rm -rf ./mytestnet + diff --git a/app/app.go b/app/app.go index 060b15fc..c4a32fad 100644 --- a/app/app.go +++ b/app/app.go @@ -1,7 +1,11 @@ package app import ( + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" "fmt" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" "io" "os" "path/filepath" @@ -43,7 +47,7 @@ import ( "github.com/notional-labs/composable/v6/app/keepers" "github.com/notional-labs/composable/v6/app/upgrades/v6_5_0" - "github.com/notional-labs/composable/v6/app/upgrades/v7_0_0" + "github.com/notional-labs/composable/v6/app/upgrades/v7_0_1" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "cosmossdk.io/x/evidence" @@ -148,7 +152,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_5_0.Upgrade, v7_0_0.Upgrade} + Upgrades = []upgrades.Upgrade{v6_5_0.Upgrade, v7_0_1.Upgrade} Forks = []upgrades.Fork{} ) @@ -195,7 +199,6 @@ var ( vesting.AppModuleBasic{}, tendermint.AppModuleBasic{}, mint.AppModuleBasic{}, - wasm08.AppModuleBasic{}, wasm.AppModuleBasic{}, router.AppModuleBasic{}, ica.AppModuleBasic{}, @@ -207,6 +210,7 @@ var ( stakingmiddleware.AppModuleBasic{}, ibctransfermiddleware.AppModuleBasic{}, circuit.AppModuleBasic{}, + wasm08.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -382,8 +386,8 @@ func NewComposableApp( icqModule, ibcHooksModule, consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - wasm08.NewAppModule(app.Wasm08Keeper), wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), + wasm08.NewAppModule(app.Wasm08Keeper), routerModule, transfermiddlewareModule, txBoundaryModule, @@ -433,11 +437,11 @@ func NewComposableApp( paramstypes.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, - wasm08types.ModuleName, icatypes.ModuleName, wasmtypes.ModuleName, stakingmiddlewaretypes.ModuleName, ibctransfermiddlewaretypes.ModuleName, + wasm08types.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers ) @@ -469,11 +473,11 @@ func NewComposableApp( icqtypes.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, - wasm08types.ModuleName, icatypes.ModuleName, wasmtypes.ModuleName, stakingmiddlewaretypes.ModuleName, ibctransfermiddlewaretypes.ModuleName, + wasm08types.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -509,11 +513,11 @@ func NewComposableApp( group.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, - wasm08types.ModuleName, icatypes.ModuleName, wasmtypes.ModuleName, stakingmiddlewaretypes.ModuleName, ibctransfermiddlewaretypes.ModuleName, + wasm08types.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) @@ -780,3 +784,24 @@ func (app *ComposableApp) setupUpgradeHandlers() { ) } } + +// AutoCliOpts returns the autocli options for the app. +func (app *ComposableApp) AutoCliOpts() autocli.AppOptions { + modules := make(map[string]appmodule.AppModule, 0) + for _, m := range app.mm.Modules { + if moduleWithName, ok := m.(module.HasName); ok { + moduleName := moduleWithName.Name() + if appModule, ok := moduleWithName.(appmodule.AppModule); ok { + modules[moduleName] = appModule + } + } + } + + return autocli.AppOptions{ + Modules: modules, + ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.mm.Modules), + AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + } +} diff --git a/app/ibctesting/endpoint.go b/app/ibctesting/endpoint.go index 95c9f3e9..99c2cb79 100644 --- a/app/ibctesting/endpoint.go +++ b/app/ibctesting/endpoint.go @@ -97,8 +97,7 @@ func (endpoint *Endpoint) CreateClient() (err error) { return err } consensusState = &wasmtypes.ConsensusState{ - Data: wasmConsensusState, - Timestamp: tmConsensusState.GetTimestamp(), + Data: wasmConsensusState, } default: err = fmt.Errorf("client type %s is not supported", endpoint.ClientConfig.GetClientType()) diff --git a/app/ibctesting/path.go b/app/ibctesting/path.go index 77dda9b5..3db241c5 100644 --- a/app/ibctesting/path.go +++ b/app/ibctesting/path.go @@ -31,7 +31,7 @@ func NewPath(chainA, chainB *TestChain) *Path { func NewDefaultEndpoint(chain *TestChain) *Endpoint { return &Endpoint{ Chain: chain, - ClientConfig: ibctesting.NewTendermintConfig(chain.UseWasmClient), + ClientConfig: ibctesting.NewTendermintConfig(), ConnectionConfig: ibctesting.NewConnectionConfig(), ChannelConfig: ibctesting.NewChannelConfig(), } diff --git a/app/ibctesting/simapp/export.go b/app/ibctesting/simapp/export.go index df6d8da7..50e47a7f 100644 --- a/app/ibctesting/simapp/export.go +++ b/app/ibctesting/simapp/export.go @@ -4,7 +4,6 @@ import ( "encoding/json" "log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -18,7 +17,7 @@ func (app *SimApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, ) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContext(true) // We export at last height + 1, because that's the height at which // Tendermint will start InitChain. @@ -75,12 +74,17 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] // withdraw all validator commission app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator().String()) return false }) // withdraw all delegator rewards - dels := app.StakingKeeper.GetAllDelegations(ctx) + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { diff --git a/app/ibctesting/wasm.go b/app/ibctesting/wasm.go index b6548ff4..cb65d697 100644 --- a/app/ibctesting/wasm.go +++ b/app/ibctesting/wasm.go @@ -1,7 +1,6 @@ package ibctesting import ( - "fmt" "time" "github.com/stretchr/testify/require" @@ -13,13 +12,13 @@ import ( // ConstructUpdateWasmClientHeader will construct a valid 08-wasm Header with a zero height // to update the light client on the source chain. -func (chain *TestChain) ConstructUpdateWasmClientHeader(counterparty *TestChain, clientID string) (*wasmtypes.Header, error) { +func (chain *TestChain) ConstructUpdateWasmClientHeader(counterparty *TestChain, clientID string) (*wasmtypes.ClientState, error) { return chain.ConstructUpdateWasmClientHeaderWithTrustedHeight(counterparty, clientID, clienttypes.ZeroHeight()) } // ConstructUpdateWasmClientHeaderWithTrustedHeight will construct a valid 08-wasm Header // to update the light client on the source chain. -func (chain *TestChain) ConstructUpdateWasmClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*wasmtypes.Header, error) { +func (chain *TestChain) ConstructUpdateWasmClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*wasmtypes.ClientState, error) { tmHeader, err := chain.ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty, clientID, trustedHeight) if err != nil { return nil, err @@ -30,26 +29,18 @@ func (chain *TestChain) ConstructUpdateWasmClientHeaderWithTrustedHeight(counter return nil, err } - height, ok := tmHeader.GetHeight().(clienttypes.Height) - if !ok { - return nil, fmt.Errorf("error casting exported height to clienttypes height") - } - wasmHeader := wasmtypes.Header{ - Data: tmWasmHeaderData, - Height: height, + wasmHeader := wasmtypes.ClientState{ + Data: tmWasmHeaderData, } return &wasmHeader, nil } -func (chain *TestChain) CreateWasmClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, _, tmTrustedVals *tmtypes.ValidatorSet, signers []tmtypes.PrivValidator) *wasmtypes.Header { +func (chain *TestChain) CreateWasmClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, _, tmTrustedVals *tmtypes.ValidatorSet, signers []tmtypes.PrivValidator) *wasmtypes.ClientState { tmHeader := chain.CreateTMClientHeader(chainID, blockHeight, trustedHeight, timestamp, tmValSet, tmTrustedVals, signers) tmWasmHeaderData, err := chain.Codec.MarshalInterface(tmHeader) require.NoError(chain.t, err) - height, ok := tmHeader.GetHeight().(clienttypes.Height) - require.True(chain.t, ok) - return &wasmtypes.Header{ - Data: tmWasmHeaderData, - Height: height, + return &wasmtypes.ClientState{ + Data: tmWasmHeaderData, } } diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 4be4e60a..c3b5ff41 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -3,6 +3,7 @@ package keepers import ( "fmt" "github.com/cosmos/cosmos-sdk/x/params" + "math" "path/filepath" "strings" @@ -447,14 +448,23 @@ func (appKeepers *AppKeepers) InitNormalKeepers( wasmOpts..., ) + wasmDataDir := filepath.Join(homePath, "wasm_client_data") + wasmSupportedFeatures := strings.Join([]string{"storage", "iterator"}, ",") + wasmMemoryLimitMb := uint32(math.Pow(2, 12)) + wasmPrintDebug := true + wasmCacheSizeMb := uint32(math.Pow(2, 8)) + + vm, err := wasmvm.NewVM(wasmDataDir, wasmSupportedFeatures, wasmMemoryLimitMb, wasmPrintDebug, wasmCacheSizeMb) + // use same VM for wasm - appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper( + appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeperWithVM( appCodec, runtime.NewKVStoreService(appKeepers.keys[wasm08types.StoreKey]), - govModAddress, - wasmDir, &appKeepers.IBCKeeper.ClientKeeper, - bApp.GRPCQueryRouter()) + "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs", + vm, + bApp.GRPCQueryRouter(), + ) appKeepers.Ics20WasmHooks.ContractKeeper = &appKeepers.WasmKeeper diff --git a/app/upgrades/v7_0_0/upgrade.go b/app/upgrades/v7_0_0/upgrade.go deleted file mode 100644 index 6f081c35..00000000 --- a/app/upgrades/v7_0_0/upgrade.go +++ /dev/null @@ -1,24 +0,0 @@ -package v7_0_0 - -import ( - "context" - - upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v7_0_0/constants.go b/app/upgrades/v7_0_1/constants.go similarity index 94% rename from app/upgrades/v7_0_0/constants.go rename to app/upgrades/v7_0_1/constants.go index df8ee317..293b7c65 100644 --- a/app/upgrades/v7_0_0/constants.go +++ b/app/upgrades/v7_0_1/constants.go @@ -1,4 +1,4 @@ -package v7_0_0 +package v7_0_1 import ( store "cosmossdk.io/store/types" @@ -10,7 +10,7 @@ import ( const ( // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v7_0_0" + UpgradeName = "v7_0_1" ) var Upgrade = upgrades.Upgrade{ diff --git a/app/upgrades/v7_0_1/upgrade.go b/app/upgrades/v7_0_1/upgrade.go new file mode 100644 index 00000000..24bbca48 --- /dev/null +++ b/app/upgrades/v7_0_1/upgrade.go @@ -0,0 +1,42 @@ +package v7_0_1 + +import ( + "context" + upgradetypes "cosmossdk.io/x/upgrade/types" + "encoding/hex" + "fmt" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + codec codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(goCtx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + fmt.Println("start v7.0.1 upgrade") + ctx := sdk.UnwrapSDKContext(goCtx) + store := runtime.NewKVStoreService(keepers.GetKVStoreKey()[types.StoreKey]).OpenKVStore(ctx) + checksumStr, err := hex.DecodeString("58c7623a3ab78f4cb2e4c5d02876ac36c3b38bb472118173a7ec7faa688a66d2") + + checksum := types.Checksums{Checksums: [][]byte{checksumStr}} + bz, err := codec.Marshal(&checksum) + if err != nil { + panic(err) + } + err = store.Set([]byte(types.KeyChecksums), bz) + if err != nil { + panic(err) + } + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/cmd/centaurid/cmd/root.go b/cmd/centaurid/cmd/root.go index 8e25f239..5ae1d794 100644 --- a/cmd/centaurid/cmd/root.go +++ b/cmd/centaurid/cmd/root.go @@ -2,6 +2,7 @@ package cmd import ( "errors" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "io" "os" @@ -50,6 +51,21 @@ var ChainID string // main function. func NewRootCmd() (*cobra.Command, app.EncodingConfig) { encodingConfig := app.MakeEncodingConfig() + + tempApp := app.NewComposableApp( + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + 5, + encodingConfig, + EmptyAppOptions{}, + nil, + nil, + ) + initClientCtx := client.Context{}. WithCodec(encodingConfig.Marshaler). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). @@ -91,6 +107,15 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) { initRootCmd(rootCmd, encodingConfig) + autoCliOpts := tempApp.AutoCliOpts() + initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) + autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + autoCliOpts.ClientCtx = initClientCtx + + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } + return rootCmd, encodingConfig } @@ -244,12 +269,13 @@ func txCommand() *cobra.Command { authcmd.GetSignCommand(), authcmd.GetSignBatchCommand(), authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), authcmd.GetValidateSignaturesCommand(), - flags.LineBreak, authcmd.GetBroadcastCommand(), authcmd.GetEncodeCommand(), authcmd.GetDecodeCommand(), flags.LineBreak, + authcmd.GetSimulateCmd(), ) return cmd @@ -352,3 +378,7 @@ func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, } return cmd } + +type EmptyAppOptions struct{} + +func (EmptyAppOptions) Get(_ string) interface{} { return nil } diff --git a/go.mod b/go.mod index 9bcfb4bc..0a6d3ebb 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require github.com/cometbft/cometbft-db v0.11.0 // indirect require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cosmossdk.io/client/v2 v2.0.0-beta.1 // indirect + cosmossdk.io/client/v2 v2.0.0-beta.1 cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/tools/confix v0.1.1 // indirect cosmossdk.io/x/circuit v0.1.0 @@ -364,8 +364,9 @@ replace ( // TODO: check wasm vm compatibility with grandpa contract github.com/CosmWasm/wasmvm => github.com/CosmWasm/wasmvm v1.5.2 - github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240330020027-fa949b150972 + // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240330020027-fa949b150972 + // github.com/cosmos/ibc-go/modules/light-clients/08-wasm => /Users/kien6034/go/pkg/mod/github.com/cosmos/ibc-go/modules/light-clients/08-wasm@v0.1.1-0.20231213092650-57fcdb9a9a9d // use cosmos-compatible protobufs github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index be4dea16..a3ad1bbd 100644 --- a/go.sum +++ b/go.sum @@ -836,6 +836,8 @@ github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0 h1:nKP2+Rzlz2iyvTosY5mvP+ github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0/go.mod h1:D3Q380FpWRFtmUQWLosPxachi6w24Og2t5u/Tww5wtY= github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-0.20231213092650-57fcdb9a9a9d h1:F4mhR61RZU4KJ38n5CeZrnNINU/KxMfP1sKfk5fTlHA= +github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-0.20231213092650-57fcdb9a9a9d/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0= github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -1401,8 +1403,6 @@ github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACp github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240330020027-fa949b150972 h1:nrxV6i6FBnMUwmx3Aqun7111xfOCFEIO9oetf5EVxEM= -github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240330020027-fa949b150972/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0= github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= diff --git a/scripts/localnode.sh b/scripts/localnode.sh index d2749373..a6a0edeb 100755 --- a/scripts/localnode.sh +++ b/scripts/localnode.sh @@ -1,11 +1,19 @@ #!/bin/bash - -echo "starting localnode" - BINARY=$1 +KEY="mykey" +CHAINID="localpica" +MONIKER="localtestnet" +KEYALGO="secp256k1" +KEYRING="test" +LOGLEVEL="info" CONTINUE=${CONTINUE:-"false"} +# to trace evm +#TRACE="--trace" +TRACE="" + HOME_DIR=mytestnet -ENV=${ENV:-""} +DENOM=${2:-ppica} + if [ "$CONTINUE" == "true" ]; then echo "\n ->> continuing from previous state" @@ -13,56 +21,29 @@ if [ "$CONTINUE" == "true" ]; then exit 0 fi + +# remove existing daemon rm -rf $HOME_DIR -pkill centaurid - -# check DENOM is set. If not, set to upica -DENOM=${2:-upica} -echo "denom: $DENOM" -COMMISSION_RATE=0.01 -COMMISSION_MAX_RATE=0.02 - -SED_BINARY=sed -# check if this is OS X -if [[ "$OSTYPE" == "darwin"* ]]; then - # check if gsed is installed - if ! command -v gsed &> /dev/null - then - echo "gsed could not be found. Please install it with 'brew install gnu-sed'" - exit - else - SED_BINARY=gsed - fi -fi -# check BINARY is set. If not, build centaurid and set BINARY -if [ -z "$BINARY" ]; then - make build - BINARY=centaurid -fi +# centaurid config keyring-backend $KEYRING +# centaurid config chain-id $CHAINID -CHAIN_ID="localpica" -KEYRING="test" -KEY="test0" -KEY1="test1" -KEY2="test2" +# if $KEY exists it should be deleted +$BINARY init $MONIKER --chain-id $CHAINID --home $HOME_DIR > /dev/null 2>&1 + +echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | $BINARY keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover --home $HOME_DIR -# Function updates the config based on a jq argument as a string update_test_genesis () { # update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"' cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && mv $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json } -$BINARY init --chain-id $CHAIN_ID moniker --home $HOME_DIR +# Allocate genesis accounts (cosmos formatted addresses) +$BINARY add-genesis-account $KEY 100000000000000000000000000$DENOM --keyring-backend $KEYRING --home $HOME_DIR -$BINARY keys add $KEY --keyring-backend $KEYRING --home $HOME_DIR -$BINARY keys add $KEY1 --keyring-backend $KEYRING --home $HOME_DIR -$BINARY keys add $KEY2 --keyring-backend $KEYRING --home $HOME_DIR -# Allocate genesis accounts (cosmos formatted addresses) -$BINARY add-genesis-account $KEY "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR -$BINARY add-genesis-account $KEY1 "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR -$BINARY add-genesis-account $KEY2 "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR +# Sign genesis transaction +$BINARY gentx $KEY 1000000000000000000000$DENOM --keyring-backend $KEYRING --chain-id $CHAINID --home $HOME_DIR update_test_genesis '.app_state["gov"]["params"]["voting_period"]="5s"' update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' @@ -70,23 +51,24 @@ update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"'$DEN update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' -# enable rest server and swagger -$SED_BINARY -i '0,/enable = false/s//enable = true/' $HOME_DIR/config/app.toml -$SED_BINARY -i 's/swagger = false/swagger = true/' $HOME_DIR/config/app.toml -$SED_BINARY -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' $HOME_DIR/config/app.toml -$SED_BINARY -i 's/minimum-gas-prices = "0.25upica"/minimum-gas-prices = "0.0upica"/' $HOME_DIR/config/app.toml +# sed -i 's/timeout_commit = "5s"/timeout_commit = "500ms"/' $HOME_DIR/config/config.toml -## Adjust block time -$SED_BINARY -i 's/timeout_commit = "5s"/timeout_commit = "1000ms"/' $HOME_DIR/config/config.toml +echo "updating.." +sed -i '' 's/timeout_commit = "5s"/timeout_commit = "500ms"/' $HOME_DIR/config/config.toml - -# Sign genesis transaction -$BINARY gentx $KEY "1000000000000000000000${DENOM}" --commission-rate=$COMMISSION_RATE --commission-max-rate=$COMMISSION_MAX_RATE --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME_DIR - # Collect genesis tx $BINARY collect-gentxs --home $HOME_DIR # Run this to ensure everything worked and that the genesis file is setup correctly $BINARY validate-genesis --home $HOME_DIR -$BINARY start --home $HOME_DIR + +if [[ $1 == "pending" ]]; then + echo "pending mode is on, please wait for the first block committed." +fi + +# update request max size so that we can upload the light client +# '' -e is a must have params on mac, if use linux please delete before run +sed -i'' -e 's/max_body_bytes = /max_body_bytes = 1/g' $HOME_DIR/config/config.toml +# Start the node (remove the --pruning=nothing flag if historical queries are not needed) +$BINARY start --pruning=nothing --minimum-gas-prices=0$DENOM --rpc.laddr tcp://0.0.0.0:26657 --home $HOME_DIR --log_level debug diff --git a/scripts/old-node/push-08-wasm.sh b/scripts/old-node/push-08-wasm.sh new file mode 100755 index 00000000..a8184b6d --- /dev/null +++ b/scripts/old-node/push-08-wasm.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +KEY="mykey" +KEYALGO="secp256k1" +KEYRING="test" +HOME_DIR="mytestnet" +# validate dependencies are installed +command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } + +./_build/old/centaurid tx 08-wasm push-wasm contracts/ics10_grandpa_cw.wasm --from=mykey --gas 10002152622 --fees 10020166upica --keyring-backend test --chain-id=localpica -y --home $HOME_DIR + +sleep 5 + +./_build/old/centaurid query 08-wasm all-wasm-code --home $HOME_DIR \ No newline at end of file diff --git a/scripts/old-node/testnode.sh b/scripts/old-node/testnode.sh new file mode 100755 index 00000000..2911edc9 --- /dev/null +++ b/scripts/old-node/testnode.sh @@ -0,0 +1,71 @@ +#!/bin/bash +BINARY=${1:-_build/old/centaurid} +KEY="mykey" +CHAINID="localpica" +MONIKER="localtestnet" +KEYALGO="secp256k1" +KEYRING="test" +LOGLEVEL="info" +CONTINUE=${CONTINUE:-"false"} +# to trace evm +#TRACE="--trace" +TRACE="" + +HOME_DIR=~/.banksy +DENOM=upica + +if [ "$CONTINUE" == "true" ]; then + echo "\n ->> continuing from previous state" + $BINARY start --home $HOME_DIR --log_level debug + exit 0 +fi + + +# remove existing daemon +rm -rf $HOME_DIR + +# centaurid config keyring-backend $KEYRING +# centaurid config chain-id $CHAINID + +# if $KEY exists it should be deleted +$BINARY init $MONIKER --chain-id $CHAINID --home $HOME_DIR > /dev/null 2>&1 + +echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | $BINARY keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover --home $HOME_DIR + +update_test_genesis () { + # update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"' + cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && mv $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json +} + +# Allocate genesis accounts (cosmos formatted addresses) +$BINARY add-genesis-account $KEY 100000000000000000000000000$DENOM --keyring-backend $KEYRING --home $HOME_DIR + + +# Sign genesis transaction +$BINARY gentx $KEY 1000000000000000000000$DENOM --keyring-backend $KEYRING --chain-id $CHAINID --home $HOME_DIR + +update_test_genesis '.app_state["gov"]["params"]["voting_period"]="50s"' +update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' +update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "0"}]' +update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' +update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' + +# sed -i 's/timeout_commit = "5s"/timeout_commit = "500ms"/' $HOME_DIR/config/config.toml + + +# Collect genesis tx +$BINARY collect-gentxs --home $HOME_DIR + +# Run this to ensure everything worked and that the genesis file is setup correctly +$BINARY validate-genesis --home $HOME_DIR + +if [[ $1 == "pending" ]]; then + echo "pending mode is on, please wait for the first block committed." +fi + +# update request max size so that we can upload the light client +# '' -e is a must have params on mac, if use linux please delete before run +sed -i'' -e 's/max_body_bytes = /max_body_bytes = 1/g' $HOME_DIR/config/config.toml + +# Start the node (remove the --pruning=nothing flag if historical queries are not needed) +$BINARY start --pruning=nothing --minimum-gas-prices=0.0001$DENOM --rpc.laddr tcp://0.0.0.0:26657 --home $HOME_DIR --log_level debug diff --git a/scripts/test-upgrade.sh b/scripts/test-upgrade.sh index ff6e83a2..9e8ac64c 100755 --- a/scripts/test-upgrade.sh +++ b/scripts/test-upgrade.sh @@ -7,9 +7,9 @@ OLD_VERSION=v6.5.0 UPGRADE_WAIT=${UPGRADE_WAIT:-20} HOME=mytestnet ROOT=$(pwd) -DENOM=upica +DENOM=ppica CHAIN_ID=localpica -SOFTWARE_UPGRADE_NAME="v7_0_0" +SOFTWARE_UPGRADE_NAME="v7_0_1" ADDITIONAL_PRE_SCRIPTS="" ADDITIONAL_AFTER_SCRIPTS="" @@ -93,7 +93,7 @@ run_upgrade () { # Get upgrade height, 12 block after (6s) STATUS_INFO=($(./_build/old/centaurid status --home $HOME | jq -r '.NodeInfo.network,.SyncInfo.latest_block_height')) - UPGRADE_HEIGHT=$((STATUS_INFO[1] + 20)) + UPGRADE_HEIGHT=$((STATUS_INFO[1] + 50)) echo "UPGRADE_HEIGHT = $UPGRADE_HEIGHT" tar -cf ./_build/new/centaurid.tar -C ./_build/new centaurid diff --git a/scripts/testnode.sh b/scripts/testnode.sh index ea434822..41eb8b0e 100755 --- a/scripts/testnode.sh +++ b/scripts/testnode.sh @@ -1,7 +1,8 @@ #!/bin/bash +BINARY=$1 KEY="mykey" -CHAINID="test-1" +CHAINID="localpica" MONIKER="localtestnet" KEYALGO="secp256k1" KEYRING="test" @@ -10,28 +11,45 @@ LOGLEVEL="info" #TRACE="--trace" TRACE="" +HOME_DIR=~/.banksy +DENOM=${2:-ppica} + + # remove existing daemon rm -rf ~/.banksy* -# centaurid config keyring-backend $KEYRING -# centaurid config chain-id $CHAINID +# $BINARY config keyring-backend $KEYRING +# $BINARY config chain-id $CHAINID # if $KEY exists it should be deleted -echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | centaurid keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover +echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | $BINARY keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover -centaurid init $MONIKER --chain-id $CHAINID > /dev/null 2>&1 +$BINARY init $MONIKER --chain-id $CHAINID > /dev/null 2>&1 +update_test_genesis () { + # update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"' + cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && mv $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json +} # Allocate genesis accounts (cosmos formatted addresses) -centaurid genesis add-genesis-account $KEY 100000000000000000000000000stake --keyring-backend $KEYRING +$BINARY genesis add-genesis-account $KEY 100000000000000000000000000ppica --keyring-backend $KEYRING +$BINARY add-genesis-account centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR + # Sign genesis transaction -centaurid genesis gentx $KEY 1000000000000000000000stake --keyring-backend $KEYRING --chain-id $CHAINID +$BINARY gentx $KEY 1000000000000000000000ppica --keyring-backend $KEYRING --chain-id $CHAINID + +update_test_genesis '.app_state["gov"]["params"]["voting_period"]="20s"' +update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' +update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "0"}]' +update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' +update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' + # Collect genesis tx -centaurid collect-gentxs +$BINARY collect-gentxs # Run this to ensure everything worked and that the genesis file is setup correctly -centaurid validate-genesis +$BINARY validate-genesis if [[ $1 == "pending" ]]; then echo "pending mode is on, please wait for the first block committed." @@ -42,4 +60,4 @@ fi sed -i'' -e 's/max_body_bytes = /max_body_bytes = 1/g' ~/.banksy/config/config.toml # Start the node (remove the --pruning=nothing flag if historical queries are not needed) -centaurid start --pruning=nothing --minimum-gas-prices=0.0001stake --rpc.laddr tcp://0.0.0.0:26657 +$BINARY start --pruning=nothing --minimum-gas-prices=0.0001ppica --rpc.laddr tcp://0.0.0.0:26657 diff --git a/scripts/tweak-test-upgrade.sh b/scripts/tweak-test-upgrade.sh new file mode 100755 index 00000000..d9476c2f --- /dev/null +++ b/scripts/tweak-test-upgrade.sh @@ -0,0 +1,182 @@ +#!/bin/bash + +# the upgrade is a fork, "true" otherwise +FORK=${FORK:-"false"} + +OLD_VERSION=kien-v6.5.0-tweak +UPGRADE_WAIT=${UPGRADE_WAIT:-20} +HOME=mytestnet +ROOT=$(pwd) +DENOM=upica +CHAIN_ID=localpica +SOFTWARE_UPGRADE_NAME="v7_0_1" +ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v6_to_7/pre_08_wasm.sh" +ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v6_to_7/post_08_wasm.sh" + +SLEEP_TIME=1 + +KEY="mykey" +KEY1="test1" +KEY2="test2" + +if [[ "$FORK" == "true" ]]; then + export PICA_HALT_HEIGHT=20 +fi + +# underscore so that go tool will not take gocache into account +mkdir -p _build/gocache +export GOMODCACHE=$ROOT/_build/gocache + + + +# install old binary if not exist +if [ ! -f "_build/$OLD_VERSION.zip" ] &> /dev/null +then + mkdir -p _build/old + wget -c "https://github.com/notional-labs/composable-cosmos/archive/refs/tags/${OLD_VERSION}.zip" -O _build/${OLD_VERSION}.zip + unzip _build/${OLD_VERSION}.zip -d _build +fi + + +# reinstall old binary +if [ $# -eq 1 ] && [ $1 == "--reinstall-old" ] || ! command -v _build/old/centaurid &> /dev/null; then + cd ./_build/composable-cosmos-${OLD_VERSION} + GOBIN="$ROOT/_build/old" go install -mod=readonly ./... + cd ../.. +fi + + +# install new binary +FORCE_BUILD=${FORCE_BUILD:-"false"} +if ! command -v _build/new/centaurid &> /dev/null || [[ "$FORCE_BUILD" == "true" ]]; then + echo "Building the new binary..." + mkdir -p _build/new + GOBIN="$ROOT/_build/new" go install -mod=readonly ./... +fi + +# run old node +# if [[ "$OSTYPE" == "darwin"* ]]; then + +# else +# screen node1 bash scripts/localnode.sh _build/old/centaurid $DENOM +# fi +echo "running old node" +screen -dms old-node bash scripts/localnode.sh _build/old/centaurid $DENOM + +sleep 2 # wait for note to start + +# execute additional pre scripts +if [ ! -z "$ADDITIONAL_PRE_SCRIPTS" ]; then + # slice ADDITIONAL_SCRIPTS by , + SCRIPTS=($(echo "$ADDITIONAL_PRE_SCRIPTS" | tr ',' ' ')) + for SCRIPT in "${SCRIPTS[@]}"; do + # check if SCRIPT is a file + if [ -f "$SCRIPT" ]; then + echo "executing additional pre scripts from $SCRIPT" + source $SCRIPT + sleep 2 + else + echo "$SCRIPT is not a file" + fi + done +fi + + +run_fork () { + echo "forking" + + while true; do + BLOCK_HEIGHT=$(./_build/old/centaurid status | jq '.SyncInfo.latest_block_height' -r) + # if BLOCK_HEIGHT is not empty + if [ ! -z "$BLOCK_HEIGHT" ]; then + echo "BLOCK_HEIGHT = $BLOCK_HEIGHT" + sleep 10 + else + echo "BLOCK_HEIGHT is empty, forking" + break + fi + done +} + +run_upgrade () { + echo -e "\n\n=> =>start upgrading" + + # Get upgrade height, 12 block after (6s) + STATUS_INFO=($(./_build/old/centaurid status --home $HOME | jq -r '.NodeInfo.network,.SyncInfo.latest_block_height')) + UPGRADE_HEIGHT=$((STATUS_INFO[1] + 18)) + echo "UPGRADE_HEIGHT = $UPGRADE_HEIGHT" + + tar -cf ./_build/new/centaurid.tar -C ./_build/new centaurid + SUM=$(shasum -a 256 ./_build/new/centaurid.tar | cut -d ' ' -f1) + UPGRADE_INFO=$(jq -n ' + { + "binaries": { + "linux/amd64": "file://'$(pwd)'/_build/new/centaurid.tar?checksum=sha256:'"$SUM"'", + } + }') + + + ./_build/old/centaurid tx gov submit-legacy-proposal software-upgrade "$SOFTWARE_UPGRADE_NAME" --upgrade-height $UPGRADE_HEIGHT --upgrade-info "$UPGRADE_INFO" --title "upgrade" --description "upgrade" --from $KEY --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null + + sleep $SLEEP_TIME + + ./_build/old/centaurid tx gov deposit 1 "20000000${DENOM}" --from $KEY --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null + + sleep $SLEEP_TIME + + ./_build/old/centaurid tx gov vote 1 yes --from $KEY --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null + + sleep $SLEEP_TIME + + # ./_build/old/centaurid tx gov vote 1 yes --from $KEY2 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null + + # sleep $SLEEP_TIME + + # determine block_height to halt + while true; do + BLOCK_HEIGHT=$(./_build/old/centaurid status | jq '.SyncInfo.latest_block_height' -r) + if [ $BLOCK_HEIGHT = "$UPGRADE_HEIGHT" ]; then + # assuming running only 1 centaurid + echo "BLOCK HEIGHT = $UPGRADE_HEIGHT REACHED, KILLING OLD ONE" + pkill centaurid + break + else + ./_build/old/centaurid q gov proposal 1 --output=json | jq ".status" + echo "BLOCK_HEIGHT = $BLOCK_HEIGHT" + sleep 1 + fi + done +} + +# if FORK = true +if [[ "$FORK" == "true" ]]; then + run_fork + unset PICA_HALT_HEIGHT +else + run_upgrade +fi + +sleep 1 + +# run new node +echo -e "\n\n=> =>continue running nodes after upgrade" +CONTINUE="true" screen -dms new-node bash scripts/localnode.sh _build/new/centaurid $DENOM + +sleep 5 + + +# execute additional after scripts +if [ ! -z "$ADDITIONAL_AFTER_SCRIPTS" ]; then + # slice ADDITIONAL_SCRIPTS by , + SCRIPTS=($(echo "$ADDITIONAL_AFTER_SCRIPTS" | tr ',' ' ')) + for SCRIPT in "${SCRIPTS[@]}"; do + # check if SCRIPT is a file + if [ -f "$SCRIPT" ]; then + echo "executing additional after scripts from $SCRIPT" + source $SCRIPT _build/new/centaurid + sleep 5 + else + echo "$SCRIPT is not a file" + fi + done +fi \ No newline at end of file diff --git a/scripts/upgrade/v6_to_7/post_08_wasm.sh b/scripts/upgrade/v6_to_7/post_08_wasm.sh new file mode 100644 index 00000000..a813cf85 --- /dev/null +++ b/scripts/upgrade/v6_to_7/post_08_wasm.sh @@ -0,0 +1,18 @@ +#!/bin/bash +KEY="mykey" +KEYALGO="secp256k1" +KEYRING="test" +HOME_DIR="mytestnet" + + +sleep 2 + +checksum=$(./_build/new/centaurid query ibc-wasm checksums --home $HOME_DIR -o json | jq -r '.checksums[0]') + +if ./_build/new/centaurid query ibc-wasm code $checksum --home $HOME_DIR -o json &> /dev/null; then + echo "Code with checksum $checksum exists." +else + echo "Code with checksum $checksum does not exist." +fi + + diff --git a/scripts/upgrade/v6_to_7/pre_08_wasm.sh b/scripts/upgrade/v6_to_7/pre_08_wasm.sh new file mode 100644 index 00000000..4058c1ff --- /dev/null +++ b/scripts/upgrade/v6_to_7/pre_08_wasm.sh @@ -0,0 +1,18 @@ +#!/bin/bash +KEY="mykey" +KEYALGO="secp256k1" +KEYRING="test" +HOME_DIR="mytestnet" + + + +# validate dependencies are installed +command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } + + +stat $(pwd)/contracts/ics10_grandpa_cw.wasm +./_build/old/centaurid tx 08-wasm push-wasm $(pwd)/contracts/ics10_grandpa_cw.wasm --from=mykey --gas 10002152622 --fees 10020166upica --keyring-backend test --chain-id=localpica -y --home $HOME_DIR + +sleep 3 + +./_build/old/centaurid query 08-wasm all-wasm-code --home $HOME_DIR \ No newline at end of file diff --git a/scripts/upload_contracts.sh b/scripts/upload_contracts.sh index 4a2e7da9..a6ffd1b3 100755 --- a/scripts/upload_contracts.sh +++ b/scripts/upload_contracts.sh @@ -1,21 +1,10 @@ #!/bin/bash KEY="mykey" -CHAINID="test-1" KEYALGO="secp256k1" KEYRING="test" # validate dependencies are installed command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } -# remove existing daemon -rm -rf ~/.centauri* - -~/go/bin/centaurid config keyring-backend $KEYRING -~/go/bin/centaurid config chain-id $CHAINID - -# if $KEY exists it should be deleted -echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | ~/go/bin/centaurid keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover - - -~/go/bin/centaurid tx 08-wasm push-wasm contracts/ics10_grandpa_cw.wasm --from mykey --keyring-backend test --gas 902152622 --fees 920166stake -y \ No newline at end of file +./_build/old/centaurid tx 08-wasm push-wasm contracts/ics10_grandpa_cw.wasm --from=mykey --gas 10002152622 --fees 10020166ppica --keyring-backend test --chain-id=localpica -y \ No newline at end of file diff --git a/scripts/upload_contracts_new.sh b/scripts/upload_contracts_new.sh new file mode 100755 index 00000000..14685b26 --- /dev/null +++ b/scripts/upload_contracts_new.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +KEY="mykey" +KEYALGO="secp256k1" +KEYRING="test" + +# validate dependencies are installed +command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } + +centaurid tx ibc-wasm store-code contracts/ics10_grandpa_cw.wasm --from=mykey --title test --summary test --gas 10002152622 --fees 10020166ppica --deposit 100000000ppica --keyring-backend test --chain-id=localpica -y +sleep 5 +centaurid tx gov vote 1 yes --from=mykey --gas 10002152622 --fees 10020166ppica --keyring-backend test --chain-id=localpica -y \ No newline at end of file