Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ use anvil_core::{
EthRequest,
block::BlockInfo,
transaction::{
FillTransactionResult, PendingTransaction, ReceiptResponse, TypedTransaction,
TypedTransactionRequest, transaction_request_to_typed,
FillTransactionResult, MaybeImpersonatedTransaction, PendingTransaction,
ReceiptResponse, TypedTransaction, TypedTransactionRequest,
transaction_request_to_typed,
},
wallet::WalletCapabilities,
},
Expand Down Expand Up @@ -1373,7 +1374,7 @@ impl EthApi {
pub async fn fill_transaction(
&self,
mut request: WithOtherFields<TransactionRequest>,
) -> Result<FillTransactionResult<TypedTransaction>> {
) -> Result<FillTransactionResult<AnyRpcTransaction>> {
node_info!("eth_fillTransaction");

let from = match request.as_ref().from() {
Expand Down Expand Up @@ -1429,6 +1430,13 @@ impl EthApi {

let raw = tx.encoded_2718().to_vec().into();

let mut tx =
transaction_build(None, MaybeImpersonatedTransaction::new(tx), None, None, None);

// Set the correct `from` address (overrides the recovered zero address from dummy
// signature)
tx.0.inner.inner = Recovered::new_unchecked(tx.0.inner.inner.into_inner(), from);

Ok(FillTransactionResult { raw, tx })
}

Expand Down
8 changes: 3 additions & 5 deletions crates/anvil/tests/it/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,8 @@ async fn test_fill_transaction_fills_all_missing_fields() {
// Should fill all required fields and be EIP-1559
assert!(filled.tx.is_eip1559());
assert!(filled.tx.gas_limit() > 0);
let essentials = filled.tx.essentials();
assert!(essentials.max_fee_per_gas.is_some());
assert!(essentials.max_priority_fee_per_gas.is_some());
assert!(filled.tx.max_fee_per_gas() > 0);
assert!(filled.tx.max_priority_fee_per_gas().is_some());
}

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -578,8 +577,7 @@ async fn test_fill_transaction_eip4844_blob_fee() {
filled.tx.max_fee_per_blob_gas().is_some(),
"max_fee_per_blob_gas should be filled for blob tx"
);
let essentials = filled.tx.essentials();
assert!(essentials.blob_versioned_hashes.is_some(), "blob_versioned_hashes should be present");
assert!(filled.tx.blob_versioned_hashes().is_some(), "blob_versioned_hashes should be present");
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
Loading