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
10 changes: 10 additions & 0 deletions action/protocol/execution/evm/evm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,16 @@ func TestConstantinople(t *testing.T) {
action.EmptyAddress,
29275561,
},
// after Tsunami - Upernavik
Copy link
Member

Choose a reason for hiding this comment

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

and this comment line should be at L255

{
action.EmptyAddress,
Copy link
Member

Choose a reason for hiding this comment

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

should be "io1pcg2ja9krrhujpazswgz77ss46xgt88afqlk6y"

39275360,
},
// after Upernavik
{
action.EmptyAddress,
39275562,
},
{
"io1pcg2ja9krrhujpazswgz77ss46xgt88afqlk6y",
1261440000, // = 200*365*24*3600/5, around 200 years later
Expand Down
2 changes: 0 additions & 2 deletions action/protocol/execution/evm/evmstatedbadapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
func (stateDB *StateDBAdapter) SetTransientState(addr common.Address, key, value common.Hash) {
prev := stateDB.transientStorage.Get(addr, key)
if prev == value {
return

Check warning on line 488 in action/protocol/execution/evm/evmstatedbadapter.go

View check run for this annotation

Codecov / codecov/patch

action/protocol/execution/evm/evmstatedbadapter.go#L488

Added line #L488 was not covered by tests
}
stateDB.transientStorage.Set(addr, key, value)
}
Expand Down Expand Up @@ -538,8 +538,6 @@
if !rules.IsBerlin {
return
}
// Clear out any leftover from previous executions
stateDB.accessList = newAccessList()
stateDB.AddAddressToAccessList(sender)
if dst != nil {
stateDB.AddAddressToAccessList(*dst)
Expand All @@ -558,7 +556,7 @@
stateDB.AddAddressToAccessList(coinbase)
}
// Reset transient storage at the beginning of transaction execution
stateDB.transientStorage = newTransientStorage()

Check warning on line 559 in action/protocol/execution/evm/evmstatedbadapter.go

View check run for this annotation

Codecov / codecov/patch

action/protocol/execution/evm/evmstatedbadapter.go#L559

Added line #L559 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

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

same thing, not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is best to add

Copy link
Member

Choose a reason for hiding this comment

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

as discused, let's remove this, it is done in NewStateDBAdapter

}

// AddressInAccessList returns true if the given address is in the access list
Expand Down
2 changes: 1 addition & 1 deletion 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,transient storage are introduced after fixSnapshot
// refund fix accessList and transient storage are introduced after fixSnapshot
// so their snapshot are always properly cleared
require.Zero(len(stateDB.accessListSnapshot))
require.Zero(len(stateDB.transientStorageSnapshot))
Expand Down
Loading