Skip to content

Commit

Permalink
fix: prevent decoding U256 TxValue on mainnet (#5344)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Nov 7, 2023
1 parent 47669c5 commit 1b2a4c7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/primitives/src/transaction/tx_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ impl Encodable for TxValue {
impl Decodable for TxValue {
#[inline]
fn decode(buf: &mut &[u8]) -> Result<Self, Error> {
U256::decode(buf).map(Self)
#[cfg(feature = "optimism")]
{
U256::decode(buf).map(Self)
}
#[cfg(not(feature = "optimism"))]
{
u128::decode(buf).map(Self::from)
}
}
}

Expand Down

0 comments on commit 1b2a4c7

Please sign in to comment.