refactor(primitives): remove AccessListWithGasUsed in primitives (#5079)

This commit is contained in:
Thomas Coratger
2023-10-19 13:24:55 +02:00
committed by GitHub
parent 0aeb0b622a
commit 7796e57476
6 changed files with 15 additions and 24 deletions

View File

@ -86,7 +86,7 @@ pub use snapshot::SnapshotSegment;
pub use storage::StorageEntry;
pub use transaction::{
util::secp256k1::{public_key_to_address, recover_signer, sign_message},
AccessList, AccessListItem, AccessListWithGasUsed, BlobTransaction, BlobTransactionSidecar,
AccessList, AccessListItem, BlobTransaction, BlobTransactionSidecar,
BlobTransactionValidationError, FromRecoveredPooledTransaction, FromRecoveredTransaction,
IntoRecoveredTransaction, InvalidTransactionError, PooledTransactionsElement,
PooledTransactionsElementEcRecovered, Signature, Transaction, TransactionKind, TransactionMeta,

View File

@ -2,7 +2,6 @@ use crate::{Address, B256};
use alloy_primitives::U256;
use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
use reth_codecs::{main_codec, Compact};
use serde::{Deserialize, Serialize};
use std::mem;
/// A list of addresses and storage keys that the transaction plans to access.
@ -83,13 +82,3 @@ impl AccessList {
self.0.capacity() * mem::size_of::<AccessListItem>()
}
}
/// Access list with gas used appended.
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct AccessListWithGasUsed {
/// List with accounts accessed during transaction.
pub access_list: AccessList,
/// Estimated gas used with access list.
pub gas_used: U256,
}

View File

@ -13,7 +13,7 @@ use reth_codecs::{add_arbitrary_tests, derive_arbitrary, Compact};
use serde::{Deserialize, Serialize};
use std::mem;
pub use access_list::{AccessList, AccessListItem, AccessListWithGasUsed};
pub use access_list::{AccessList, AccessListItem};
pub use eip1559::TxEip1559;
pub use eip2930::TxEip2930;
pub use eip4844::{

View File

@ -1,12 +1,12 @@
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{
serde_helper::{num::U64HexOrNumber, JsonStorageKey},
AccessListWithGasUsed, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64,
Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64,
};
use reth_rpc_types::{
state::StateOverride, BlockOverrides, Bundle, CallRequest, EIP1186AccountProofResponse,
EthCallResponse, FeeHistory, Index, RichBlock, StateContext, SyncStatus, Transaction,
TransactionReceipt, TransactionRequest, Work,
state::StateOverride, AccessListWithGasUsed, BlockOverrides, Bundle, CallRequest,
EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Index, RichBlock, StateContext,
SyncStatus, Transaction, TransactionReceipt, TransactionRequest, Work,
};
/// Eth rpc interface: <https://ethereum.github.io/execution-apis/api-documentation/>

View File

@ -12,7 +12,7 @@ use crate::{
EthApi,
};
use reth_network_api::NetworkInfo;
use reth_primitives::{AccessListWithGasUsed, BlockId, BlockNumberOrTag, Bytes, U256};
use reth_primitives::{BlockId, BlockNumberOrTag, Bytes, U256};
use reth_provider::{
BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProvider, StateProviderFactory,
};
@ -20,8 +20,10 @@ use reth_revm::{
access_list::AccessListInspector, database::StateProviderDatabase, env::tx_env_with_recovered,
};
use reth_rpc_types::{
state::StateOverride, BlockError, Bundle, CallRequest, EthCallResponse, StateContext,
state::StateOverride, AccessListWithGasUsed, BlockError, Bundle, CallRequest, EthCallResponse,
StateContext,
};
use reth_rpc_types_compat::log::from_primitive_access_list;
use reth_transaction_pool::TransactionPool;
use revm::{
db::{CacheDB, DatabaseRef},
@ -406,7 +408,7 @@ where
request.access_list = Some(access_list.clone());
let gas_used = self.estimate_gas_with(env.cfg, env.block, request, db.db.state())?;
Ok(AccessListWithGasUsed { access_list, gas_used })
Ok(AccessListWithGasUsed { access_list: from_primitive_access_list(access_list), gas_used })
}
}

View File

@ -14,7 +14,7 @@ use jsonrpsee::core::RpcResult as Result;
use reth_network_api::NetworkInfo;
use reth_primitives::{
serde_helper::{num::U64HexOrNumber, JsonStorageKey},
AccessListWithGasUsed, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64,
Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64,
};
use reth_provider::{
BlockIdReader, BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider,
@ -22,9 +22,9 @@ use reth_provider::{
};
use reth_rpc_api::EthApiServer;
use reth_rpc_types::{
state::StateOverride, BlockOverrides, Bundle, CallRequest, EIP1186AccountProofResponse,
EthCallResponse, FeeHistory, Index, RichBlock, StateContext, SyncStatus, TransactionReceipt,
TransactionRequest, Work,
state::StateOverride, AccessListWithGasUsed, BlockOverrides, Bundle, CallRequest,
EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Index, RichBlock, StateContext,
SyncStatus, TransactionReceipt, TransactionRequest, Work,
};
use reth_transaction_pool::TransactionPool;
use serde_json::Value;