Skip to content

Commit 85edc45

Browse files
authored
feat: make trace fields pub (#57)
* make trace fields pub * update zktrie-ng
1 parent f8263f5 commit 85edc45

File tree

3 files changed

+63
-63
lines changed

3 files changed

+63
-63
lines changed

Cargo.lock

+21-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/primitives/src/types/mod.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ pub use tx::{ArchivedTransactionTrace, TransactionTrace, TxL1Msg, TypedTransacti
1212
)]
1313
#[archive(check_bytes)]
1414
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
15-
struct BlockHeader {
15+
pub struct BlockHeader {
1616
/// block number
17-
number: U256,
17+
pub number: U256,
1818
/// block hash
19-
hash: B256,
19+
pub hash: B256,
2020
/// timestamp
21-
timestamp: U256,
21+
pub timestamp: U256,
2222
/// gas limit
2323
#[serde(rename = "gasLimit")]
24-
gas_limit: U256,
24+
pub gas_limit: U256,
2525
/// gas used
2626
#[serde(rename = "gasUsed")]
27-
gas_used: U256,
27+
pub gas_used: U256,
2828
/// base fee per gas
2929
#[serde(rename = "baseFeePerGas")]
30-
base_fee_per_gas: Option<U256>,
30+
pub base_fee_per_gas: Option<U256>,
3131
/// difficulty
32-
difficulty: U256,
32+
pub difficulty: U256,
3333
/// mix hash
3434
#[serde(rename = "mixHash")]
35-
mix_hash: Option<B256>,
35+
pub mix_hash: Option<B256>,
3636
}
3737

3838
/// Coinbase
@@ -41,9 +41,9 @@ struct BlockHeader {
4141
)]
4242
#[archive(check_bytes)]
4343
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
44-
struct Coinbase {
44+
pub struct Coinbase {
4545
/// address of coinbase
46-
address: Address,
46+
pub address: Address,
4747
}
4848

4949
/// Bytecode trace
@@ -52,9 +52,9 @@ struct Coinbase {
5252
)]
5353
#[archive(check_bytes)]
5454
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
55-
struct BytecodeTrace {
55+
pub struct BytecodeTrace {
5656
/// bytecode
57-
code: Bytes,
57+
pub code: Bytes,
5858
}
5959

6060
/// storage trace
@@ -73,17 +73,17 @@ struct BytecodeTrace {
7373
)]
7474
#[archive(check_bytes)]
7575
#[archive_attr(derive(Debug, Hash, PartialEq, Eq))]
76-
struct StorageTrace {
76+
pub struct StorageTrace {
7777
/// root before
7878
#[serde(rename = "rootBefore")]
79-
root_before: B256,
79+
pub root_before: B256,
8080
/// root after
8181
#[serde(rename = "rootAfter")]
82-
root_after: B256,
82+
pub root_after: B256,
8383
/// proofs
8484
#[serde(rename = "flattenProofs")]
8585
#[serde_as(as = "Map<_, _>")]
86-
flatten_proofs: Vec<(B256, Bytes)>,
86+
pub flatten_proofs: Vec<(B256, Bytes)>,
8787
}
8888

8989
/// Block trace format
@@ -97,23 +97,23 @@ struct StorageTrace {
9797
pub struct BlockTrace {
9898
/// chain id
9999
#[serde(rename = "chainID", default)]
100-
chain_id: u64,
100+
pub chain_id: u64,
101101
/// coinbase
102-
coinbase: Coinbase,
102+
pub coinbase: Coinbase,
103103
/// block
104-
header: BlockHeader,
104+
pub header: BlockHeader,
105105
/// txs
106-
transactions: Vec<TransactionTrace>,
106+
pub transactions: Vec<TransactionTrace>,
107107
/// bytecodes
108-
codes: Vec<BytecodeTrace>,
108+
pub codes: Vec<BytecodeTrace>,
109109
/// storage trace BEFORE execution
110110
#[serde(rename = "storageTrace")]
111-
storage_trace: StorageTrace,
111+
pub storage_trace: StorageTrace,
112112
/// l1 tx queue
113113
#[serde(rename = "startL1QueueIndex", default)]
114-
start_l1_queue_index: u64,
114+
pub start_l1_queue_index: u64,
115115
/// Withdraw root
116-
withdraw_trie_root: B256,
116+
pub withdraw_trie_root: B256,
117117
}
118118

119119
impl Block for BlockTrace {

crates/primitives/src/types/tx.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -65,47 +65,47 @@ pub struct TxL1Msg {
6565
pub struct TransactionTrace {
6666
/// tx hash
6767
#[serde(default, rename = "txHash")]
68-
pub(crate) tx_hash: B256,
68+
pub tx_hash: B256,
6969
/// tx type (in raw from)
7070
#[serde(rename = "type")]
71-
pub(crate) ty: u8,
71+
pub ty: u8,
7272
/// nonce
73-
pub(crate) nonce: u64,
73+
pub nonce: u64,
7474
/// gas limit
75-
pub(crate) gas: u64,
75+
pub gas: u64,
7676
#[serde(rename = "gasPrice")]
7777
/// gas price
78-
pub(crate) gas_price: U256,
78+
pub gas_price: U256,
7979
#[serde(rename = "gasTipCap")]
8080
/// gas tip cap
81-
pub(crate) gas_tip_cap: Option<U256>,
81+
pub gas_tip_cap: Option<U256>,
8282
#[serde(rename = "gasFeeCap")]
8383
/// gas fee cap
84-
pub(crate) gas_fee_cap: Option<U256>,
84+
pub gas_fee_cap: Option<U256>,
8585
/// from
86-
pub(crate) from: Address,
86+
pub from: Address,
8787
/// to, NONE for creation (0 addr)
88-
pub(crate) to: Option<Address>,
88+
pub to: Option<Address>,
8989
/// chain id
9090
#[serde(rename = "chainId")]
91-
pub(crate) chain_id: U64,
91+
pub chain_id: U64,
9292
/// value amount
93-
pub(crate) value: U256,
93+
pub value: U256,
9494
/// call data
95-
pub(crate) data: Bytes,
95+
pub data: Bytes,
9696
/// is creation
9797
#[serde(rename = "isCreate")]
98-
pub(crate) is_create: bool,
98+
pub is_create: bool,
9999
/// access list
100100
#[serde(rename = "accessList")]
101101
#[serde_as(as = "DefaultOnNull")]
102-
pub(crate) access_list: AccessList,
102+
pub access_list: AccessList,
103103
/// signature v
104-
pub(crate) v: U64,
104+
pub v: U64,
105105
/// signature r
106-
pub(crate) r: U256,
106+
pub r: U256,
107107
/// signature s
108-
pub(crate) s: U256,
108+
pub s: U256,
109109
}
110110

111111
impl TxTrace for TransactionTrace {

0 commit comments

Comments
 (0)