Description
Component
Anvil
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
Latest
What command(s) is the bug in?
No response
Operating System
Linux
Describe the bug
Since 4 days ago, the version of anvil
downloaded by installing foundryup via the script at https://foundry.paradigm.xyz (and then running it) has yielded
ErrorResp(ErrorPayload { code: -32602, message: "Failed to decode transaction", data: None })
when I run the following block of code:
let provider = RootProvider::<_, Ethereum>::new(
ClientBuilder::default().transport(SimpleRequest::new(rpc_url.clone()), true),
);
let _ = provider.send_raw_transaction(tx).await.unwrap();
The tx
value in that case is an opaque byte array generated as follows:
let tx = TxLegacy {
chain_id: None,
nonce: *nonce,
gas_price: 1_000_000_000u128,
gas_limit: 200_000u128,
to: TxKind::Call(router_addr.into()),
// 1 ETH
value: one_eth,
input: ethereum_serai::router::abi::inInstructionCall::new((
[0; 20].into(),
one_eth,
if let Some(instruction) = instruction {
Shorthand::Raw(RefundableInInstruction { origin: None, instruction }).encode().into()
} else {
vec![].into()
},
))
.abi_encode()
.into(),
};
*nonce += 1;
let sig =
k256::ecdsa::SigningKey::from(k256::elliptic_curve::NonZeroScalar::new(*key).unwrap())
.sign_prehash_recoverable(tx.signature_hash().as_ref())
.unwrap();
let mut bytes = vec![];
tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes);
You can observe this failure in my CI: https://github.com/serai-dex/serai/actions/runs/11162161674/job/31026214470 (where the commit prior worked, and this commit didn't touch any of our work with Ethereum).
This obviously isn't a MRE and I apologize for that. I just wanted to file this ASAP until I have time to poke more later. I didn't see any filed issues/open PRs recently which seems to be relevant here. Off-hand, I have some loose guess this a quirk with publishing legacy TXs (outside of an envelope) but I truly don't know. https://github.com/serai-dex/serai//blob/55fb8a588922dcae8a13a6f269fc98f9c2843e1b/Cargo.lock#L102-L507 for my alloy versions, which is 0.3 for the non-core libs and not yet 0.4 (which may be of relevance here).