Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix GasFeeCap/GasTipCap for legacyTx
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Apr 1, 2024
1 parent 349bcc2 commit cb4841f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
29 changes: 14 additions & 15 deletions geth-utils/gethutil/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,20 @@ type Account struct {
}

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

type TraceConfig struct {
Expand Down
16 changes: 8 additions & 8 deletions mock/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ pub struct MockTransaction {
pub s: Option<Word>,
pub transaction_type: U64,
pub access_list: AccessList,
pub max_priority_fee_per_gas: Word,
pub max_fee_per_gas: Word,
pub max_priority_fee_per_gas: Option<Word>,
pub max_fee_per_gas: Option<Word>,
pub chain_id: Word,
pub invalid: bool,
}
Expand All @@ -158,8 +158,8 @@ impl Default for MockTransaction {
s: None,
transaction_type: U64::zero(),
access_list: AccessList::default(),
max_priority_fee_per_gas: Word::zero(),
max_fee_per_gas: Word::zero(),
max_priority_fee_per_gas: None,
max_fee_per_gas: None,
chain_id: *MOCK_CHAIN_ID,
invalid: false,
}
Expand All @@ -185,8 +185,8 @@ impl From<MockTransaction> for Transaction {
s: mock.s.unwrap_or_default(),
transaction_type: Some(mock.transaction_type),
access_list: Some(mock.access_list),
max_priority_fee_per_gas: Some(mock.max_priority_fee_per_gas),
max_fee_per_gas: Some(mock.max_fee_per_gas),
max_priority_fee_per_gas: mock.max_priority_fee_per_gas,
max_fee_per_gas: mock.max_fee_per_gas,
chain_id: Some(mock.chain_id),
other: OtherFields::default(),
}
Expand Down Expand Up @@ -289,13 +289,13 @@ impl MockTransaction {

/// Set max_priority_fee_per_gas field for the MockTransaction.
pub fn max_priority_fee_per_gas(&mut self, max_priority_fee_per_gas: Word) -> &mut Self {
self.max_priority_fee_per_gas = max_priority_fee_per_gas;
self.max_priority_fee_per_gas = Some(max_priority_fee_per_gas);
self
}

/// Set max_fee_per_gas field for the MockTransaction.
pub fn max_fee_per_gas(&mut self, max_fee_per_gas: Word) -> &mut Self {
self.max_fee_per_gas = max_fee_per_gas;
self.max_fee_per_gas = Some(max_fee_per_gas);
self
}

Expand Down

0 comments on commit cb4841f

Please sign in to comment.