Skip to content
11 changes: 1 addition & 10 deletions packages/testing/src/execution_testing/client_clis/clis/besu.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,20 +457,11 @@ class BesuExceptionMapper(ExceptionMapper):
r"Blob transaction has too many blobs: \d+|"
r"Invalid Blob Count: \d+"
),
# BAL Exceptions: TODO - review once all clients completed.
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
r"Block access list hash mismatch, "
r"calculated:\s*(0x[a-f0-9]+)\s+header:\s*(0x[a-f0-9]+)|"
r"Block access list validation failed for block 0x[a-f0-9]+"
),
# BAL Exceptions
BlockException.INVALID_BAL_HASH: (
r"Block access list hash mismatch, "
r"calculated:\s*(0x[a-f0-9]+)\s+header:\s*(0x[a-f0-9]+)"
),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
r"Block access list hash mismatch, "
r"calculated:\s*(0x[a-f0-9]+)\s+header:\s*(0x[a-f0-9]+)"
),
BlockException.BLOCK_ACCESS_LIST_GAS_LIMIT_EXCEEDED: (
r"Block access list validation failed for block 0x[a-f0-9]+"
),
Expand Down
13 changes: 3 additions & 10 deletions packages/testing/src/execution_testing/client_clis/clis/erigon.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,15 @@ class ErigonExceptionMapper(ExceptionMapper):
BlockException.INVALID_STATE_ROOT: "invalid block: wrong trie root",
BlockException.INVALID_RECEIPTS_ROOT: "receiptHash mismatch",
BlockException.INVALID_LOG_BLOOM: "invalid bloom",
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
"block access list mismatch"
),
BlockException.INCORRECT_BLOCK_FORMAT: "invalid block access list",
BlockException.INVALID_BAL_EXTRA_ACCOUNT: "invalid block access list",
BlockException.GAS_USED_OVERFLOW: "block gas used overflow",
}
mapping_regex = {
BlockException.INVALID_BLOCK_ACCESS_LIST: (
BlockException.INVALID_BAL_HASH: (
r"invalid block access list|block access list mismatch"
),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
r"block access list mismatch"
),
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
r"invalid block access list"
BlockException.INVALID_BLOCK_ACCESS_LIST: (
r"invalid block access list|block access list mismatch"
),
BlockException.INCORRECT_BLOCK_FORMAT: (r"invalid block access list"),
BlockException.BLOCK_ACCESS_LIST_GAS_LIMIT_EXCEEDED: (
Expand Down
18 changes: 4 additions & 14 deletions packages/testing/src/execution_testing/client_clis/clis/ethrex.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ class EthrexExceptionMapper(ExceptionMapper):
"Block access list hash does not match the one in "
"the header after executing"
),
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
"Block access list hash does not match the one in "
"the header after executing"
),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
"Block access list hash does not match the one in "
"the header after executing"
),
BlockException.INCORRECT_BLOCK_FORMAT: (
"not in strictly ascending order for"
),
Expand Down Expand Up @@ -175,20 +167,18 @@ class EthrexExceptionMapper(ExceptionMapper):
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
r"Maximum block size exceeded.*"
),
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
r"Block access list accounts not in strictly ascending order.*|"
r"BAL validation failed: account .* was never accessed.*"
),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (r"absent from BAL"),
BlockException.INVALID_BAL_HASH: r"BAL validation failed",
BlockException.INVALID_BLOCK_ACCESS_LIST: (
r"Block access list contains index \d+ "
r"exceeding max valid index \d+|"
r"Failed to RLP decode BAL|"
r"Block access list .+ not in strictly ascending order.*|"
r"BAL validation failed for (tx \d+|system_tx|withdrawal): .*|"
r"BAL validation failed: .*|"
r"absent from BAL|"
r"Block access list slot .+ is in both "
r"storage_changes and storage_reads.*"
r"storage_changes and storage_reads.*|"
r"Invalid block hash"
),
BlockException.INCORRECT_BLOCK_FORMAT: (
r"Block access list hash does not match "
Expand Down
24 changes: 8 additions & 16 deletions packages/testing/src/execution_testing/client_clis/clis/geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ class GethExceptionMapper(ExceptionMapper):
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
"block RLP-encoded size exceeds maximum"
),
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
"BAL change not reported in computed"
),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
"additional mutations compared to BAL"
),
BlockException.INVALID_BLOCK_ACCESS_LIST: "unequal",
BlockException.INVALID_BASEFEE_PER_GAS: "invalid baseFee",
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
Expand Down Expand Up @@ -157,19 +151,17 @@ class GethExceptionMapper(ExceptionMapper):
#
# EELS definition for `is_valid_deposit_event_data`:
# https://github.com/ethereum/execution-specs/blob/5ddb904fa7ba27daeff423e78466744c51e8cb6a/src/ethereum/forks/prague/requests.py#L51
# BAL Exceptions: TODO - review once all clients completed.
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
r"invalid block access list:"
),
# BAL Exceptions
BlockException.INVALID_BAL_HASH: (r"invalid block access list:"),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
r"computed state diff contained mutated accounts "
r"which weren't reported in BAL|"
r"invalid block access list:"
),
BlockException.INVALID_BLOCK_ACCESS_LIST: (
r"difference between computed state diff and "
r"BAL entry for account|invalid block access list:"
r"BAL entry for account|"
r"invalid block access list:|"
r"computed state diff contained mutated accounts "
r"which weren't reported in BAL|"
r"BAL change not reported in computed|"
r"additional mutations compared to BAL|"
r"[bB][aA][lL] validation fail"
),
BlockException.INCORRECT_BLOCK_FORMAT: (r"invalid block access list:"),
BlockException.BLOCK_ACCESS_LIST_GAS_LIMIT_EXCEEDED: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,8 @@ class NethermindExceptionMapper(ExceptionMapper):
# BAL Exceptions — specific exceptions have unique patterns, but
# INVALID_BLOCK_ACCESS_LIST and INCORRECT_BLOCK_FORMAT intentionally
# overlap because the test framework requires `want in got` matching.
# BAL Exceptions
BlockException.INVALID_BAL_HASH: (r"InvalidBlockLevelAccessListHash:"),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
r"InvalidBlockLevelAccessList:.*missing account"
),
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
r"InvalidBlockLevelAccessList:.*surplus changes"
r"|could not be parsed as a block: "
r"Error decoding block access list:"
),
BlockException.INVALID_BLOCK_ACCESS_LIST: (
r"InvalidBlockLevelAccessListHash:"
r"|InvalidBlockLevelAccessList:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,8 @@ class RethExceptionMapper(ExceptionMapper):
BlockException.GAS_USED_OVERFLOW: (
r"transaction gas limit \w+ is more than blocks available gas \w+"
),
# BAL Exceptions: TODO - review once all clients completed.
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
r"block access list hash mismatch"
),
# BAL Exceptions
BlockException.INVALID_BAL_HASH: (r"block access list hash mismatch"),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
r"block access list hash mismatch"
),
BlockException.INVALID_BLOCK_ACCESS_LIST: (
r"block access list hash mismatch"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,6 @@ class BlockException(ExceptionBase):
"""Block's access list is invalid."""
INVALID_BAL_HASH = auto()
"""Block header's BAL hash does not match the computed BAL hash."""
INVALID_BAL_EXTRA_ACCOUNT = auto()
"""
Block BAL contains an account change that is not present in the computed
BAL.
"""
INVALID_BAL_MISSING_ACCOUNT = auto()
"""
Block BAL is missing an account change that is present in the computed BAL.
"""
BLOCK_ACCESS_LIST_GAS_LIMIT_EXCEEDED = auto()
"""
Block access list exceeds the gas limit constraint (EIP-7928).
Expand Down
33 changes: 22 additions & 11 deletions packages/testing/src/execution_testing/specs/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Header(CamelModel):
excess_blob_gas: Removable | HexNumber | None = None
parent_beacon_block_root: Removable | Hash | None = None
requests_hash: Removable | Hash | None = None
bal_hash: Removable | Hash | None = None
block_access_list_hash: Removable | Hash | None = None

REMOVE_FIELD: ClassVar[Removable] = Removable()
"""
Expand Down Expand Up @@ -216,12 +216,18 @@ def apply(self, target: FixtureHeader) -> FixtureHeader:
"""
Produce a fixture header copy with the set values from the modifier.
"""
return target.copy(
**{
k: (v if v is not Header.REMOVE_FIELD else None)
for k, v in self.model_dump(exclude_none=True).items()
}
)
overrides = {
k: (v if v is not Header.REMOVE_FIELD else None)
for k, v in self.model_dump(exclude_none=True).items()
}
unknown = overrides.keys() - target.__class__.model_fields.keys()
if unknown:
raise ValueError(
f"Header fields {unknown} do not exist on "
f"{target.__class__.__name__}. Check for field name "
f"mismatches between Header and {target.__class__.__name__}."
)
return target.copy(**overrides)

def verify(self, target: FixtureHeader) -> None:
"""Verify that the header fields from self are as expected."""
Expand Down Expand Up @@ -334,7 +340,9 @@ def set_environment(self, env: Environment) -> Environment:
not isinstance(self.requests_hash, Removable)
and self.block_access_list is not None
):
new_env_values["bal_hash"] = self.block_access_list.keccak256()
new_env_values["block_access_list_hash"] = (
self.block_access_list.keccak256()
)
new_env_values["block_access_list"] = self.block_access_list
if (
not isinstance(self.block_access_list, Removable)
Expand Down Expand Up @@ -723,11 +731,14 @@ def generate_block_data(
"provided by the transition tool"
)

computed_bal_hash = Hash(t8n_bal.rlp.keccak256())
assert computed_bal_hash == header.block_access_list_hash, (
computed_block_access_list_hash = Hash(t8n_bal.rlp.keccak256())
assert (
computed_block_access_list_hash
== header.block_access_list_hash
), (
"Block access list hash in header does not match the "
f"computed hash from BAL: {header.block_access_list_hash} "
f"!= {computed_bal_hash}"
f"!= {computed_block_access_list_hash}"
)

if block.rlp_modifier is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def strip_computed_fields(cls, data: Any) -> Any:
extra_data: Bytes = Field(Bytes(b"\x00"), exclude=True)

# EIP-7928: Block-level access lists
bal_hash: Hash | None = Field(None)
block_access_list_hash: Hash | None = Field(None)
block_access_lists: Bytes | None = Field(None)

@computed_field # type: ignore[prop-decorator]
Expand Down
Loading
Loading