mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 02:49:55 +00:00
chore: Upgrade to reth v1.8.2
This commit is contained in:
653
Cargo.lock
generated
653
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
110
Cargo.toml
110
Cargo.toml
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reth_hl"
|
name = "reth_hl"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
@ -26,67 +26,67 @@ lto = "fat"
|
|||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
reth = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-cli = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-cli = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-cli-commands = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-cli-commands = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-basic-payload-builder = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-basic-payload-builder = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-db = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-db = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-db-api = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-db-api = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-chainspec = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-chainspec = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-cli-util = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-cli-util = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-discv4 = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-discv4 = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-engine-primitives = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-engine-primitives = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-ethereum-forks = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-ethereum-forks = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-ethereum-payload-builder = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-ethereum-payload-builder = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-ethereum-primitives = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-ethereum-primitives = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-eth-wire = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-eth-wire = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-eth-wire-types = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-eth-wire-types = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-evm = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-evm = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-evm-ethereum = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-evm-ethereum = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-node-core = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-node-core = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-revm = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-revm = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-network = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-network = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-network-p2p = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-network-p2p = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-network-api = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-network-api = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-node-ethereum = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-node-ethereum = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-network-peers = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-network-peers = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-payload-primitives = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-payload-primitives = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-primitives = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-primitives = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-primitives-traits = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-primitives-traits = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-provider = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34", features = ["test-utils"] }
|
reth-provider = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88", features = ["test-utils"] }
|
||||||
reth-rpc = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-rpc = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-rpc-eth-api = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-rpc-eth-api = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-rpc-engine-api = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-rpc-engine-api = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-tracing = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-tracing = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-trie-common = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-trie-common = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-trie-db = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-trie-db = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-codecs = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-codecs = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-transaction-pool = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-transaction-pool = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-stages-types = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-stages-types = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-storage-api = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-storage-api = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-errors = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-errors = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-rpc-convert = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-rpc-convert = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-rpc-eth-types = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-rpc-eth-types = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-rpc-server-types = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-rpc-server-types = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
reth-metrics = { git = "https://github.com/sprites0/reth", rev = "40dd1247a55fdceca05e38a1320c054010d5bb34" }
|
reth-metrics = { git = "https://github.com/sprites0/reth", rev = "83baf84bcb6d88081fc1b39f97733b8ec345cb88" }
|
||||||
revm = { version = "29.0.0", default-features = false }
|
revm = { version = "29.0.1", default-features = false }
|
||||||
|
|
||||||
# alloy dependencies
|
# alloy dependencies
|
||||||
alloy-genesis = { version = "1.0.30", default-features = false }
|
alloy-genesis = { version = "1.0.37", default-features = false }
|
||||||
alloy-consensus = { version = "1.0.30", default-features = false }
|
alloy-consensus = { version = "1.0.37", default-features = false }
|
||||||
alloy-chains = { version = "0.2.5", default-features = false }
|
alloy-chains = { version = "0.2.5", default-features = false }
|
||||||
alloy-eips = { version = "1.0.30", default-features = false }
|
alloy-eips = { version = "1.0.37", default-features = false }
|
||||||
alloy-evm = { version = "0.20.1", default-features = false }
|
alloy-evm = { version = "0.21.0", default-features = false }
|
||||||
alloy-json-abi = { version = "1.3.1", default-features = false }
|
alloy-json-abi = { version = "1.3.1", default-features = false }
|
||||||
alloy-json-rpc = { version = "1.0.30", default-features = false }
|
alloy-json-rpc = { version = "1.0.37", default-features = false }
|
||||||
alloy-dyn-abi = "1.3.1"
|
alloy-dyn-abi = "1.3.1"
|
||||||
alloy-network = { version = "1.0.30", default-features = false }
|
alloy-network = { version = "1.0.37", default-features = false }
|
||||||
alloy-primitives = { version = "1.3.1", default-features = false, features = ["map-foldhash"] }
|
alloy-primitives = { version = "1.3.1", default-features = false, features = ["map-foldhash"] }
|
||||||
alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] }
|
alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] }
|
||||||
alloy-rpc-types = { version = "1.0.30", features = ["eth"], default-features = false }
|
alloy-rpc-types = { version = "1.0.37", features = ["eth"], default-features = false }
|
||||||
alloy-rpc-types-eth = { version = "1.0.30", default-features = false }
|
alloy-rpc-types-eth = { version = "1.0.37", default-features = false }
|
||||||
alloy-rpc-types-engine = { version = "1.0.30", default-features = false }
|
alloy-rpc-types-engine = { version = "1.0.37", default-features = false }
|
||||||
alloy-signer = { version = "1.0.30", default-features = false }
|
alloy-signer = { version = "1.0.37", default-features = false }
|
||||||
alloy-sol-macro = "1.3.1"
|
alloy-sol-macro = "1.3.1"
|
||||||
alloy-sol-types = { version = "1.3.1", default-features = false }
|
alloy-sol-types = { version = "1.3.1", default-features = false }
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,10 @@
|
|||||||
//! For non-system transactions, we can just return the log as is, and the client will
|
//! For non-system transactions, we can just return the log as is, and the client will
|
||||||
//! adjust the transaction index accordingly.
|
//! adjust the transaction index accordingly.
|
||||||
|
|
||||||
use alloy_consensus::{transaction::TransactionMeta, BlockHeader, TxReceipt};
|
use alloy_consensus::{
|
||||||
|
BlockHeader, TxReceipt,
|
||||||
|
transaction::{TransactionMeta, TxHashRef},
|
||||||
|
};
|
||||||
use alloy_eips::{BlockId, BlockNumberOrTag};
|
use alloy_eips::{BlockId, BlockNumberOrTag};
|
||||||
use alloy_json_rpc::RpcObject;
|
use alloy_json_rpc::RpcObject;
|
||||||
use alloy_primitives::{B256, U256};
|
use alloy_primitives::{B256, U256};
|
||||||
@ -30,7 +33,7 @@ use reth_rpc_eth_api::{
|
|||||||
RpcConvert, RpcHeader, RpcNodeCoreExt, RpcReceipt, RpcTransaction, RpcTxReq,
|
RpcConvert, RpcHeader, RpcNodeCoreExt, RpcReceipt, RpcTransaction, RpcTxReq,
|
||||||
};
|
};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::{borrow::Cow, marker::PhantomData, sync::Arc};
|
use std::{marker::PhantomData, sync::Arc};
|
||||||
use tokio_stream::{Stream, StreamExt};
|
use tokio_stream::{Stream, StreamExt};
|
||||||
use tracing::{trace, Instrument};
|
use tracing::{trace, Instrument};
|
||||||
|
|
||||||
@ -182,7 +185,7 @@ impl<Eth: EthWrapper> HlSystemTransactionExt<Eth> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let input = ConvertReceiptInput {
|
let input = ConvertReceiptInput {
|
||||||
receipt: Cow::Borrowed(receipt),
|
receipt: receipt.clone(),
|
||||||
tx,
|
tx,
|
||||||
gas_used: receipt.cumulative_gas_used() - gas_used,
|
gas_used: receipt.cumulative_gas_used() - gas_used,
|
||||||
next_log_index,
|
next_log_index,
|
||||||
@ -530,7 +533,7 @@ async fn adjust_block_receipts<Eth: EthWrapper>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let input = ConvertReceiptInput {
|
let input = ConvertReceiptInput {
|
||||||
receipt: Cow::Borrowed(receipt),
|
receipt: receipt.clone(),
|
||||||
tx,
|
tx,
|
||||||
gas_used: receipt.cumulative_gas_used() - gas_used,
|
gas_used: receipt.cumulative_gas_used() - gas_used,
|
||||||
next_log_index,
|
next_log_index,
|
||||||
|
|||||||
@ -27,11 +27,6 @@ static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
|||||||
fn main() -> eyre::Result<()> {
|
fn main() -> eyre::Result<()> {
|
||||||
reth_cli_util::sigsegv_handler::install();
|
reth_cli_util::sigsegv_handler::install();
|
||||||
|
|
||||||
// Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
|
|
||||||
if std::env::var_os("RUST_BACKTRACE").is_none() {
|
|
||||||
std::env::set_var("RUST_BACKTRACE", "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize custom version metadata before parsing CLI so --version uses reth-hl values
|
// Initialize custom version metadata before parsing CLI so --version uses reth-hl values
|
||||||
reth_hl::version::init_reth_hl_version();
|
reth_hl::version::init_reth_hl_version();
|
||||||
|
|
||||||
@ -80,8 +75,8 @@ fn main() -> eyre::Result<()> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.apply(|builder| {
|
.apply(|mut builder| {
|
||||||
builder.db().create_tables_for::<Tables>().expect("create tables");
|
builder.db_mut().create_tables_for::<Tables>().expect("create tables");
|
||||||
builder
|
builder
|
||||||
})
|
})
|
||||||
.launch()
|
.launch()
|
||||||
|
|||||||
@ -136,8 +136,9 @@ where
|
|||||||
// Install the prometheus recorder to be sure to record all metrics
|
// Install the prometheus recorder to be sure to record all metrics
|
||||||
let _ = install_prometheus_recorder();
|
let _ = install_prometheus_recorder();
|
||||||
|
|
||||||
let components =
|
let components = |spec: Arc<C::ChainSpec>| {
|
||||||
|spec: Arc<C::ChainSpec>| (HlEvmConfig::new(spec.clone()), HlConsensus::new(spec));
|
(HlEvmConfig::new(spec.clone()), Arc::new(HlConsensus::new(spec)))
|
||||||
|
};
|
||||||
|
|
||||||
match self.command {
|
match self.command {
|
||||||
Commands::Node(command) => runner.run_command_until_exit(|ctx| {
|
Commands::Node(command) => runner.run_command_until_exit(|ctx| {
|
||||||
@ -157,9 +158,6 @@ where
|
|||||||
runner.run_command_until_exit(|ctx| command.execute::<HlNode, _>(ctx, components))
|
runner.run_command_until_exit(|ctx| command.execute::<HlNode, _>(ctx, components))
|
||||||
}
|
}
|
||||||
Commands::Config(command) => runner.run_until_ctrl_c(command.execute()),
|
Commands::Config(command) => runner.run_until_ctrl_c(command.execute()),
|
||||||
Commands::Recover(command) => {
|
|
||||||
runner.run_command_until_exit(|ctx| command.execute::<HlNode>(ctx))
|
|
||||||
}
|
|
||||||
Commands::Prune(command) => runner.run_until_ctrl_c(command.execute::<HlNode>()),
|
Commands::Prune(command) => runner.run_until_ctrl_c(command.execute::<HlNode>()),
|
||||||
Commands::Import(command) => {
|
Commands::Import(command) => {
|
||||||
runner.run_blocking_until_ctrl_c(command.execute::<HlNode, _>(components))
|
runner.run_blocking_until_ctrl_c(command.execute::<HlNode, _>(components))
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::{hardforks::HlHardforks, node::HlNode, HlBlock, HlBlockBody, HlPrimitives};
|
use crate::{hardforks::HlHardforks, node::HlNode, HlBlock, HlBlockBody, HlPrimitives};
|
||||||
use alloy_consensus::Header;
|
use alloy_consensus::Header;
|
||||||
use reth::{
|
use reth::{
|
||||||
api::FullNodeTypes,
|
api::{FullNodeTypes, NodeTypes},
|
||||||
beacon_consensus::EthBeaconConsensus,
|
beacon_consensus::EthBeaconConsensus,
|
||||||
builder::{components::ConsensusBuilder, BuilderContext},
|
builder::{components::ConsensusBuilder, BuilderContext},
|
||||||
consensus::{Consensus, ConsensusError, FullConsensus, HeaderValidator},
|
consensus::{Consensus, ConsensusError, FullConsensus, HeaderValidator},
|
||||||
@ -24,7 +24,7 @@ impl<Node> ConsensusBuilder<Node> for HlConsensusBuilder
|
|||||||
where
|
where
|
||||||
Node: FullNodeTypes<Types = HlNode>,
|
Node: FullNodeTypes<Types = HlNode>,
|
||||||
{
|
{
|
||||||
type Consensus = Arc<dyn FullConsensus<HlPrimitives, Error = ConsensusError>>;
|
type Consensus = Arc<HlConsensus<<Node::Types as NodeTypes>::ChainSpec>>;
|
||||||
|
|
||||||
async fn build_consensus(self, ctx: &BuilderContext<Node>) -> eyre::Result<Self::Consensus> {
|
async fn build_consensus(self, ctx: &BuilderContext<Node>) -> eyre::Result<Self::Consensus> {
|
||||||
Ok(Arc::new(HlConsensus::new(ctx.chain_spec())))
|
Ok(Arc::new(HlConsensus::new(ctx.chain_spec())))
|
||||||
|
|||||||
@ -106,7 +106,10 @@ where
|
|||||||
} else {
|
} else {
|
||||||
// for the first post-fork block, both parent.blob_gas_used and
|
// for the first post-fork block, both parent.blob_gas_used and
|
||||||
// parent.excess_blob_gas are evaluated as 0
|
// parent.excess_blob_gas are evaluated as 0
|
||||||
Some(alloy_eips::eip7840::BlobParams::cancun().next_block_excess_blob_gas(0, 0))
|
Some(
|
||||||
|
alloy_eips::eip7840::BlobParams::cancun()
|
||||||
|
.next_block_excess_blob_gas_osaka(0, 0, 0),
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +287,7 @@ where
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn evm_env(&self, header: &Header) -> EvmEnv<HlSpecId> {
|
fn evm_env(&self, header: &Header) -> Result<EvmEnv<HlSpecId>, Self::Error> {
|
||||||
let blob_params = self.chain_spec().blob_params_at_timestamp(header.timestamp);
|
let blob_params = self.chain_spec().blob_params_at_timestamp(header.timestamp);
|
||||||
let spec = revm_spec_by_timestamp_and_block_number(
|
let spec = revm_spec_by_timestamp_and_block_number(
|
||||||
self.chain_spec().clone(),
|
self.chain_spec().clone(),
|
||||||
@ -324,7 +327,7 @@ where
|
|||||||
blob_excess_gas_and_price,
|
blob_excess_gas_and_price,
|
||||||
};
|
};
|
||||||
|
|
||||||
EvmEnv { cfg_env, block_env }
|
Ok(EvmEnv { cfg_env, block_env })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_evm_env(
|
fn next_evm_env(
|
||||||
@ -373,9 +376,9 @@ where
|
|||||||
fn context_for_block<'a>(
|
fn context_for_block<'a>(
|
||||||
&self,
|
&self,
|
||||||
block: &'a SealedBlock<BlockTy<Self::Primitives>>,
|
block: &'a SealedBlock<BlockTy<Self::Primitives>>,
|
||||||
) -> ExecutionCtxFor<'a, Self> {
|
) -> Result<ExecutionCtxFor<'a, Self>, Self::Error> {
|
||||||
let block_body = block.body();
|
let block_body = block.body();
|
||||||
HlBlockExecutionCtx {
|
Ok(HlBlockExecutionCtx {
|
||||||
ctx: EthBlockExecutionCtx {
|
ctx: EthBlockExecutionCtx {
|
||||||
parent_hash: block.header().parent_hash,
|
parent_hash: block.header().parent_hash,
|
||||||
parent_beacon_block_root: block.header().parent_beacon_block_root,
|
parent_beacon_block_root: block.header().parent_beacon_block_root,
|
||||||
@ -386,15 +389,15 @@ where
|
|||||||
read_precompile_calls: block_body.read_precompile_calls.clone(),
|
read_precompile_calls: block_body.read_precompile_calls.clone(),
|
||||||
highest_precompile_address: block_body.highest_precompile_address,
|
highest_precompile_address: block_body.highest_precompile_address,
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn context_for_next_block(
|
fn context_for_next_block(
|
||||||
&self,
|
&self,
|
||||||
parent: &SealedHeader<HeaderTy<Self::Primitives>>,
|
parent: &SealedHeader<HeaderTy<Self::Primitives>>,
|
||||||
attributes: Self::NextBlockEnvCtx,
|
attributes: Self::NextBlockEnvCtx,
|
||||||
) -> ExecutionCtxFor<'_, Self> {
|
) -> Result<ExecutionCtxFor<'_, Self>, Self::Error> {
|
||||||
HlBlockExecutionCtx {
|
Ok(HlBlockExecutionCtx {
|
||||||
ctx: EthBlockExecutionCtx {
|
ctx: EthBlockExecutionCtx {
|
||||||
parent_hash: parent.hash(),
|
parent_hash: parent.hash(),
|
||||||
parent_beacon_block_root: attributes.parent_beacon_block_root,
|
parent_beacon_block_root: attributes.parent_beacon_block_root,
|
||||||
@ -402,13 +405,13 @@ where
|
|||||||
withdrawals: attributes.withdrawals.map(Cow::Owned),
|
withdrawals: attributes.withdrawals.map(Cow::Owned),
|
||||||
},
|
},
|
||||||
extras: HlExtras::default(), // TODO: hacky, double check if this is correct
|
extras: HlExtras::default(), // TODO: hacky, double check if this is correct
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfigureEngineEvm<HlExecutionData> for HlEvmConfig {
|
impl ConfigureEngineEvm<HlExecutionData> for HlEvmConfig {
|
||||||
fn evm_env_for_payload(&self, payload: &HlExecutionData) -> EvmEnvFor<Self> {
|
fn evm_env_for_payload(&self, payload: &HlExecutionData) -> EvmEnvFor<Self> {
|
||||||
self.evm_env(&payload.0.header)
|
self.evm_env(&payload.0.header).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn context_for_payload<'a>(&self, payload: &'a HlExecutionData) -> ExecutionCtxFor<'a, Self> {
|
fn context_for_payload<'a>(&self, payload: &'a HlExecutionData) -> ExecutionCtxFor<'a, Self> {
|
||||||
|
|||||||
@ -8,29 +8,26 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use alloy_consensus::{Transaction, TxReceipt};
|
use alloy_consensus::{Transaction, TxReceipt};
|
||||||
use alloy_eips::{eip7685::Requests, Encodable2718};
|
use alloy_eips::{Encodable2718, eip7685::Requests};
|
||||||
use alloy_evm::{block::ExecutableTx, eth::receipt_builder::ReceiptBuilderCtx};
|
use alloy_evm::{block::ExecutableTx, eth::receipt_builder::ReceiptBuilderCtx};
|
||||||
use alloy_primitives::{address, hex, Address, Bytes, U160, U256};
|
use alloy_primitives::{Address, Bytes, U160, U256, address, hex};
|
||||||
use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks};
|
use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks};
|
||||||
use reth_evm::{
|
use reth_evm::{
|
||||||
block::{BlockValidationError, CommitChanges},
|
Database, Evm, FromRecoveredTx, FromTxWithEncoded, IntoTxEnv, OnStateHook,
|
||||||
|
block::BlockValidationError,
|
||||||
eth::receipt_builder::ReceiptBuilder,
|
eth::receipt_builder::ReceiptBuilder,
|
||||||
execute::{BlockExecutionError, BlockExecutor},
|
execute::{BlockExecutionError, BlockExecutor},
|
||||||
precompiles::{DynPrecompile, PrecompileInput, PrecompilesMap},
|
precompiles::{DynPrecompile, PrecompileInput, PrecompilesMap},
|
||||||
Database, Evm, FromRecoveredTx, FromTxWithEncoded, IntoTxEnv, OnStateHook,
|
|
||||||
};
|
};
|
||||||
use reth_provider::BlockExecutionResult;
|
use reth_provider::BlockExecutionResult;
|
||||||
use reth_revm::State;
|
use reth_revm::State;
|
||||||
use revm::{
|
use revm::{
|
||||||
context::{
|
DatabaseCommit,
|
||||||
result::{ExecutionResult, ResultAndState},
|
context::{TxEnv, result::ResultAndState},
|
||||||
TxEnv,
|
|
||||||
},
|
|
||||||
interpreter::instructions::utility::IntoU256,
|
interpreter::instructions::utility::IntoU256,
|
||||||
precompile::{PrecompileError, PrecompileOutput, PrecompileResult},
|
precompile::{PrecompileError, PrecompileOutput, PrecompileResult},
|
||||||
primitives::HashMap,
|
primitives::HashMap,
|
||||||
state::Bytecode,
|
state::Bytecode,
|
||||||
DatabaseCommit,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn is_system_transaction(tx: &TransactionSigned) -> bool {
|
pub fn is_system_transaction(tx: &TransactionSigned) -> bool {
|
||||||
@ -110,7 +107,9 @@ where
|
|||||||
const COREWRITER_ENABLED_BLOCK_NUMBER: u64 = 7578300;
|
const COREWRITER_ENABLED_BLOCK_NUMBER: u64 = 7578300;
|
||||||
const COREWRITER_CONTRACT_ADDRESS: Address =
|
const COREWRITER_CONTRACT_ADDRESS: Address =
|
||||||
address!("0x3333333333333333333333333333333333333333");
|
address!("0x3333333333333333333333333333333333333333");
|
||||||
const COREWRITER_CODE: &[u8] = &hex!("608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806317938e131461002d575b5f5ffd5b61004760048036038101906100429190610123565b610049565b005b5f5f90505b61019081101561006557808060010191505061004e565b503373ffffffffffffffffffffffffffffffffffffffff167f8c7f585fb295f7eb1e6aeb8fba61b23a4fe60beda405f0045073b185c74412e383836040516100ae9291906101c8565b60405180910390a25050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100e3576100e26100c2565b5b8235905067ffffffffffffffff811115610100576100ff6100c6565b5b60208301915083600182028301111561011c5761011b6100ca565b5b9250929050565b5f5f60208385031215610139576101386100ba565b5b5f83013567ffffffffffffffff811115610156576101556100be565b5b610162858286016100ce565b92509250509250929050565b5f82825260208201905092915050565b828183375f83830152505050565b5f601f19601f8301169050919050565b5f6101a7838561016e565b93506101b483858461017e565b6101bd8361018c565b840190509392505050565b5f6020820190508181035f8301526101e181848661019c565b9050939250505056fea2646970667358221220f01517e1fbaff8af4bd72cb063cccecbacbb00b07354eea7dd52265d355474fb64736f6c634300081c0033");
|
const COREWRITER_CODE: &[u8] = &hex!(
|
||||||
|
"608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806317938e131461002d575b5f5ffd5b61004760048036038101906100429190610123565b610049565b005b5f5f90505b61019081101561006557808060010191505061004e565b503373ffffffffffffffffffffffffffffffffffffffff167f8c7f585fb295f7eb1e6aeb8fba61b23a4fe60beda405f0045073b185c74412e383836040516100ae9291906101c8565b60405180910390a25050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100e3576100e26100c2565b5b8235905067ffffffffffffffff811115610100576100ff6100c6565b5b60208301915083600182028301111561011c5761011b6100ca565b5b9250929050565b5f5f60208385031215610139576101386100ba565b5b5f83013567ffffffffffffffff811115610156576101556100be565b5b610162858286016100ce565b92509250509250929050565b5f82825260208201905092915050565b828183375f83830152505050565b5f601f19601f8301169050919050565b5f6101a7838561016e565b93506101b483858461017e565b6101bd8361018c565b840190509392505050565b5f6020820190508181035f8301526101e181848661019c565b9050939250505056fea2646970667358221220f01517e1fbaff8af4bd72cb063cccecbacbb00b07354eea7dd52265d355474fb64736f6c634300081c0033"
|
||||||
|
);
|
||||||
|
|
||||||
if self.evm.block().number != U256::from(COREWRITER_ENABLED_BLOCK_NUMBER) {
|
if self.evm.block().number != U256::from(COREWRITER_ENABLED_BLOCK_NUMBER) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@ -161,11 +160,10 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn execute_transaction_with_commit_condition(
|
fn execute_transaction_without_commit(
|
||||||
&mut self,
|
&mut self,
|
||||||
tx: impl ExecutableTx<Self>,
|
tx: impl ExecutableTx<Self>,
|
||||||
f: impl FnOnce(&ExecutionResult<<Self::Evm as Evm>::HaltReason>) -> CommitChanges,
|
) -> Result<ResultAndState<<Self::Evm as Evm>::HaltReason>, BlockExecutionError> {
|
||||||
) -> Result<Option<u64>, BlockExecutionError> {
|
|
||||||
// The sum of the transaction's gas limit, Tg, and the gas utilized in this block prior,
|
// The sum of the transaction's gas limit, Tg, and the gas utilized in this block prior,
|
||||||
// must be no greater than the block's gasLimit.
|
// must be no greater than the block's gasLimit.
|
||||||
let block_available_gas = self.evm.block().gas_limit - self.gas_used;
|
let block_available_gas = self.evm.block().gas_limit - self.gas_used;
|
||||||
@ -178,16 +176,20 @@ where
|
|||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute transaction.
|
// Execute transaction and return the result
|
||||||
let ResultAndState { result, mut state } = self
|
self.evm.transact(&tx).map_err(|err| {
|
||||||
.evm
|
let hash = tx.tx().trie_hash();
|
||||||
.transact(&tx)
|
BlockExecutionError::evm(err, hash)
|
||||||
.map_err(|err| BlockExecutionError::evm(err, tx.tx().trie_hash()))?;
|
})
|
||||||
|
|
||||||
if !f(&result).should_commit() {
|
|
||||||
return Ok(None);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn commit_transaction(
|
||||||
|
&mut self,
|
||||||
|
output: ResultAndState<<Self::Evm as Evm>::HaltReason>,
|
||||||
|
tx: impl ExecutableTx<Self>,
|
||||||
|
) -> Result<u64, BlockExecutionError> {
|
||||||
|
let ResultAndState { result, mut state } = output;
|
||||||
|
|
||||||
let gas_used = result.gas_used();
|
let gas_used = result.gas_used();
|
||||||
|
|
||||||
// append gas used
|
// append gas used
|
||||||
@ -215,7 +217,7 @@ where
|
|||||||
// Commit the state changes.
|
// Commit the state changes.
|
||||||
self.evm.db_mut().commit(state);
|
self.evm.db_mut().commit(state);
|
||||||
|
|
||||||
Ok(Some(gas_used))
|
Ok(gas_used)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finish(self) -> Result<(Self::Evm, BlockExecutionResult<R::Receipt>), BlockExecutionError> {
|
fn finish(self) -> Result<(Self::Evm, BlockExecutionResult<R::Receipt>), BlockExecutionError> {
|
||||||
|
|||||||
@ -1,30 +1,32 @@
|
|||||||
//! HlNodePrimitives::TransactionSigned; it's the same as ethereum transaction type,
|
//! HlNodePrimitives::TransactionSigned; it's the same as ethereum transaction type,
|
||||||
//! except that it supports pseudo signer for system transactions.
|
//! except that it supports pseudo signer for system transactions.
|
||||||
|
use std::convert::Infallible;
|
||||||
|
|
||||||
use crate::evm::transaction::HlTxEnv;
|
use crate::evm::transaction::HlTxEnv;
|
||||||
use alloy_consensus::{
|
use alloy_consensus::{
|
||||||
crypto::RecoveryError, error::ValueError, SignableTransaction, Signed,
|
SignableTransaction, Signed, Transaction as TransactionTrait, TransactionEnvelope, TxEip1559,
|
||||||
Transaction as TransactionTrait, TransactionEnvelope, TxEip1559, TxEip2930, TxEip4844,
|
TxEip2930, TxEip4844, TxEip7702, TxLegacy, TxType, TypedTransaction, crypto::RecoveryError,
|
||||||
TxEip7702, TxLegacy, TxType, TypedTransaction,
|
error::ValueError, transaction::TxHashRef,
|
||||||
};
|
};
|
||||||
use alloy_eips::Encodable2718;
|
use alloy_eips::Encodable2718;
|
||||||
use alloy_network::TxSigner;
|
use alloy_network::TxSigner;
|
||||||
use alloy_primitives::{address, Address, TxHash, U256};
|
use alloy_primitives::{Address, TxHash, U256, address};
|
||||||
use alloy_rpc_types::{Transaction, TransactionInfo, TransactionRequest};
|
use alloy_rpc_types::{Transaction, TransactionInfo, TransactionRequest};
|
||||||
use alloy_signer::Signature;
|
use alloy_signer::Signature;
|
||||||
use reth_codecs::alloy::transaction::{Envelope, FromTxCompact};
|
use reth_codecs::alloy::transaction::{Envelope, FromTxCompact};
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
table::{Compress, Decompress},
|
|
||||||
DatabaseError,
|
DatabaseError,
|
||||||
|
table::{Compress, Decompress},
|
||||||
};
|
};
|
||||||
use reth_ethereum_primitives::PooledTransactionVariant;
|
use reth_ethereum_primitives::PooledTransactionVariant;
|
||||||
use reth_evm::FromRecoveredTx;
|
use reth_evm::FromRecoveredTx;
|
||||||
use reth_primitives::Recovered;
|
use reth_primitives::Recovered;
|
||||||
use reth_primitives_traits::{
|
use reth_primitives_traits::{
|
||||||
serde_bincode_compat::SerdeBincodeCompat, InMemorySize, SignedTransaction, SignerRecoverable,
|
InMemorySize, SignedTransaction, SignerRecoverable, serde_bincode_compat::SerdeBincodeCompat,
|
||||||
};
|
};
|
||||||
use reth_rpc_eth_api::{
|
use reth_rpc_eth_api::{
|
||||||
transaction::{FromConsensusTx, TryIntoTxEnv},
|
|
||||||
EthTxEnvError, SignTxRequestError, SignableTxRequest, TryIntoSimTx,
|
EthTxEnvError, SignTxRequestError, SignableTxRequest, TryIntoSimTx,
|
||||||
|
transaction::{FromConsensusTx, TryIntoTxEnv},
|
||||||
};
|
};
|
||||||
use revm::context::{BlockEnv, CfgEnv, TxEnv};
|
use revm::context::{BlockEnv, CfgEnv, TxEnv};
|
||||||
|
|
||||||
@ -46,6 +48,12 @@ fn s_to_address(s: U256) -> Address {
|
|||||||
Address::from_slice(&buf)
|
Address::from_slice(&buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TxHashRef for TransactionSigned {
|
||||||
|
fn tx_hash(&self) -> &TxHash {
|
||||||
|
self.inner().tx_hash()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SignerRecoverable for TransactionSigned {
|
impl SignerRecoverable for TransactionSigned {
|
||||||
fn recover_signer(&self) -> Result<Address, RecoveryError> {
|
fn recover_signer(&self) -> Result<Address, RecoveryError> {
|
||||||
if self.is_system_transaction() {
|
if self.is_system_transaction() {
|
||||||
@ -69,11 +77,7 @@ impl SignerRecoverable for TransactionSigned {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SignedTransaction for TransactionSigned {
|
impl SignedTransaction for TransactionSigned {}
|
||||||
fn tx_hash(&self) -> &TxHash {
|
|
||||||
self.inner().tx_hash()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// NOTE: All lines below are just wrappers for the inner type.
|
// NOTE: All lines below are just wrappers for the inner type.
|
||||||
@ -250,9 +254,17 @@ impl TryIntoTxEnv<HlTxEnv<TxEnv>> for TransactionRequest {
|
|||||||
|
|
||||||
impl FromConsensusTx<TransactionSigned> for Transaction {
|
impl FromConsensusTx<TransactionSigned> for Transaction {
|
||||||
type TxInfo = TransactionInfo;
|
type TxInfo = TransactionInfo;
|
||||||
|
type Err = Infallible;
|
||||||
|
|
||||||
fn from_consensus_tx(tx: TransactionSigned, signer: Address, tx_info: Self::TxInfo) -> Self {
|
fn from_consensus_tx(
|
||||||
Self::from_transaction(Recovered::new_unchecked(tx.into_inner().into(), signer), tx_info)
|
tx: TransactionSigned,
|
||||||
|
signer: Address,
|
||||||
|
tx_info: Self::TxInfo,
|
||||||
|
) -> Result<Self, Self::Err> {
|
||||||
|
Ok(Self::from_transaction(
|
||||||
|
Recovered::new_unchecked(tx.into_inner().into(), signer),
|
||||||
|
tx_info,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
use crate::node::rpc::{HlEthApi, HlRpcNodeCore};
|
use crate::node::rpc::{HlEthApi, HlRpcNodeCore};
|
||||||
use reth::rpc::server_types::eth::{
|
use reth::rpc::server_types::eth::{
|
||||||
builder::config::PendingBlockKind, error::FromEvmError, EthApiError, PendingBlock,
|
EthApiError, PendingBlock, builder::config::PendingBlockKind, error::FromEvmError,
|
||||||
};
|
};
|
||||||
use reth_rpc_eth_api::{
|
use reth_rpc_eth_api::{
|
||||||
helpers::{
|
|
||||||
pending_block::PendingEnvBuilder, EthBlocks, LoadBlock, LoadPendingBlock, LoadReceipt,
|
|
||||||
},
|
|
||||||
RpcConvert,
|
RpcConvert,
|
||||||
|
helpers::{
|
||||||
|
EthBlocks, LoadBlock, LoadPendingBlock, LoadReceipt, pending_block::PendingEnvBuilder,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<N, Rpc> EthBlocks for HlEthApi<N, Rpc>
|
impl<N, Rpc> EthBlocks for HlEthApi<N, Rpc>
|
||||||
@ -29,7 +29,7 @@ impl<N, Rpc> LoadPendingBlock for HlEthApi<N, Rpc>
|
|||||||
where
|
where
|
||||||
N: HlRpcNodeCore,
|
N: HlRpcNodeCore,
|
||||||
EthApiError: FromEvmError<N::Evm>,
|
EthApiError: FromEvmError<N::Evm>,
|
||||||
Rpc: RpcConvert<Primitives = N::Primitives, Error = EthApiError>,
|
Rpc: RpcConvert<Primitives = N::Primitives>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn pending_block(&self) -> &tokio::sync::Mutex<Option<PendingBlock<N::Primitives>>> {
|
fn pending_block(&self) -> &tokio::sync::Mutex<Option<PendingBlock<N::Primitives>>> {
|
||||||
@ -50,7 +50,6 @@ where
|
|||||||
impl<N, Rpc> LoadReceipt for HlEthApi<N, Rpc>
|
impl<N, Rpc> LoadReceipt for HlEthApi<N, Rpc>
|
||||||
where
|
where
|
||||||
N: HlRpcNodeCore,
|
N: HlRpcNodeCore,
|
||||||
EthApiError: FromEvmError<N::Evm>,
|
|
||||||
Rpc: RpcConvert<Primitives = N::Primitives, Error = EthApiError>,
|
Rpc: RpcConvert<Primitives = N::Primitives, Error = EthApiError>,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,11 +3,11 @@ use core::fmt;
|
|||||||
use super::{HlEthApi, HlRpcNodeCore};
|
use super::{HlEthApi, HlRpcNodeCore};
|
||||||
use crate::{node::evm::apply_precompiles, HlBlock};
|
use crate::{node::evm::apply_precompiles, HlBlock};
|
||||||
use alloy_evm::Evm;
|
use alloy_evm::Evm;
|
||||||
|
use alloy_consensus::transaction::TxHashRef;
|
||||||
use alloy_primitives::B256;
|
use alloy_primitives::B256;
|
||||||
use reth::rpc::server_types::eth::EthApiError;
|
use reth::rpc::server_types::eth::EthApiError;
|
||||||
use reth_evm::{ConfigureEvm, Database, EvmEnvFor, HaltReasonFor, InspectorFor, SpecFor, TxEnvFor};
|
use reth_evm::{ConfigureEvm, Database, EvmEnvFor, HaltReasonFor, InspectorFor, SpecFor, TxEnvFor};
|
||||||
use reth_primitives::{NodePrimitives, Recovered};
|
use reth_primitives::{NodePrimitives, Recovered};
|
||||||
use reth_primitives_traits::SignedTransaction;
|
|
||||||
use reth_provider::{ProviderError, ProviderTx};
|
use reth_provider::{ProviderError, ProviderTx};
|
||||||
use reth_rpc_eth_api::{
|
use reth_rpc_eth_api::{
|
||||||
helpers::{Call, EthCall},
|
helpers::{Call, EthCall},
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
HlBlock, HlPrimitives,
|
||||||
chainspec::HlChainSpec,
|
chainspec::HlChainSpec,
|
||||||
node::{evm::apply_precompiles, types::HlExtras},
|
node::{evm::apply_precompiles, types::HlExtras},
|
||||||
HlBlock, HlPrimitives,
|
|
||||||
};
|
};
|
||||||
use alloy_eips::BlockId;
|
use alloy_eips::BlockId;
|
||||||
use alloy_evm::Evm;
|
use alloy_evm::Evm;
|
||||||
@ -10,19 +10,19 @@ use alloy_primitives::U256;
|
|||||||
use reth::{
|
use reth::{
|
||||||
api::{FullNodeTypes, HeaderTy, NodeTypes, PrimitivesTy},
|
api::{FullNodeTypes, HeaderTy, NodeTypes, PrimitivesTy},
|
||||||
builder::{
|
builder::{
|
||||||
rpc::{EthApiBuilder, EthApiCtx},
|
|
||||||
FullNodeComponents,
|
FullNodeComponents,
|
||||||
|
rpc::{EthApiBuilder, EthApiCtx},
|
||||||
},
|
},
|
||||||
rpc::{
|
rpc::{
|
||||||
eth::{core::EthApiInner, DevSigner, FullEthApiServer},
|
eth::{DevSigner, FullEthApiServer, core::EthApiInner},
|
||||||
server_types::eth::{
|
server_types::eth::{
|
||||||
receipt::EthReceiptConverter, EthApiError, EthStateCache, FeeHistoryCache,
|
EthApiError, EthStateCache, FeeHistoryCache, GasPriceOracle,
|
||||||
GasPriceOracle,
|
receipt::EthReceiptConverter,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tasks::{
|
tasks::{
|
||||||
pool::{BlockingTaskGuard, BlockingTaskPool},
|
|
||||||
TaskSpawner,
|
TaskSpawner,
|
||||||
|
pool::{BlockingTaskGuard, BlockingTaskPool},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use reth_evm::{ConfigureEvm, Database, EvmEnvFor, HaltReasonFor, InspectorFor, TxEnvFor};
|
use reth_evm::{ConfigureEvm, Database, EvmEnvFor, HaltReasonFor, InspectorFor, TxEnvFor};
|
||||||
@ -32,12 +32,12 @@ use reth_provider::{
|
|||||||
};
|
};
|
||||||
use reth_rpc::RpcTypes;
|
use reth_rpc::RpcTypes;
|
||||||
use reth_rpc_eth_api::{
|
use reth_rpc_eth_api::{
|
||||||
helpers::{
|
|
||||||
pending_block::BuildPendingEnv, spec::SignersForApi, AddDevSigners, EthApiSpec, EthFees,
|
|
||||||
EthState, LoadFee, LoadPendingBlock, LoadState, SpawnBlocking, Trace,
|
|
||||||
},
|
|
||||||
EthApiTypes, FromEvmError, RpcConvert, RpcConverter, RpcNodeCore, RpcNodeCoreExt,
|
EthApiTypes, FromEvmError, RpcConvert, RpcConverter, RpcNodeCore, RpcNodeCoreExt,
|
||||||
SignableTxRequest,
|
SignableTxRequest,
|
||||||
|
helpers::{
|
||||||
|
AddDevSigners, EthApiSpec, EthFees, EthState, LoadFee, LoadPendingBlock, LoadState,
|
||||||
|
SpawnBlocking, Trace, pending_block::BuildPendingEnv, spec::SignersForApi,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use revm::context::result::ResultAndState;
|
use revm::context::result::ResultAndState;
|
||||||
use std::{fmt, marker::PhantomData, sync::Arc};
|
use std::{fmt, marker::PhantomData, sync::Arc};
|
||||||
@ -60,12 +60,17 @@ pub(crate) struct HlEthApiInner<N: HlRpcNodeCore, Rpc: RpcConvert> {
|
|||||||
type HlRpcConvert<N, NetworkT> =
|
type HlRpcConvert<N, NetworkT> =
|
||||||
RpcConverter<NetworkT, <N as FullNodeComponents>::Evm, EthReceiptConverter<HlChainSpec>>;
|
RpcConverter<NetworkT, <N as FullNodeComponents>::Evm, EthReceiptConverter<HlChainSpec>>;
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct HlEthApi<N: HlRpcNodeCore, Rpc: RpcConvert> {
|
pub struct HlEthApi<N: HlRpcNodeCore, Rpc: RpcConvert> {
|
||||||
/// Gateway to node's core components.
|
/// Gateway to node's core components.
|
||||||
pub(crate) inner: Arc<HlEthApiInner<N, Rpc>>,
|
pub(crate) inner: Arc<HlEthApiInner<N, Rpc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<N: HlRpcNodeCore, Rpc: RpcConvert> Clone for HlEthApi<N, Rpc> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self { inner: self.inner.clone() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<N, Rpc> fmt::Debug for HlEthApi<N, Rpc>
|
impl<N, Rpc> fmt::Debug for HlEthApi<N, Rpc>
|
||||||
where
|
where
|
||||||
N: HlRpcNodeCore,
|
N: HlRpcNodeCore,
|
||||||
@ -79,7 +84,7 @@ where
|
|||||||
impl<N, Rpc> EthApiTypes for HlEthApi<N, Rpc>
|
impl<N, Rpc> EthApiTypes for HlEthApi<N, Rpc>
|
||||||
where
|
where
|
||||||
N: HlRpcNodeCore,
|
N: HlRpcNodeCore,
|
||||||
Rpc: RpcConvert<Primitives = N::Primitives, Error = EthApiError>,
|
Rpc: RpcConvert<Primitives = N::Primitives>,
|
||||||
{
|
{
|
||||||
type Error = EthApiError;
|
type Error = EthApiError;
|
||||||
type NetworkTypes = Rpc::Network;
|
type NetworkTypes = Rpc::Network;
|
||||||
@ -155,7 +160,7 @@ where
|
|||||||
impl<N, Rpc> SpawnBlocking for HlEthApi<N, Rpc>
|
impl<N, Rpc> SpawnBlocking for HlEthApi<N, Rpc>
|
||||||
where
|
where
|
||||||
N: HlRpcNodeCore,
|
N: HlRpcNodeCore,
|
||||||
Rpc: RpcConvert<Primitives = N::Primitives, Error = EthApiError>,
|
Rpc: RpcConvert<Primitives = N::Primitives>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn io_task_spawner(&self) -> impl TaskSpawner {
|
fn io_task_spawner(&self) -> impl TaskSpawner {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::node::rpc::{HlEthApi, HlRpcNodeCore};
|
use crate::node::rpc::{HlEthApi, HlRpcNodeCore};
|
||||||
use alloy_primitives::{Bytes, B256};
|
use alloy_primitives::{B256, Bytes};
|
||||||
use reth::rpc::server_types::eth::EthApiError;
|
use reth::rpc::server_types::eth::EthApiError;
|
||||||
use reth_rpc_eth_api::{
|
use reth_rpc_eth_api::{
|
||||||
helpers::{spec::SignersForRpc, EthTransactions, LoadTransaction},
|
|
||||||
RpcConvert,
|
RpcConvert,
|
||||||
|
helpers::{EthTransactions, LoadTransaction, spec::SignersForRpc},
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<N, Rpc> LoadTransaction for HlEthApi<N, Rpc>
|
impl<N, Rpc> LoadTransaction for HlEthApi<N, Rpc>
|
||||||
@ -25,4 +27,8 @@ where
|
|||||||
async fn send_raw_transaction(&self, _tx: Bytes) -> Result<B256, Self::Error> {
|
async fn send_raw_transaction(&self, _tx: Bytes) -> Result<B256, Self::Error> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn send_raw_transaction_sync_timeout(&self) -> Duration {
|
||||||
|
self.inner.eth_api.send_raw_transaction_sync_timeout()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user