Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transaction test failure #1087

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions tests/frontier/transactions/test_transactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""Test address field in transaction rlp."""

from typing import Optional, Union

import pytest
from pydantic import Field

from ethereum_test_base_types import Bytes
from ethereum_test_tools import (
Address,
Alloc,
Transaction,
TransactionException,
TransactionTestFiller,
)

REFERENCE_SPEC_GIT_PATH = None
REFERENCE_SPEC_VERSION = None

pytestmark = pytest.mark.valid_from("Frontier")


class TestTransaction(Transaction):
"""Test version of the Transaction class where 'to' accepts Bytes."""

to: Optional[Union[Bytes, Address, None]] = Field(Bytes(bytes.fromhex("00")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to: Optional[Union[Bytes, Address, None]] = Field(Bytes(bytes.fromhex("00")))
to: Bytes | Address | None = Field(Bytes(bytes.fromhex("00")))

I think this should work too.



def test_tx_address_less_than_20(
transaction_test: TransactionTestFiller,
pre: Alloc,
):
"""Test sending a transaction with an empty authorization list."""
tx = TestTransaction(
gas_limit=100_000,
to=bytes.fromhex("0011"),
value=0,
error=TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should create a new exception that is more appropriate for this specific kind of failure.

sender=pre.fund_eoa(),
)
tx = tx.with_signature_and_sender()
hash = tx.hash

transaction_test(
pre=pre,
tx=tx,
)
Loading