Skip to content

Commit

Permalink
feat: make trace fields pub (#57)
Browse files Browse the repository at this point in the history
* make trace fields pub

* update zktrie-ng
  • Loading branch information
lightsing authored Sep 24, 2024
1 parent f8263f5 commit 85edc45
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 63 deletions.
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions crates/primitives/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ pub use tx::{ArchivedTransactionTrace, TransactionTrace, TxL1Msg, TypedTransacti
)]
#[archive(check_bytes)]
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
struct BlockHeader {
pub struct BlockHeader {
/// block number
number: U256,
pub number: U256,
/// block hash
hash: B256,
pub hash: B256,
/// timestamp
timestamp: U256,
pub timestamp: U256,
/// gas limit
#[serde(rename = "gasLimit")]
gas_limit: U256,
pub gas_limit: U256,
/// gas used
#[serde(rename = "gasUsed")]
gas_used: U256,
pub gas_used: U256,
/// base fee per gas
#[serde(rename = "baseFeePerGas")]
base_fee_per_gas: Option<U256>,
pub base_fee_per_gas: Option<U256>,
/// difficulty
difficulty: U256,
pub difficulty: U256,
/// mix hash
#[serde(rename = "mixHash")]
mix_hash: Option<B256>,
pub mix_hash: Option<B256>,
}

/// Coinbase
Expand All @@ -41,9 +41,9 @@ struct BlockHeader {
)]
#[archive(check_bytes)]
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
struct Coinbase {
pub struct Coinbase {
/// address of coinbase
address: Address,
pub address: Address,
}

/// Bytecode trace
Expand All @@ -52,9 +52,9 @@ struct Coinbase {
)]
#[archive(check_bytes)]
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
struct BytecodeTrace {
pub struct BytecodeTrace {
/// bytecode
code: Bytes,
pub code: Bytes,
}

/// storage trace
Expand All @@ -73,17 +73,17 @@ struct BytecodeTrace {
)]
#[archive(check_bytes)]
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
struct StorageTrace {
pub struct StorageTrace {
/// root before
#[serde(rename = "rootBefore")]
root_before: B256,
pub root_before: B256,
/// root after
#[serde(rename = "rootAfter")]
root_after: B256,
pub root_after: B256,
/// proofs
#[serde(rename = "flattenProofs")]
#[serde_as(as = "Map<_, _>")]
flatten_proofs: Vec<(B256, Bytes)>,
pub flatten_proofs: Vec<(B256, Bytes)>,
}

/// Block trace format
Expand All @@ -97,23 +97,23 @@ struct StorageTrace {
pub struct BlockTrace {
/// chain id
#[serde(rename = "chainID", default)]
chain_id: u64,
pub chain_id: u64,
/// coinbase
coinbase: Coinbase,
pub coinbase: Coinbase,
/// block
header: BlockHeader,
pub header: BlockHeader,
/// txs
transactions: Vec<TransactionTrace>,
pub transactions: Vec<TransactionTrace>,
/// bytecodes
codes: Vec<BytecodeTrace>,
pub codes: Vec<BytecodeTrace>,
/// storage trace BEFORE execution
#[serde(rename = "storageTrace")]
storage_trace: StorageTrace,
pub storage_trace: StorageTrace,
/// l1 tx queue
#[serde(rename = "startL1QueueIndex", default)]
start_l1_queue_index: u64,
pub start_l1_queue_index: u64,
/// Withdraw root
withdraw_trie_root: B256,
pub withdraw_trie_root: B256,
}

impl Block for BlockTrace {
Expand Down
34 changes: 17 additions & 17 deletions crates/primitives/src/types/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,47 +65,47 @@ pub struct TxL1Msg {
pub struct TransactionTrace {
/// tx hash
#[serde(default, rename = "txHash")]
pub(crate) tx_hash: B256,
pub tx_hash: B256,
/// tx type (in raw from)
#[serde(rename = "type")]
pub(crate) ty: u8,
pub ty: u8,
/// nonce
pub(crate) nonce: u64,
pub nonce: u64,
/// gas limit
pub(crate) gas: u64,
pub gas: u64,
#[serde(rename = "gasPrice")]
/// gas price
pub(crate) gas_price: U256,
pub gas_price: U256,
#[serde(rename = "gasTipCap")]
/// gas tip cap
pub(crate) gas_tip_cap: Option<U256>,
pub gas_tip_cap: Option<U256>,
#[serde(rename = "gasFeeCap")]
/// gas fee cap
pub(crate) gas_fee_cap: Option<U256>,
pub gas_fee_cap: Option<U256>,
/// from
pub(crate) from: Address,
pub from: Address,
/// to, NONE for creation (0 addr)
pub(crate) to: Option<Address>,
pub to: Option<Address>,
/// chain id
#[serde(rename = "chainId")]
pub(crate) chain_id: U64,
pub chain_id: U64,
/// value amount
pub(crate) value: U256,
pub value: U256,
/// call data
pub(crate) data: Bytes,
pub data: Bytes,
/// is creation
#[serde(rename = "isCreate")]
pub(crate) is_create: bool,
pub is_create: bool,
/// access list
#[serde(rename = "accessList")]
#[serde_as(as = "DefaultOnNull")]
pub(crate) access_list: AccessList,
pub access_list: AccessList,
/// signature v
pub(crate) v: U64,
pub v: U64,
/// signature r
pub(crate) r: U256,
pub r: U256,
/// signature s
pub(crate) s: U256,
pub s: U256,
}

impl TxTrace for TransactionTrace {
Expand Down

0 comments on commit 85edc45

Please sign in to comment.