Fix 'value out of range' RangeDefect in block witness generation. (#2072)

* Fix 'value out of range' RangeDefect caused by large/expensive blocks/transactions during DOS period.

* Clear witness cache in AccountCache persist.

* Revert previous fix and force clear cache after processing each block.

* Revert clear cache in process block.
This commit is contained in:
web3-developer 2024-03-19 15:41:40 +08:00 committed by GitHub
parent 14a5f46d13
commit a147ff7553
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -694,6 +694,10 @@ proc makeMultiKeys*(ac: AccountsCache): MultiKeysRef =
result.add(k, v.codeTouched, multiKeys(v.storageKeys))
result.sort()
# reset the witness cache after collecting the witness data
# so it is clean before executing the next block
ac.witnessCache.clear()
proc accessList*(ac: AccountsCache, address: EthAddress) {.inline.} =
ac.savePoint.accessList.add(address)

View File

@ -32,7 +32,7 @@ type
MultiKeysRef* = ref MultiKeys
Group* = object
first*, last*: int16
first*, last*: int
BranchGroup* = object
mask*: uint