-
Notifications
You must be signed in to change notification settings - Fork 328
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] proper handle refundSnapshot and upgrade go-ethereum release #3715
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -556,6 +556,27 @@ func (stateDB *StateDBAdapter) RevertToSnapshot(snapshot int) { | |
// restore gas refund | ||
if !stateDB.manualCorrectGasRefund { | ||
stateDB.refund = stateDB.refundSnapshot[snapshot] | ||
delete(stateDB.refundSnapshot, snapshot) | ||
for i := snapshot + 1; ; i++ { | ||
if _, ok := stateDB.refundSnapshot[i]; ok { | ||
delete(stateDB.refundSnapshot, i) | ||
} else { | ||
break | ||
} | ||
} | ||
} | ||
// restore access list | ||
stateDB.accessList = nil | ||
stateDB.accessList = stateDB.accessListSnapshot[snapshot] | ||
{ | ||
delete(stateDB.accessListSnapshot, snapshot) | ||
for i := snapshot + 1; ; i++ { | ||
if _, ok := stateDB.accessListSnapshot[i]; ok { | ||
delete(stateDB.accessListSnapshot, i) | ||
} else { | ||
break | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reason to move it here, is that L623 may return on and accessList won't be activated before next HF, so it is safe to move it here |
||
} | ||
// restore logs and txLogs | ||
if stateDB.revertLog { | ||
|
@@ -624,19 +645,6 @@ func (stateDB *StateDBAdapter) RevertToSnapshot(snapshot int) { | |
} | ||
} | ||
} | ||
// restore access list | ||
stateDB.accessList = nil | ||
stateDB.accessList = stateDB.accessListSnapshot[snapshot] | ||
{ | ||
delete(stateDB.accessListSnapshot, snapshot) | ||
for i := snapshot + 1; ; i++ { | ||
if _, ok := stateDB.accessListSnapshot[i]; ok { | ||
delete(stateDB.accessListSnapshot, i) | ||
} else { | ||
break | ||
} | ||
} | ||
} | ||
} | ||
|
||
func (stateDB *StateDBAdapter) cachedContractAddrs() []hash.Hash160 { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,6 @@ require ( | |
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) | ||
|
||
replace github.com/ethereum/go-ethereum => github.com/iotexproject/go-ethereum v1.7.4-0.20221123031803-9e576f7b3e4b | ||
replace github.com/ethereum/go-ethereum => github.com/iotexproject/go-ethereum v0.4.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tagged v0.4.2 |
||
|
||
replace golang.org/x/xerrors => golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this fix: fcb8d7b, we need to clear snapshot >= n, when calling
RevertToSnapshot(n)