Skip to content

Commit

Permalink
temp-fix: check hist. storage cont.
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-tb committed Sep 10, 2024
1 parent 72fa6ef commit 4bc9b7f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/ethereum_test_specs/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,15 @@ def generate_block_data(
raise Exception(
"no state diff in transition tool output, cannot verify witness"
)
# TODO: hack for now, temp addition to check hist. storage contract
block.witness_check.add_storage_slot(
address=Address(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE),
storage_slot=env.number - 1,
# value=env.parent_hash,
value=None,
)
self.verify_witness(
t8n=t8n,
fork=fork,
state_diff=transition_tool_output.result.state_diff,
witness_check=block.witness_check,
)
Expand Down Expand Up @@ -620,7 +626,6 @@ def verify_post_state(
def verify_witness(
self,
t8n: TransitionTool,
fork: Fork,
state_diff: StateDiff,
witness_check: WitnessCheck,
) -> None:
Expand All @@ -633,17 +638,11 @@ def verify_witness(
)
print("\nExpected witness check state diff:")
print(witness_check_state_diff.model_dump_json(indent=4))
system_contract_accounts = fork.pre_allocation_blockchain().items()
addresses_to_skip = [Address(address) for address, _ in system_contract_accounts]

for stem_state_diff in state_diff.root:
actual_stem = stem_state_diff.stem
address = witness_check_address_mapping.get(actual_stem, None)
print(f"\nChecking witness for stem: {actual_stem} at address: {address}")
# TODO: skip system contract addresses for now
if address in addresses_to_skip:
print(f"Skipping system contract address in witness check: {address}")
continue
# check for stem in the expected witness check
expected_stem_state_diff = next(
(sd for sd in witness_check_state_diff.root if sd.stem == actual_stem), None
Expand Down

0 comments on commit 4bc9b7f

Please sign in to comment.