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

Commit

Permalink
changelog: v0.12.1 (#1019)
Browse files Browse the repository at this point in the history
* evm: update empty hash check for storage state (#1016)

* v0.12.1: changelog
  • Loading branch information
fedekunze authored Mar 29, 2022
1 parent 4687710 commit d19e388
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [v0.12.1] - 2022-03-29

### Bug Fixes

* (evm) [tharsis#1016](https://github.com/tharsis/ethermint/pull/1016) Update validate basic check for storage state.

## [v0.12.0] - 2022-03-24

### Bug Fixes
Expand Down
10 changes: 5 additions & 5 deletions x/evm/types/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package types

import (
"fmt"
"strings"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"

"github.com/tharsis/ethermint/types"
)

// Storage represents the account Storage map as a slice of single key value
Expand Down Expand Up @@ -49,11 +48,12 @@ func (s Storage) Copy() Storage {
}

// Validate performs a basic validation of the State fields.
// NOTE: state value can be empty
func (s State) Validate() error {
if types.IsEmptyHash(s.Key) {
return sdkerrors.Wrap(ErrInvalidState, "state key hash cannot be empty")
if strings.TrimSpace(s.Key) == "" {
return sdkerrors.Wrap(ErrInvalidState, "state key hash cannot be blank")
}
// NOTE: state value can be empty

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion x/evm/types/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestStorageValidate(t *testing.T) {
{
"empty storage key bytes",
Storage{
{Key: common.Hash{}.String()},
{Key: ""},
},
false,
},
Expand Down

0 comments on commit d19e388

Please sign in to comment.