mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: read precompile draft (dirty)
This commit is contained in:
@ -64,6 +64,7 @@ reth-node-events.workspace = true
|
||||
reth-node-metrics.workspace = true
|
||||
reth-consensus.workspace = true
|
||||
reth-prune.workspace = true
|
||||
reth-hyperliquid-types.workspace = true
|
||||
|
||||
# crypto
|
||||
alloy-eips = { workspace = true, features = ["kzg"] }
|
||||
|
||||
@ -8,8 +8,6 @@ mod forwarder;
|
||||
mod serialized;
|
||||
mod spot_meta;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use block_ingest::BlockIngest;
|
||||
use clap::{Args, Parser};
|
||||
use forwarder::EthForwarderApiServer;
|
||||
@ -20,10 +18,6 @@ use tracing::info;
|
||||
|
||||
#[derive(Args, Debug, Clone)]
|
||||
struct HyperliquidExtArgs {
|
||||
/// EVM blocks base directory
|
||||
#[arg(long, default_value = "/tmp/evm-blocks")]
|
||||
pub ingest_dir: PathBuf,
|
||||
|
||||
/// Upstream RPC URL to forward incoming transactions.
|
||||
#[arg(long, default_value = "https://rpc.hyperliquid.xyz/evm")]
|
||||
pub upstream_rpc_url: String,
|
||||
@ -38,12 +32,13 @@ fn main() {
|
||||
}
|
||||
|
||||
if let Err(err) = Cli::<EthereumChainSpecParser, HyperliquidExtArgs>::parse().run(
|
||||
|builder, ingest_args| async move {
|
||||
|builder, ext_args| async move {
|
||||
let ingest_dir = builder.config().ingest_dir.clone().expect("ingest dir not set");
|
||||
info!(target: "reth::cli", "Launching node");
|
||||
let handle = builder
|
||||
.node(EthereumNode::default())
|
||||
.extend_rpc_modules(move |ctx| {
|
||||
let upstream_rpc_url = ingest_args.upstream_rpc_url.clone();
|
||||
let upstream_rpc_url = ext_args.upstream_rpc_url.clone();
|
||||
let rpc = forwarder::EthForwarderExt::new(upstream_rpc_url).into_rpc();
|
||||
for method_name in rpc.method_names() {
|
||||
ctx.modules.remove_method_from_configured(method_name);
|
||||
@ -56,7 +51,6 @@ fn main() {
|
||||
.launch()
|
||||
.await?;
|
||||
|
||||
let ingest_dir = ingest_args.ingest_dir;
|
||||
let ingest = BlockIngest(ingest_dir);
|
||||
ingest.run(handle.node).await.unwrap();
|
||||
handle.node_exit_future.await
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
use alloy_primitives::{Address, Bytes, Log};
|
||||
use alloy_primitives::{Address, Log};
|
||||
use reth_hyperliquid_types::{ReadPrecompileInput, ReadPrecompileResult};
|
||||
use reth_primitives::{SealedBlock, Transaction};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub(crate) struct BlockAndReceipts {
|
||||
pub(crate) block: EvmBlock,
|
||||
pub(crate) receipts: Vec<LegacyReceipt>,
|
||||
pub block: EvmBlock,
|
||||
pub receipts: Vec<LegacyReceipt>,
|
||||
#[serde(default)]
|
||||
pub(crate) system_txs: Vec<SystemTx>,
|
||||
pub system_txs: Vec<SystemTx>,
|
||||
#[serde(default)]
|
||||
pub(crate) read_precompile_calls:
|
||||
Vec<(Address, Vec<(ReadPrecompileInput, ReadPrecompileResult)>)>,
|
||||
pub read_precompile_calls: Vec<(Address, Vec<(ReadPrecompileInput, ReadPrecompileResult)>)>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@ -18,6 +18,7 @@ pub(crate) enum EvmBlock {
|
||||
Reth115(SealedBlock),
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub(crate) struct LegacyReceipt {
|
||||
tx_type: LegacyTxType,
|
||||
@ -37,20 +38,6 @@ enum LegacyTxType {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub(crate) struct SystemTx {
|
||||
pub(crate) tx: Transaction,
|
||||
pub(crate) receipt: Option<LegacyReceipt>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Hash)]
|
||||
pub(crate) struct ReadPrecompileInput {
|
||||
pub(crate) input: Bytes,
|
||||
pub(crate) gas_limit: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub(crate) enum ReadPrecompileResult {
|
||||
Ok { gas_used: u64, bytes: Bytes },
|
||||
OutOfGas,
|
||||
Error,
|
||||
UnexpectedError,
|
||||
pub tx: Transaction,
|
||||
pub receipt: Option<LegacyReceipt>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user