Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[evm] EIP-1153 enable transient storage feature #4214

Merged
merged 19 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion action/protocol/execution/evm/evm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ func TestConstantinople(t *testing.T) {
require.Equal(isSumatra, chainRules.IsMerge)
require.Equal(isSumatra, chainRules.IsShanghai)

// Cancun, Prague not yet enabled
// Upernavik = enable Cancun
isUpernavik := g.IsUpernavik(e.height)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments need updates

require.Equal(isUpernavik, chainRules.IsCancun)
//Prague not yet enabled
require.False(evmChainConfig.IsPrague(big.NewInt(int64(e.height)), evm.Context.Time))

// test basefee
Expand Down
16 changes: 4 additions & 12 deletions action/protocol/execution/evm/evmstatedbadapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ func TestSnapshotRevertAndCommit(t *testing.T) {
require.Equal(3, len(stateDB.contractSnapshot))
require.Equal(3, len(stateDB.selfDestructedSnapshot))
require.Equal(3, len(stateDB.preimageSnapshot))
// refund fix and accessList are introduced after fixSnapshot
// refund fix and accessList、transient storage are introduced after fixSnapshot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems a chinese version comma

// so their snapshot are always properly cleared
require.Zero(len(stateDB.accessListSnapshot))
require.Zero(len(stateDB.transientStorageSnapshot))
Expand Down Expand Up @@ -1000,23 +1000,15 @@ func TestStateDBTransientStorage(t *testing.T) {
value := test.val
sn := state.Snapshot()
state.SetTransientState(addr, key, value)
// the retrieved value should equal what was set
if got := state.GetTransientState(addr, key); got != value {
t.Fatalf("transient storage mismatch: have %x, want %x", got, value)
}
require.Equal(value, state.GetTransientState(addr, key))

// revert the transient state being set and then check that the
// value is now the empty hash
state.RevertToSnapshot(sn)
if got, exp := state.GetTransientState(addr, key), (common.Hash{}); exp != got {
t.Fatalf("transient storage mismatch: have %x, want %x", got, exp)
}
require.Equal(common.Hash{}, state.GetTransientState(addr, key))

// reset transient state
state.SetTransientState(addr, key, value)
if got := state.GetTransientState(addr, key); got != value {
t.Fatalf("transient storage mismatch: have %x, want %x", got, value)
}
require.Equal(value, state.GetTransientState(addr, key))
}

}
Loading