fix: ambiguous deposit mint value in arbitrary (#9216)

This commit is contained in:
Roman Krasiuk
2024-07-01 04:26:44 -07:00
committed by GitHub
parent e6842fb8bd
commit 068bf57c06

View File

@@ -1478,6 +1478,16 @@ impl<'a> arbitrary::Arbitrary<'a> for TransactionSigned {
if tx_eip_4844.to != Address::default() { Some(()) } else { None };
}
#[cfg(feature = "optimism")]
// Both `Some(0)` and `None` values are encoded as empty string byte. This introduces
// ambiguity in roundtrip tests. Patch the mint value of deposit transaction here, so that
// it's `None` if zero.
if let Transaction::Deposit(ref mut tx_deposit) = transaction {
if tx_deposit.mint == Some(0) {
tx_deposit.mint = None;
}
}
let signature = Signature::arbitrary(u)?;
#[cfg(feature = "optimism")]