Skip to content

refactor(anvil): use primitives to build typed tx from tx request #12784

@mablr

Description

@mablr

This old helper looks similar to TransactionBuilder trait's build_unsigned, but it fills silently some fields while the latest returns an error with the list of missing fields.

pub fn transaction_request_to_typed(

So the remplacement is not "drop-in" - but I think - it is very beneficial. For now it used in 3 places:

  • ‎EthApi::build_typed_tx_request, imo the whole method should be refactored, by prefilling request and then building typed tx.

    let request = match transaction_request_to_typed(request) {

  • determine_base_gas_by_kind helper, I think we don’t need to build typed tx here as we can simply rely on TransactionBuilder fns to determine type, kind, and access list len.

    match transaction_request_to_typed(request.clone()) {

  • ‎Backend::simulate‎, we can determine proactively tx type and fill missing fields using TransactionBuilder trait fns, or handle build_unsigned error, filling the fields we can then retry. btw this may be wrap into an helper providing similar service as original transaction_request_to_typed.

    let request = transaction_request_to_typed(WithOtherFields::new(request))

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions