Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
Merge branch 'calbera/beng-462-enforce-read-only-flag-in-evm-does-not…
Browse files Browse the repository at this point in the history
…-write-to' of github.com:berachain/polaris into calbera/beng-462-enforce-read-only-flag-in-evm-does-not-write-to
  • Loading branch information
calbera committed Jun 29, 2023
2 parents c35c0ca + da20ec9 commit 21f5921
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions cosmos/x/evm/plugins/state/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion cosmos/x/evm/store/snapmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 21f5921

Please sign in to comment.