Skip to content

Commit cb4841f

Browse files
committed
fix GasFeeCap/GasTipCap for legacyTx
1 parent 349bcc2 commit cb4841f

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

geth-utils/gethutil/trace.go

+14-15
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,20 @@ type Account struct {
9999
}
100100

101101
type Transaction struct {
102-
From common.Address `json:"from"`
103-
To *common.Address `json:"to"`
104-
Nonce hexutil.Uint64 `json:"nonce"`
105-
Value *hexutil.Big `json:"value"`
106-
GasLimit hexutil.Uint64 `json:"gas_limit"`
107-
GasPrice *hexutil.Big `json:"gas_price"`
108-
GasFeeCap *hexutil.Big `json:"gas_fee_cap"`
109-
GasTipCap *hexutil.Big `json:"gas_tip_cap"`
110-
CallData hexutil.Bytes `json:"call_data"`
111-
AccessList []struct {
112-
Address common.Address `json:"address"`
113-
// Must be `storageKeys`, since `camelCase` is specified in ethers-rs.
114-
// <https://github.com/gakonst/ethers-rs/blob/88095ba47eb6a3507f0db1767353b387b27a6e98/ethers-core/src/types/transaction/eip2930.rs#L75>
115-
StorageKeys []common.Hash `json:"storageKeys"`
116-
} `json:"access_list"`
102+
From common.Address `json:"from"`
103+
To *common.Address `json:"to"`
104+
Nonce hexutil.Uint64 `json:"nonce"`
105+
Value *hexutil.Big `json:"value"`
106+
GasLimit hexutil.Uint64 `json:"gas_limit"`
107+
GasPrice *hexutil.Big `json:"gas_price"`
108+
GasFeeCap *hexutil.Big `json:"gas_fee_cap"`
109+
GasTipCap *hexutil.Big `json:"gas_tip_cap"`
110+
CallData hexutil.Bytes `json:"call_data"`
111+
AccessList types.AccessList `json:"access_list"`
112+
Type string `json:"tx_type"`
113+
V int64 `json:"v"`
114+
R *hexutil.Big `json:"r"`
115+
S *hexutil.Big `json:"s"`
117116
}
118117

119118
type TraceConfig struct {

mock/src/transaction.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ pub struct MockTransaction {
133133
pub s: Option<Word>,
134134
pub transaction_type: U64,
135135
pub access_list: AccessList,
136-
pub max_priority_fee_per_gas: Word,
137-
pub max_fee_per_gas: Word,
136+
pub max_priority_fee_per_gas: Option<Word>,
137+
pub max_fee_per_gas: Option<Word>,
138138
pub chain_id: Word,
139139
pub invalid: bool,
140140
}
@@ -158,8 +158,8 @@ impl Default for MockTransaction {
158158
s: None,
159159
transaction_type: U64::zero(),
160160
access_list: AccessList::default(),
161-
max_priority_fee_per_gas: Word::zero(),
162-
max_fee_per_gas: Word::zero(),
161+
max_priority_fee_per_gas: None,
162+
max_fee_per_gas: None,
163163
chain_id: *MOCK_CHAIN_ID,
164164
invalid: false,
165165
}
@@ -185,8 +185,8 @@ impl From<MockTransaction> for Transaction {
185185
s: mock.s.unwrap_or_default(),
186186
transaction_type: Some(mock.transaction_type),
187187
access_list: Some(mock.access_list),
188-
max_priority_fee_per_gas: Some(mock.max_priority_fee_per_gas),
189-
max_fee_per_gas: Some(mock.max_fee_per_gas),
188+
max_priority_fee_per_gas: mock.max_priority_fee_per_gas,
189+
max_fee_per_gas: mock.max_fee_per_gas,
190190
chain_id: Some(mock.chain_id),
191191
other: OtherFields::default(),
192192
}
@@ -289,13 +289,13 @@ impl MockTransaction {
289289

290290
/// Set max_priority_fee_per_gas field for the MockTransaction.
291291
pub fn max_priority_fee_per_gas(&mut self, max_priority_fee_per_gas: Word) -> &mut Self {
292-
self.max_priority_fee_per_gas = max_priority_fee_per_gas;
292+
self.max_priority_fee_per_gas = Some(max_priority_fee_per_gas);
293293
self
294294
}
295295

296296
/// Set max_fee_per_gas field for the MockTransaction.
297297
pub fn max_fee_per_gas(&mut self, max_fee_per_gas: Word) -> &mut Self {
298-
self.max_fee_per_gas = max_fee_per_gas;
298+
self.max_fee_per_gas = Some(max_fee_per_gas);
299299
self
300300
}
301301

0 commit comments

Comments
 (0)