Skip to content

Commit

Permalink
Remove witness cache change.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhartnett committed Mar 7, 2025
1 parent 612135c commit ff0ff12
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
4 changes: 0 additions & 4 deletions execution_chain/db/ledger.nim
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,6 @@ proc getCode*(ac: LedgerRef,
returnHash: static[bool] = false): auto =
let acc = ac.getAccount(address, false)
if acc.isNil:
# We need to record that the code was read even if the account doesn't exist
# so that the returned multikeys correctly show that the code lookup occurred
ac.witnessCache[address] = WitnessData(codeTouched: true)

when returnHash:
return (EMPTY_CODE_HASH, CodeBytesRef())
else:
Expand Down
20 changes: 0 additions & 20 deletions tests/test_ledger.nim
Original file line number Diff line number Diff line change
Expand Up @@ -752,26 +752,6 @@ proc runLedgerBasicOperationsTests() =
multikeys[0].storageKeys.keys[0].storageSlot == 4.u256.toBytesBE()
multikeys[0].storageKeys.keys[1].storageSlot == 3.u256.toBytesBE()

test "Test MultiKeys - Get code":
var
ac = LedgerRef.init(memDB.baseTxFrame())
addr1 = initAddr(1)
addr2 = initAddr(2)

ac.setCode(addr1, code)
discard ac.getCode(addr1) # Returns code
discard ac.getCode(addr2) # Returns default empty code

ac.collectWitnessData()
let multikeys = ac.makeMultiKeys().keys

check:
multikeys.len() == 2
multikeys[0].storageMode == false
multikeys[0].address == addr1
multikeys[1].storageMode == false
multikeys[1].address == addr2

# ------------------------------------------------------------------------------
# Main function(s)
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit ff0ff12

Please sign in to comment.