diff --git a/chain/cosmos/cosmos_chain.go b/chain/cosmos/cosmos_chain.go index 46e89d709..f3ec21076 100644 --- a/chain/cosmos/cosmos_chain.go +++ b/chain/cosmos/cosmos_chain.go @@ -30,7 +30,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -294,7 +293,7 @@ func (c *CosmosChain) GetAddress(ctx context.Context, keyName string) ([]byte, e return nil, err } - return types.GetFromBech32(b32Addr, c.Config().Bech32Prefix) + return sdk.GetFromBech32(b32Addr, c.Config().Bech32Prefix) } // BuildWallet will return a Cosmos wallet @@ -454,7 +453,7 @@ func (c *CosmosChain) PushNewWasmClientProposal(ctx context.Context, keyName str return tx, "", err } message := wasmtypes.MsgStoreCode{ - Signer: types.MustBech32ifyAddressBytes(c.cfg.Bech32Prefix, authtypes.NewModuleAddress(govtypes.ModuleName)), + Signer: sdk.MustBech32ifyAddressBytes(c.cfg.Bech32Prefix, authtypes.NewModuleAddress(govtypes.ModuleName)), WasmByteCode: content, } msg, err := c.cfg.EncodingConfig.Codec.MarshalInterfaceJSON(&message) @@ -557,12 +556,12 @@ func (c *CosmosChain) InstantiateContract(ctx context.Context, keyName string, c } // ExecuteContract executes a contract transaction with a message using it's address. -func (c *CosmosChain) ExecuteContract(ctx context.Context, keyName string, contractAddress string, message string, extraExecTxArgs ...string) (res *types.TxResponse, err error) { +func (c *CosmosChain) ExecuteContract(ctx context.Context, keyName string, contractAddress string, message string, extraExecTxArgs ...string) (res *sdk.TxResponse, err error) { return c.GetFullNode().ExecuteContract(ctx, keyName, contractAddress, message, extraExecTxArgs...) } // MigrateContract performs contract migration. -func (c *CosmosChain) MigrateContract(ctx context.Context, keyName string, contractAddress string, codeID string, message string, extraExecTxArgs ...string) (res *types.TxResponse, err error) { +func (c *CosmosChain) MigrateContract(ctx context.Context, keyName string, contractAddress string, codeID string, message string, extraExecTxArgs ...string) (res *sdk.TxResponse, err error) { return c.GetFullNode().MigrateContract(ctx, keyName, contractAddress, codeID, message, extraExecTxArgs...) } @@ -597,7 +596,7 @@ func (c *CosmosChain) QueryContractInfo(ctx context.Context, contractAddress str return c.GetFullNode().QueryContractInfo(ctx, contractAddress) } -func (c *CosmosChain) GetTransaction(txhash string) (*types.TxResponse, error) { +func (c *CosmosChain) GetTransaction(txhash string) (*sdk.TxResponse, error) { fn := c.GetFullNode() return fn.GetTransaction(fn.CliContext(), txhash) } @@ -849,15 +848,15 @@ func (c *CosmosChain) Start(testName string, ctx context.Context, additionalGene decimalPow := int64(math.Pow10(int(*chainCfg.CoinDecimals))) - genesisAmounts := make([][]types.Coin, len(c.Validators)) - genesisSelfDelegation := make([]types.Coin, len(c.Validators)) + genesisAmounts := make([][]sdk.Coin, len(c.Validators)) + genesisSelfDelegation := make([]sdk.Coin, len(c.Validators)) for i := range c.Validators { - genesisAmounts[i] = []types.Coin{{Amount: sdkmath.NewInt(10_000_000).MulRaw(decimalPow), Denom: chainCfg.Denom}} - genesisSelfDelegation[i] = types.Coin{Amount: sdkmath.NewInt(5_000_000).MulRaw(decimalPow), Denom: chainCfg.Denom} + genesisAmounts[i] = []sdk.Coin{{Amount: sdkmath.NewInt(10_000_000).MulRaw(decimalPow), Denom: chainCfg.Denom}} + genesisSelfDelegation[i] = sdk.Coin{Amount: sdkmath.NewInt(5_000_000).MulRaw(decimalPow), Denom: chainCfg.Denom} if chainCfg.ModifyGenesisAmounts != nil { amount, selfDelegation := chainCfg.ModifyGenesisAmounts(i) - genesisAmounts[i] = []types.Coin{amount} + genesisAmounts[i] = []sdk.Coin{amount} genesisSelfDelegation[i] = selfDelegation } } @@ -963,7 +962,7 @@ func (c *CosmosChain) Start(testName string, ctx context.Context, additionalGene } for _, wallet := range additionalGenesisWallets { - if err := validator0.AddGenesisAccount(ctx, wallet.Address, []types.Coin{{Denom: wallet.Denom, Amount: wallet.Amount}}); err != nil { + if err := validator0.AddGenesisAccount(ctx, wallet.Address, []sdk.Coin{{Denom: wallet.Denom, Amount: wallet.Amount}}); err != nil { return err } } @@ -1071,7 +1070,7 @@ func (c *CosmosChain) Height(ctx context.Context) (int64, error) { // Acknowledgements implements ibc.Chain, returning all acknowledgments in block at height. func (c *CosmosChain) Acknowledgements(ctx context.Context, height int64) ([]ibc.PacketAcknowledgement, error) { var acks []*chanTypes.MsgAcknowledgement - err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.GetFullNode().Client, height, func(msg types.Msg) bool { + err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.GetFullNode().Client, height, func(msg sdk.Msg) bool { found, ok := msg.(*chanTypes.MsgAcknowledgement) if ok { acks = append(acks, found) @@ -1103,7 +1102,7 @@ func (c *CosmosChain) Acknowledgements(ctx context.Context, height int64) ([]ibc // Timeouts implements ibc.Chain, returning all timeouts in block at height. func (c *CosmosChain) Timeouts(ctx context.Context, height int64) ([]ibc.PacketTimeout, error) { var timeouts []*chanTypes.MsgTimeout - err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.GetFullNode().Client, height, func(msg types.Msg) bool { + err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.GetFullNode().Client, height, func(msg sdk.Msg) bool { found, ok := msg.(*chanTypes.MsgTimeout) if ok { timeouts = append(timeouts, found) diff --git a/chain/cosmos/poll.go b/chain/cosmos/poll.go index fdf5fe2c8..0d6fa8908 100644 --- a/chain/cosmos/poll.go +++ b/chain/cosmos/poll.go @@ -57,7 +57,7 @@ func PollForMessage[T any](ctx context.Context, chain *CosmosChain, registry cod fn = func(T) bool { return true } } doPoll := func(ctx context.Context, height int64) (T, error) { - h := int64(height) + h := height block, err := chain.GetFullNode().Client.Block(ctx, &h) if err != nil { return zero, err