Skip to content

Commit

Permalink
fix: lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Oct 8, 2024
1 parent eacbdcc commit dd55a16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions chain/cosmos/cosmos_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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...)
}

Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dd55a16

Please sign in to comment.