good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 542b8827 authored by ledgerwatch's avatar ledgerwatch Committed by GitHub
Browse files

storage override revert support (#3597)


* storage override revert support

* Fix

Co-authored-by: default avatarAlex Sharp <alexsharp@Alexs-MacBook-Pro.local>
parent 37ccbc53
No related branches found
No related tags found
No related merge requests found
......@@ -132,6 +132,11 @@ type (
key common.Hash
prevalue uint256.Int
}
fakeStorageChange struct {
account *common.Address
key common.Hash
prevalue uint256.Int
}
codeChange struct {
account *common.Address
prevcode []byte
......@@ -249,6 +254,14 @@ func (ch storageChange) dirtied() *common.Address {
return ch.account
}
func (ch fakeStorageChange) revert(s *IntraBlockState) {
s.getStateObject(*ch.account).fakeStorage[ch.key] = ch.prevalue
}
func (ch fakeStorageChange) dirtied() *common.Address {
return ch.account
}
func (ch refundChange) revert(s *IntraBlockState) {
s.refund = ch.prev
}
......
......@@ -209,6 +209,11 @@ func (so *stateObject) GetCommittedState(key *common.Hash, out *uint256.Int) {
func (so *stateObject) SetState(key *common.Hash, value uint256.Int) {
// If the fake storage is set, put the temporary state update here.
if so.fakeStorage != nil {
so.db.journal.append(fakeStorageChange{
account: &so.address,
key: *key,
prevalue: so.fakeStorage[*key],
})
so.fakeStorage[*key] = value
return
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment