diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go index 2a3cf544..5a1b6039 100644 --- a/app/ante/handler_options.go +++ b/app/ante/handler_options.go @@ -31,19 +31,19 @@ type HandlerOptions struct { } func (options HandlerOptions) validate() error { - if options.AccountKeeper == nil { + if options.AccountKeeper == evmtypes.AccountKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") } - if options.BankKeeper == nil { + if options.BankKeeper == evmtypes.BankKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") } - if options.SignModeHandler == nil { + if options.SignModeHandler == authsigning.SignModeHandler(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") } - if options.FeeMarketKeeper == nil { + if options.FeeMarketKeeper == evmtypes.FeeMarketKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "fee market keeper is required for AnteHandler") } - if options.EvmKeeper == nil { + if options.EvmKeeper == EVMKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "evm keeper is required for AnteHandler") } return nil diff --git a/utils/json.go b/utils/json.go index a1062e73..f43bd75c 100644 --- a/utils/json.go +++ b/utils/json.go @@ -36,7 +36,6 @@ func GenerateHash(json map[string]interface{}) (string, []byte, error) { return "", nil, err } - //cid, err := CIDFromJSONBytes(content) cidString, err := CIDFromJSONBytesUsingIpldPrime(content) if err != nil { return "", nil, err @@ -81,7 +80,7 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) { // This gathers together any parameters that might be needed when making a link. // (For CIDs, the version, the codec, and the multihash type are all parameters we'll need.) // Often, you can probably make this a constant for your whole application. - lp := cidlink.LinkPrototype{Prefix: cid.Prefix{ + lp := cidlink.LinkPrototype{Prefix: cid.Prefix{ //nolint:golint Version: 1, // Usually '1'. Codec: 0x71, // 0x71 means "dag-cbor" -- See the multicodecs table: https://github.com/multiformats/multicodec/ MhType: 0x12, // 0x12 means "sha2-256" -- See the multicodecs table: https://github.com/multiformats/multicodec/ diff --git a/utils/mnemonic.go b/utils/mnemonic.go index 80dce1ac..4cb6591f 100644 --- a/utils/mnemonic.go +++ b/utils/mnemonic.go @@ -16,7 +16,7 @@ func GenerateMnemonic() (string, error) { return "", err } - mnemonic, err := bip39.NewMnemonic(entropySeed[:]) + mnemonic, err := bip39.NewMnemonic(entropySeed) if err != nil { return "", err } diff --git a/utils/types.go b/utils/types.go index 51e42acd..aaa03b78 100644 --- a/utils/types.go +++ b/utils/types.go @@ -12,10 +12,13 @@ import ( set "github.com/deckarep/golang-set" ) -func Int64ToBytes(num int64) []byte { +func Int64ToBytes(num int64) ([]byte, error) { buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, num) - return buf.Bytes() + if err := binary.Write(buf, binary.BigEndian, num); err != nil { + return nil, err + } + + return buf.Bytes(), nil } func SetToSlice(set set.Set) []string { diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 635e4df2..39ab08e4 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -215,7 +215,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t // snapshot to contain the tx processing and post processing in same scope var commit func() tmpCtx := ctx - if k.hooks != nil { + if k.hooks != types.EvmHooks(nil) { // Create a cache context to revert state when tx hooks fails, // the cache context is only committed when both tx and hooks executed successfully. // Didn't use `Snapshot` because the context stack has exponential complexity on certain operations,