Skip to content

Commit

Permalink
Fix 'value out of range' RangeDefect in block witness generation. (#2072
Browse files Browse the repository at this point in the history
)

* 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.
  • Loading branch information
web3-developer committed Mar 19, 2024
1 parent 14a5f46 commit a147ff7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions nimbus/db/ledger/accounts_cache.nim
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion stateless/multi_keys.nim
Expand Up @@ -32,7 +32,7 @@ type
MultiKeysRef* = ref MultiKeys

Group* = object
first*, last*: int16
first*, last*: int

BranchGroup* = object
mask*: uint
Expand Down

0 comments on commit a147ff7

Please sign in to comment.