chore: use alloy nodeinfo (#7512)

This commit is contained in:
Matthias Seitz
2024-04-10 16:19:09 +02:00
committed by GitHub
parent 2e3a827b09
commit e50f942d47
14 changed files with 110 additions and 71 deletions

36
Cargo.lock generated
View File

@ -146,7 +146,7 @@ dependencies = [
[[package]]
name = "alloy-consensus"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-eips",
"alloy-primitives",
@ -178,7 +178,7 @@ dependencies = [
[[package]]
name = "alloy-eips"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-primitives",
"alloy-rlp",
@ -196,7 +196,7 @@ dependencies = [
[[package]]
name = "alloy-genesis"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-primitives",
"alloy-serde",
@ -218,7 +218,7 @@ dependencies = [
[[package]]
name = "alloy-json-rpc"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-primitives",
"serde",
@ -229,7 +229,7 @@ dependencies = [
[[package]]
name = "alloy-network"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -245,7 +245,7 @@ dependencies = [
[[package]]
name = "alloy-node-bindings"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-genesis",
"alloy-primitives",
@ -287,8 +287,9 @@ dependencies = [
[[package]]
name = "alloy-provider"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-eips",
"alloy-json-rpc",
"alloy-network",
"alloy-primitives",
@ -302,6 +303,7 @@ dependencies = [
"auto_impl",
"dashmap",
"futures",
"futures-utils-wasm",
"lru",
"reqwest 0.12.3",
"serde_json",
@ -335,7 +337,7 @@ dependencies = [
[[package]]
name = "alloy-rpc-client"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-json-rpc",
"alloy-transport",
@ -355,7 +357,7 @@ dependencies = [
[[package]]
name = "alloy-rpc-types"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -377,7 +379,7 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-engine"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -395,7 +397,7 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-trace"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-primitives",
"alloy-rpc-types",
@ -407,7 +409,7 @@ dependencies = [
[[package]]
name = "alloy-serde"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-primitives",
"serde",
@ -417,7 +419,7 @@ dependencies = [
[[package]]
name = "alloy-signer"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-primitives",
"async-trait",
@ -430,7 +432,7 @@ dependencies = [
[[package]]
name = "alloy-signer-wallet"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-consensus",
"alloy-network",
@ -501,7 +503,7 @@ dependencies = [
[[package]]
name = "alloy-transport"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-json-rpc",
"base64 0.22.0",
@ -519,7 +521,7 @@ dependencies = [
[[package]]
name = "alloy-transport-http"
version = "0.1.0"
source = "git+https://github.com/alloy-rs/alloy?rev=6aab216#6aab2164b92c3174cdd81fcb403177361338e594"
source = "git+https://github.com/alloy-rs/alloy?rev=987b393#987b3936f78c067baedcf811620975d3a4a26443"
dependencies = [
"alloy-json-rpc",
"alloy-transport",
@ -7392,7 +7394,7 @@ dependencies = [
[[package]]
name = "revm-inspectors"
version = "0.1.0"
source = "git+https://github.com/paradigmxyz/evm-inspectors?rev=5baa6b3#5baa6b32979e3dc5905528ccd4fe6adaa436925b"
source = "git+https://github.com/paradigmxyz/evm-inspectors?rev=21f8f3d#21f8f3d266b05d1084e06f0c5331f2f1f4ed0905"
dependencies = [
"alloy-primitives",
"alloy-rpc-types",

View File

@ -256,7 +256,7 @@ reth-trie-parallel = { path = "crates/trie-parallel" }
# revm
revm = { version = "8.0.0", features = ["std", "secp256k1"], default-features = false }
revm-primitives = { version = "3.1.0", features = ["std"], default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "5baa6b3" }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "21f8f3d" }
# eth
alloy-chains = "0.1.15"
@ -265,17 +265,17 @@ alloy-dyn-abi = "0.7.0"
alloy-sol-types = "0.7.0"
alloy-rlp = "0.3.4"
alloy-trie = "0.3.1"
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "6aab216" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "987b393", default-features = false, features = ["reqwest"] }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "987b393" }
# misc
aquamarine = "0.5"

View File

@ -15,12 +15,12 @@
use reth_eth_wire::{DisconnectReason, EthVersion, Status};
use reth_primitives::{NodeRecord, PeerId};
use reth_rpc_types::NetworkStatus;
use std::{future::Future, net::SocketAddr, sync::Arc, time::Instant};
pub use error::NetworkError;
pub use reputation::{Reputation, ReputationChangeKind};
use reth_eth_wire::capability::Capabilities;
use reth_rpc_types::NetworkStatus;
/// Network Error
pub mod error;

View File

@ -10,7 +10,7 @@ use crate::{
use reth_discv4::DEFAULT_DISCOVERY_PORT;
use reth_eth_wire::{DisconnectReason, ProtocolVersion};
use reth_primitives::{Chain, NodeRecord, PeerId};
use reth_rpc_types::{EthProtocolInfo, NetworkStatus};
use reth_rpc_types::{admin::EthProtocolInfo, NetworkStatus};
use std::net::{IpAddr, SocketAddr};
/// A type that implements all network trait that does nothing.

View File

@ -46,7 +46,7 @@ use reth_net_common::bandwidth_meter::BandwidthMeter;
use reth_network_api::ReputationChangeKind;
use reth_primitives::{ForkId, NodeRecord, PeerId};
use reth_provider::{BlockNumReader, BlockReader};
use reth_rpc_types::{EthProtocolInfo, NetworkStatus};
use reth_rpc_types::{admin::EthProtocolInfo, NetworkStatus};
use reth_tasks::shutdown::GracefulShutdown;
use reth_tokio_util::EventListeners;
use secp256k1::SecretKey;

View File

@ -607,7 +607,7 @@ impl ChainSpec {
if self.is_cancun_active_at_timestamp(self.genesis.timestamp) {
let blob_gas_used = self.genesis.blob_gas_used.unwrap_or(0);
let excess_blob_gas = self.genesis.excess_blob_gas.unwrap_or(0);
(Some(B256::ZERO), Some(blob_gas_used), Some(excess_blob_gas))
(Some(B256::ZERO), Some(blob_gas_used as u64), Some(excess_blob_gas as u64))
} else {
(None, None, None)
};
@ -619,7 +619,7 @@ impl ChainSpec {
ommers_hash: EMPTY_OMMER_ROOT_HASH,
receipts_root: EMPTY_RECEIPTS,
logs_bloom: Default::default(),
gas_limit: self.genesis.gas_limit,
gas_limit: self.genesis.gas_limit as u64,
difficulty: self.genesis.difficulty,
nonce: self.genesis.nonce,
extra_data: self.genesis.extra_data.clone(),
@ -644,7 +644,8 @@ impl ChainSpec {
/// Get the initial base fee of the genesis block.
pub fn initial_base_fee(&self) -> Option<u64> {
// If the base fee is set in the genesis block, we use that instead of the default.
let genesis_base_fee = self.genesis.base_fee_per_gas.unwrap_or(EIP1559_INITIAL_BASE_FEE);
let genesis_base_fee =
self.genesis.base_fee_per_gas.map(|fee| fee as u64).unwrap_or(EIP1559_INITIAL_BASE_FEE);
// If London is activated at genesis, we set the initial base fee as per EIP-1559.
self.fork(Hardfork::London).active_at_block(0).then_some(genesis_base_fee)
@ -2984,7 +2985,7 @@ Post-merge hard forks (timestamp based):
#[test]
fn test_paris_block_and_total_difficulty() {
let genesis = Genesis { gas_limit: 0x2fefd8u64, ..Default::default() };
let genesis = Genesis { gas_limit: 0x2fefd8u128, ..Default::default() };
let paris_chainspec = ChainSpecBuilder::default()
.chain(Chain::from_id(1337))
.genesis(genesis)
@ -2996,7 +2997,7 @@ Post-merge hard forks (timestamp based):
#[test]
fn test_default_cancun_header_forkhash() {
// set the gas limit from the hive test genesis according to the hash
let genesis = Genesis { gas_limit: 0x2fefd8u64, ..Default::default() };
let genesis = Genesis { gas_limit: 0x2fefd8u128, ..Default::default() };
let default_chainspec = ChainSpecBuilder::default()
.chain(Chain::from_id(1337))
.genesis(genesis)

View File

@ -1,6 +1,6 @@
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{AnyNode, NodeRecord};
use reth_rpc_types::{NodeInfo, PeerInfo};
use reth_rpc_types::{admin::NodeInfo, PeerInfo};
/// Admin namespace rpc interface that gives access to several non-standard RPC methods.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "admin"))]

View File

@ -3,7 +3,7 @@
use crate::transaction::from_recovered_with_block_context;
use alloy_rlp::Encodable;
use reth_primitives::{
Block as PrimitiveBlock, BlockWithSenders, Header as PrimitiveHeader, B256, U256, U64,
Block as PrimitiveBlock, BlockWithSenders, Header as PrimitiveHeader, B256, U256,
};
use reth_rpc_types::{Block, BlockError, BlockTransactions, BlockTransactionsKind, Header};
@ -127,18 +127,18 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader)
transactions_root,
receipts_root,
withdrawals_root,
number: Some(U256::from(number)),
gas_used: U256::from(gas_used),
gas_limit: U256::from(gas_limit),
number: Some(number),
gas_used: gas_used as u128,
gas_limit: gas_limit as u128,
extra_data,
logs_bloom,
timestamp: U256::from(timestamp),
timestamp,
difficulty,
mix_hash: Some(mix_hash),
nonce: Some(nonce.to_be_bytes().into()),
base_fee_per_gas: base_fee_per_gas.map(U256::from),
blob_gas_used: blob_gas_used.map(U64::from),
excess_blob_gas: excess_blob_gas.map(U64::from),
base_fee_per_gas: base_fee_per_gas.map(u128::from),
blob_gas_used: blob_gas_used.map(u128::from),
excess_blob_gas: excess_blob_gas.map(u128::from),
parent_beacon_block_root,
total_difficulty: None,
}

View File

@ -8,9 +8,7 @@
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![allow(hidden_glob_reexports)] // TODO rm in followup PR
mod admin;
pub mod beacon;
mod eth;
mod mev;
@ -38,7 +36,6 @@ pub use eth::{
transaction::{self, TransactionKind, TransactionRequest, TypedTransactionRequest},
};
pub use admin::*;
pub use mev::*;
pub use net::*;
pub use peer::*;

View File

@ -1,7 +1,9 @@
use crate::{pk_to_id, PeerId};
use alloy_rlp::{RlpDecodable, RlpEncodable};
use alloy_rpc_types::admin::EthProtocolInfo;
use enr::Enr;
use secp256k1::{SecretKey, SECP256K1};
use serde::{Deserialize, Serialize};
use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::{
fmt,
@ -13,6 +15,17 @@ use std::{
use thiserror::Error;
use url::{Host, Url};
/// The status of the network being ran by the local node.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NetworkStatus {
/// The local node client version.
pub client_version: String,
/// The current ethereum protocol version
pub protocol_version: u64,
/// Information about the Ethereum Wire Protocol.
pub eth_protocol_info: EthProtocolInfo,
}
/// Represents a ENR in discovery.
///
/// Note: this is only an excerpt of the [`NodeRecord`] data structure.

View File

@ -1,10 +1,14 @@
use crate::result::ToRpcResult;
use alloy_primitives::B256;
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_network_api::{NetworkInfo, PeerKind, Peers};
use reth_primitives::{AnyNode, ChainSpec, NodeRecord};
use reth_rpc_api::AdminApiServer;
use reth_rpc_types::{NodeInfo, PeerEthProtocolInfo, PeerInfo, PeerNetworkInfo, PeerProtocolsInfo};
use reth_rpc_types::{
admin::{EthProtocolInfo, NodeInfo, Ports, ProtocolInfo},
PeerEthProtocolInfo, PeerInfo, PeerNetworkInfo, PeerProtocolsInfo,
};
use std::sync::Arc;
/// `admin` API implementation.
@ -87,11 +91,31 @@ where
/// Handler for `admin_nodeInfo`
async fn node_info(&self) -> RpcResult<NodeInfo> {
let enr = self.network.local_node_record();
let enode = self.network.local_node_record();
let status = self.network.network_status().await.to_rpc_result()?;
let config = self.chain_spec.genesis().config.clone();
Ok(NodeInfo::new(enr, status, config))
let node_info = NodeInfo {
id: B256::from_slice(&enode.id.as_slice()[..32]),
name: status.client_version,
enode: enode.to_string(),
enr: "".to_string(),
ip: enode.address,
ports: Ports { discovery: enode.udp_port, listener: enode.tcp_port },
listen_addr: enode.tcp_addr(),
protocols: ProtocolInfo {
eth: Some(EthProtocolInfo {
network: status.eth_protocol_info.network,
difficulty: status.eth_protocol_info.difficulty,
genesis: status.eth_protocol_info.genesis,
config,
head: status.eth_protocol_info.head,
}),
snap: None,
},
};
Ok(node_info)
}
/// Handler for `admin_peerEvents`

View File

@ -1,6 +1,5 @@
//! Optimism helpers.
use reth_primitives::U256;
use revm::L1BlockInfo;
/// Optimism Transaction Metadata
@ -15,17 +14,17 @@ pub(crate) struct OptimismTxMeta {
/// The L1 block info.
pub(crate) l1_block_info: Option<L1BlockInfo>,
/// The L1 fee for the block.
pub(crate) l1_fee: Option<U256>,
pub(crate) l1_fee: Option<u128>,
/// The L1 data gas for the block.
pub(crate) l1_data_gas: Option<U256>,
pub(crate) l1_data_gas: Option<u128>,
}
impl OptimismTxMeta {
/// Creates a new [OptimismTxMeta].
pub(crate) fn new(
l1_block_info: Option<L1BlockInfo>,
l1_fee: Option<U256>,
l1_data_gas: Option<U256>,
l1_fee: Option<u128>,
l1_data_gas: Option<u128>,
) -> Self {
Self { l1_block_info, l1_fee, l1_data_gas }
}

View File

@ -1280,7 +1280,7 @@ where
let block_hash = block.hash();
let block_number = block_env.number.saturating_to::<u64>();
let base_fee = block_env.basefee.saturating_to::<u64>();
let base_fee = block_env.basefee.saturating_to::<u128>();
// prepare transactions, we do everything upfront to reduce time spent with open state
let max_transactions = highest_index.map_or(block.body.len(), |highest| {
@ -1501,7 +1501,10 @@ where
let inner_l1_data_gas = l1_block_info
.l1_data_gas(&self.inner.provider.chain_spec(), block_timestamp, &envelope_buf)
.map_err(|_| OptimismEthApiError::L1BlockGasError)?;
(Some(inner_l1_fee), Some(inner_l1_data_gas))
(
Some(inner_l1_fee.saturating_to::<u128>()),
Some(inner_l1_data_gas.saturating_to::<u128>()),
)
} else {
(None, None)
};
@ -1629,7 +1632,7 @@ impl TransactionSource {
index: Some(index),
block_hash: Some(block_hash),
block_number: Some(block_number),
base_fee,
base_fee: base_fee.map(u128::from),
},
)
}
@ -1718,7 +1721,7 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
let rpc_receipt = reth_rpc_types::Receipt {
status: receipt.success,
cumulative_gas_used: receipt.cumulative_gas_used,
cumulative_gas_used: receipt.cumulative_gas_used as u128,
logs,
};
@ -1734,14 +1737,14 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
block_number: Some(meta.block_number),
from,
to: None,
gas_used: Some(gas_used),
gas_used: gas_used as u128,
contract_address: None,
effective_gas_price: transaction.effective_gas_price(meta.base_fee) as u64,
effective_gas_price: transaction.effective_gas_price(meta.base_fee),
// TODO pre-byzantium receipts have a post-transaction state root
state_root: None,
// EIP-4844 fields
blob_gas_price: blob_gas_price.map(|gas| gas as u64),
blob_gas_used,
blob_gas_price,
blob_gas_used: blob_gas_used.map(u128::from),
};
let mut res_receipt = WithOtherFields::new(res_receipt);
@ -1755,12 +1758,12 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
receipt.deposit_receipt_version.map(reth_primitives::U64::from);
} else if let Some(l1_block_info) = optimism_tx_meta.l1_block_info {
op_fields.l1_fee = optimism_tx_meta.l1_fee;
op_fields.l1_gas_used = optimism_tx_meta
.l1_data_gas
.map(|dg| dg + l1_block_info.l1_fee_overhead.unwrap_or_default());
op_fields.l1_gas_used = optimism_tx_meta.l1_data_gas.map(|dg| {
dg + l1_block_info.l1_fee_overhead.unwrap_or_default().saturating_to::<u128>()
});
op_fields.l1_fee_scalar =
Some(f64::from(l1_block_info.l1_base_fee_scalar) / 1_000_000.0);
op_fields.l1_gas_price = Some(l1_block_info.l1_base_fee);
op_fields.l1_gas_price = Some(l1_block_info.l1_base_fee.saturating_to());
}
res_receipt.other = op_fields.into();

View File

@ -158,13 +158,13 @@ where
}
// Crop receipts and transform them into OtsTransactionReceipt
let timestamp = Some(u64::try_from(block.header.timestamp).unwrap_or(u64::MAX));
let timestamp = Some(block.header.timestamp);
let receipts = receipts
.drain(page_start..page_end)
.map(|receipt| {
let receipt = receipt.inner.map_inner(|receipt| OtsReceipt {
status: receipt.inner.receipt.status,
cumulative_gas_used: receipt.inner.receipt.cumulative_gas_used,
cumulative_gas_used: receipt.inner.receipt.cumulative_gas_used as u64,
logs: None,
logs_bloom: None,
r#type: receipt.r#type,