Skip to content

Commit 3ae4f50

Browse files
authored
fix: set both tx input fields (#8373)
1 parent 1bac1b3 commit 3ae4f50

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/cast/bin/tx.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use alloy_consensus::{SidecarBuilder, SimpleCoder};
22
use alloy_json_abi::Function;
33
use alloy_network::{AnyNetwork, TransactionBuilder};
4-
use alloy_primitives::{hex, Address, TxKind};
4+
use alloy_primitives::{hex, Address, Bytes, TxKind};
55
use alloy_provider::Provider;
6-
use alloy_rpc_types::TransactionRequest;
6+
use alloy_rpc_types::{TransactionInput, TransactionRequest};
77
use alloy_serde::WithOtherFields;
88
use alloy_transport::Transport;
99
use eyre::Result;
@@ -232,7 +232,11 @@ where
232232
let from = from.into().resolve(&self.provider).await?;
233233

234234
self.tx.set_kind(self.state.kind);
235-
self.tx.set_input(self.state.input);
235+
236+
// we set both fields to the same value because some nodes only accept the legacy `data` field: <https://github.com/foundry-rs/foundry/issues/7764#issuecomment-2210453249>
237+
let input = Bytes::from(self.state.input);
238+
self.tx.input = TransactionInput { input: Some(input.clone()), data: Some(input) };
239+
236240
self.tx.set_from(from);
237241
self.tx.set_chain_id(self.chain.id());
238242

0 commit comments

Comments
 (0)