Skip to content

Commit

Permalink
fix(tests): exception lists
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Apr 3, 2024
1 parent d6bb8cd commit d7eac86
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 5 additions & 3 deletions tests/cancun/eip4844_blobs/test_blob_txs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,8 +1153,10 @@ def test_invalid_blob_tx_contract_creation(
blocks=[
Block(
txs=txs,
exception=TransactionException.TYPE_3_TX_CONTRACT_CREATION
| BlockException.RLP_STRUCTURES_ENCODING,
exception=[
BlockException.RLP_STRUCTURES_ENCODING,
TransactionException.TYPE_3_TX_CONTRACT_CREATION,
],
header_verify=header_verify,
)
],
Expand Down Expand Up @@ -1392,7 +1394,7 @@ def test_blob_tx_attribute_gasprice_opcode(
[0],
None,
1,
TransactionException.TYPE_3_TX_PRE_FORK | TransactionException.TYPE_3_TX_ZERO_BLOBS,
[TransactionException.TYPE_3_TX_PRE_FORK, TransactionException.TYPE_3_TX_ZERO_BLOBS],
),
([1], None, 1, TransactionException.TYPE_3_TX_PRE_FORK),
],
Expand Down
7 changes: 4 additions & 3 deletions tests/cancun/eip4844_blobs/test_blob_txs_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ def blocks(
if any(txs_wrapped_blobs):
# This is a block exception because the invalid block is only created in the RLP version,
# not in the transition tool.
block_error = (
TransactionException.TYPE_3_TX_WITH_FULL_BLOBS | BlockException.RLP_STRUCTURES_ENCODING
)
block_error = [
BlockException.RLP_STRUCTURES_ENCODING,
TransactionException.TYPE_3_TX_WITH_FULL_BLOBS,
]
if len(txs) > 0:
header_blob_gas_used = (
sum(
Expand Down
10 changes: 6 additions & 4 deletions tests/cancun/eip4844_blobs/test_excess_blob_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
BlockchainTestFiller,
BlockException,
Environment,
ExceptionType,
Hash,
Header,
)
Expand Down Expand Up @@ -268,7 +267,8 @@ def blocks( # noqa: D103
)

def add_block(
header_modifier: Optional[Dict] = None, exception_message: Optional[ExceptionType] = None
header_modifier: Optional[Dict] = None,
exception_message: Optional[BlockException | List[BlockException]] = None,
):
"""
Utility function to add a block to the blocks list.
Expand All @@ -294,8 +294,10 @@ def add_block(
if header_blob_gas_used > Spec.MAX_BLOB_GAS_PER_BLOCK:
add_block(
header_modifier={"blob_gas_used": header_blob_gas_used},
exception_message=BlockException.BLOB_GAS_USED_ABOVE_LIMIT
| BlockException.INCORRECT_BLOB_GAS_USED,
exception_message=[
BlockException.BLOB_GAS_USED_ABOVE_LIMIT,
BlockException.INCORRECT_BLOB_GAS_USED,
],
)
else:
add_block(
Expand Down

0 comments on commit d7eac86

Please sign in to comment.