Skip to content

Pydantic validation for Transaction object is incorrect #23

@miohtama

Description

@miohtama

There is a problem in transaction signing.

  
>       return cls(**tx_data)
E       pydantic_core._pydantic_core.ValidationError: 1 validation error for Transaction
E       gasPrice
E         Field required [type=missing, input_value={'gas': 100000, 'value': ...8829300000', 'nonce': 2}, input_type=dict]
E           For further information visit https://errors.pydantic.dev/2.11/v/missing

/Users/moo/Library/Caches/pypoetry/virtualenvs/web3-ethereum-defi-YE4GM4ox-py3.11/lib/python3.11/site-packages/web3_google_hsm/types/ethereum_types.py:158: ValidationError

gasPrice field is only for legacy transactions. Post-London hardfork transactions use maxFeePerGas and maxPriorityFeePerGas.

https://github.com/ethereum/web3.py/blob/c70f7fbe1cfa98b1ce8597a08c99e05759a9667b/web3/_utils/transactions.py#L57

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions