diff --git a/cosmos/x/evm/plugins/state/plugin.go b/cosmos/x/evm/plugins/state/plugin.go index 3867cd987..95cdf11ce 100644 --- a/cosmos/x/evm/plugins/state/plugin.go +++ b/cosmos/x/evm/plugins/state/plugin.go @@ -415,7 +415,11 @@ func (p *plugin) IterateState(cb func(addr common.Address, key, value common.Has p.cms.GetCommittedKVStore(p.storeKey), []byte{types.StorageKeyPrefix}, ) - defer it.Close() + defer func() { + if err := it.Close(); err != nil { + p.savedErr = err + } + }() for ; it.Valid(); it.Next() { k, v := it.Key(), it.Value() @@ -440,7 +444,9 @@ func (p *plugin) ForEachStorage( p.cms.GetKVStore(p.storeKey), StorageKeyFor(addr), ) - defer it.Close() + if err := it.Close(); err != nil { + return err + } for ; it.Valid(); it.Next() { committedValue := it.Value() @@ -470,7 +476,11 @@ func (p *plugin) IterateBalances(fn func(common.Address, *big.Int) bool) { p.cms.GetKVStore(p.storeKey), []byte{types.BalanceKeyPrefix}, ) - defer it.Close() + defer func() { + if err := it.Close(); err != nil { + p.savedErr = err + } + }() for ; it.Valid(); it.Next() { addr := AddressFromBalanceKey(it.Key()) diff --git a/cosmos/x/evm/store/snapmulti/store.go b/cosmos/x/evm/store/snapmulti/store.go index 8e0e4db31..f7383e861 100644 --- a/cosmos/x/evm/store/snapmulti/store.go +++ b/cosmos/x/evm/store/snapmulti/store.go @@ -39,7 +39,7 @@ const ( // corresponding cache kv store currently being used. type mapMultiStore map[storetypes.StoreKey]storetypes.CacheKVStore -// Store is a wrapper around the Cosmos SDK `MultiStore` which supports snapshots and reverts. +// store is a wrapper around the Cosmos SDK `MultiStore` which supports snapshots and reverts. // It journals revisions by cache-wrapping the cachekv stores on a call to `Snapshot`. In this // store's lifecycle, any operations done before the first call to snapshot will be enforced on the // root `mapMultiStore`.