fix(rpc): remove unused rpc transaction fields (#1228)

This commit is contained in:
Matthias Seitz
2023-02-08 17:06:20 +01:00
committed by GitHub
parent cf8c7b5c43
commit 4cbd199016
2 changed files with 34 additions and 22 deletions

View File

@@ -1,17 +1,19 @@
mod receipt;
mod request;
mod signature;
mod typed;
pub use receipt::TransactionReceipt;
pub use request::TransactionRequest;
pub use signature::Signature;
pub use typed::*;
use reth_primitives::{
rpc::transaction::eip2930::AccessListItem, Address, Bytes, H256, H512, U128, U256, U64,
rpc::transaction::eip2930::AccessListItem, Address, Bytes, H256, U128, U256, U64,
};
use serde::{Deserialize, Serialize};
/// Transaction object
/// Transaction object used in RPC
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Transaction {
@@ -34,36 +36,32 @@ pub struct Transaction {
/// Gas Price
#[serde(skip_serializing_if = "Option::is_none")]
pub gas_price: Option<U128>,
/// Gas amount
pub gas: U256,
/// Max BaseFeePerGas the user is willing to pay.
#[serde(skip_serializing_if = "Option::is_none")]
pub max_fee_per_gas: Option<U128>,
/// The miner's tip.
#[serde(skip_serializing_if = "Option::is_none")]
pub max_priority_fee_per_gas: Option<U128>,
/// Gas
pub gas: U256,
/// Data
pub input: Bytes,
/// Creates contract
pub creates: Option<Address>,
/// Raw transaction data
pub raw: Bytes,
/// Public key of the signer.
pub public_key: Option<H512>,
/// The network id of the transaction, if any.
/// All _flattened_ fields of the transaction signature.
///
/// Note: this is an option so special transaction types without a signature (e.g. <https://github.com/ethereum-optimism/optimism/blob/0bf643c4147b43cd6f25a759d331ef3a2a61a2a3/specs/deposits.md#the-deposited-transaction-type>) can be supported.
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub signature: Option<Signature>,
/// The chain id of the transaction, if any.
pub chain_id: Option<U64>,
/// The standardised V field of the signature (0 or 1).
pub standard_v: U256,
/// The standardised V field of the signature.
pub v: U256,
/// The R field of the signature.
pub r: U256,
/// The S field of the signature.
pub s: U256,
/// EIP2930
///
/// Pre-pay to warm storage access.
#[cfg_attr(feature = "std", serde(skip_serializing_if = "Option::is_none"))]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_list: Option<Vec<AccessListItem>>,
/// EIP-2718 type
/// EIP2718
///
/// Transaction type, Some(2) for EIP-1559 transaction,
/// Some(1) for AccessList transaction, None for Legacy
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub transaction_type: Option<U256>,
pub transaction_type: Option<U64>,
}

View File

@@ -0,0 +1,14 @@
//! Signature related RPC values
use reth_primitives::U256;
use serde::{Deserialize, Serialize};
/// Container type for all signature fields in RPC
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub struct Signature {
/// The R field of the signature; the point on the curve.
pub r: U256,
/// The S field of the signature; the point on the curve.
pub s: U256,
/// The standardised V field of the signature (0 or 1).
pub v: U256,
}