Skip to content

Commit

Permalink
fix: correct signature type for transaction rpc object (#51)
Browse files Browse the repository at this point in the history
* fix: correct signature type for transaction rpc object

* fix: tests
  • Loading branch information
prestwich authored Dec 13, 2023
1 parent 51ee830 commit 4ed367e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions crates/rpc-types/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ pub struct Transaction {
/// Data
pub input: Bytes,
/// All _flattened_ fields of the transaction signature.
///
/// Note: this is an option so special transaction types without a signature (e.g. <https://github.com/ethereum-optimism/optimism/blob/0bf643c4147b43cd6f25a759d331ef3a2a61a2a3/specs/deposits.md#the-deposited-transaction-type>) can be supported.
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub signature: Option<Signature>,
#[serde(flatten)]
pub signature: Signature,
/// The chain id of the transaction, if any.
pub chain_id: Option<U64>,
/// Contains the blob hashes for eip-4844 transactions.
Expand Down Expand Up @@ -92,12 +90,12 @@ mod tests {
gas_price: Some(U128::from(9)),
gas: U256::from(10),
input: Bytes::from(vec![11, 12, 13]),
signature: Some(Signature {
signature: Signature {
v: U256::from(14),
r: U256::from(14),
s: U256::from(14),
y_parity: None,
}),
},
chain_id: Some(U64::from(17)),
blob_versioned_hashes: vec![],
access_list: None,
Expand Down Expand Up @@ -129,12 +127,12 @@ mod tests {
gas_price: Some(U128::from(9)),
gas: U256::from(10),
input: Bytes::from(vec![11, 12, 13]),
signature: Some(Signature {
signature: Signature {
v: U256::from(14),
r: U256::from(14),
s: U256::from(14),
y_parity: Some(Parity(true)),
}),
},
chain_id: Some(U64::from(17)),
blob_versioned_hashes: vec![],
access_list: None,
Expand Down

0 comments on commit 4ed367e

Please sign in to comment.