Skip to content

Commit

Permalink
test: Add case for non-empty noop state change
Browse files Browse the repository at this point in the history
  • Loading branch information
drklee3 committed Feb 22, 2024
1 parent ed9f446 commit 29a4996
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion x/evm/statedb/statedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,23 @@ func (suite *StateDBTestSuite) TestState() {
db.SetState(address, key1, common.Hash{})
}, map[common.Hash]common.Hash{}},

{"noop state change", func(db *statedb.StateDB) {
{"noop state change - empty", func(db *statedb.StateDB) {
db.SetState(address, key1, value1)
db.SetState(address, key1, common.Hash{})
}, map[common.Hash]common.Hash{}},

{"noop state change - non-empty", func(db *statedb.StateDB) {
// Start with non-empty committed state
db.SetState(address, key1, value1)
suite.Require().NoError(db.Commit())

db.SetState(address, key1, common.Hash{})
db.SetState(address, key1, value1)
}, map[common.Hash]common.Hash{
// Shouldn't be modified - Commit() may still write it again though
key1: value1,
}},

{"set state", func(db *statedb.StateDB) {
// check empty initial state
suite.Require().Equal(common.Hash{}, db.GetState(address, key1))
Expand Down

0 comments on commit 29a4996

Please sign in to comment.