Skip to content

Commit

Permalink
fix(consensus): serde aliases to avoid breaking changes (#1654)
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya authored Nov 18, 2024
1 parent cc63949 commit 48c4391
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/consensus/src/block/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ pub struct Header {
/// block’s header, in its entirety; formally Hp.
pub parent_hash: B256,
/// The Keccak 256-bit hash of the ommers list portion of this block; formally Ho.
#[cfg_attr(feature = "serde", serde(rename = "sha3Uncles"))]
#[cfg_attr(feature = "serde", serde(rename = "sha3Uncles", alias = "ommersHash"))]
pub ommers_hash: B256,
/// The 160-bit address to which all fees collected from the successful mining of this block
/// be transferred; formally Hc.
#[cfg_attr(feature = "serde", serde(rename = "miner"))]
#[cfg_attr(feature = "serde", serde(rename = "miner", alias = "beneficiary"))]
pub beneficiary: Address,
/// The Keccak 256-bit hash of the root node of the state trie, after all transactions are
/// executed and finalisations applied; formally Hr.
Expand Down
5 changes: 4 additions & 1 deletion crates/consensus/src/transaction/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ pub struct TxEip1559 {
/// this transaction. This is paid up-front, before any
/// computation is done and may not be increased
/// later; formally Tg.
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity", rename = "gas"))]
#[cfg_attr(
feature = "serde",
serde(with = "alloy_serde::quantity", rename = "gas", alias = "gasLimit")
)]
pub gas_limit: u64,
/// A scalar value equal to the maximum
/// amount of gas that should be used in executing
Expand Down
5 changes: 4 additions & 1 deletion crates/consensus/src/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ pub struct TxEip2930 {
/// this transaction. This is paid up-front, before any
/// computation is done and may not be increased
/// later; formally Tg.
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity", rename = "gas"))]
#[cfg_attr(
feature = "serde",
serde(with = "alloy_serde::quantity", rename = "gas", alias = "gasLimit")
)]
pub gas_limit: u64,
/// The 160-bit address of the message call’s recipient or, for a contract creation
/// transaction, ∅, used here to denote the only member of B0 ; formally Tt.
Expand Down
5 changes: 4 additions & 1 deletion crates/consensus/src/transaction/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,10 @@ pub struct TxEip4844 {
/// this transaction. This is paid up-front, before any
/// computation is done and may not be increased
/// later; formally Tg.
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity", rename = "gas"))]
#[cfg_attr(
feature = "serde",
serde(with = "alloy_serde::quantity", rename = "gas", alias = "gasLimit")
)]
pub gas_limit: u64,
/// A scalar value equal to the maximum
/// amount of gas that should be used in executing
Expand Down
5 changes: 4 additions & 1 deletion crates/consensus/src/transaction/eip7702.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ pub struct TxEip7702 {
/// this transaction. This is paid up-front, before any
/// computation is done and may not be increased
/// later; formally Tg.
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity", rename = "gas"))]
#[cfg_attr(
feature = "serde",
serde(with = "alloy_serde::quantity", rename = "gas", alias = "gasLimit")
)]
pub gas_limit: u64,
/// A scalar value equal to the maximum
/// amount of gas that should be used in executing
Expand Down
5 changes: 4 additions & 1 deletion crates/consensus/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ pub struct TxLegacy {
/// this transaction. This is paid up-front, before any
/// computation is done and may not be increased
/// later; formally Tg.
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity", rename = "gas"))]
#[cfg_attr(
feature = "serde",
serde(with = "alloy_serde::quantity", rename = "gas", alias = "gasLimit")
)]
pub gas_limit: u64,
/// The 160-bit address of the message call’s recipient or, for a contract creation
/// transaction, ∅, used here to denote the only member of B0 ; formally Tt.
Expand Down

0 comments on commit 48c4391

Please sign in to comment.