mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 02:49:55 +00:00
Compare commits
11 Commits
nb-2025101
...
010d056aad
| Author | SHA1 | Date | |
|---|---|---|---|
| 010d056aad | |||
| 821c63494e | |||
| f915aba568 | |||
| 1fe03bfc41 | |||
| 893822e5b0 | |||
| c2528ce223 | |||
| d46e808b8d | |||
| 497353fd2f | |||
| eee6eeb2fc | |||
| 611e6867bf | |||
| 6c3ed63c3c |
@ -347,8 +347,10 @@ where
|
|||||||
pubsub.log_stream(filter).filter_map(|log| adjust_log::<Eth>(log, &provider)),
|
pubsub.log_stream(filter).filter_map(|log| adjust_log::<Eth>(log, &provider)),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
} else {
|
} else if kind == SubscriptionKind::NewHeads {
|
||||||
let _ = pipe_from_stream(sink, new_headers_stream::<Eth>(&provider)).await;
|
let _ = pipe_from_stream(sink, new_headers_stream::<Eth>(&provider)).await;
|
||||||
|
} else {
|
||||||
|
let _ = pubsub.handle_accepted(sink, kind, params).await;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
20
src/main.rs
20
src/main.rs
@ -63,16 +63,6 @@ fn main() -> eyre::Result<()> {
|
|||||||
info!("Call/gas estimation will be forwarded to {}", upstream_rpc_url);
|
info!("Call/gas estimation will be forwarded to {}", upstream_rpc_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ext.hl_node_compliant {
|
|
||||||
install_hl_node_compliance(&mut ctx)?;
|
|
||||||
info!("hl-node compliant mode enabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
if !ext.experimental_eth_get_proof {
|
|
||||||
ctx.modules.remove_method_from_configured("eth_getProof");
|
|
||||||
info!("eth_getProof is disabled by default");
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a temporary workaround to fix the issue with custom headers
|
// This is a temporary workaround to fix the issue with custom headers
|
||||||
// affects `eth_subscribe[type=newHeads]`
|
// affects `eth_subscribe[type=newHeads]`
|
||||||
ctx.modules.replace_configured(
|
ctx.modules.replace_configured(
|
||||||
@ -84,6 +74,16 @@ fn main() -> eyre::Result<()> {
|
|||||||
.into_rpc(),
|
.into_rpc(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
if ext.hl_node_compliant {
|
||||||
|
install_hl_node_compliance(&mut ctx)?;
|
||||||
|
info!("hl-node compliant mode enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ext.experimental_eth_get_proof {
|
||||||
|
ctx.modules.remove_method_from_configured("eth_getProof");
|
||||||
|
info!("eth_getProof is disabled by default");
|
||||||
|
}
|
||||||
|
|
||||||
ctx.modules.merge_configured(
|
ctx.modules.merge_configured(
|
||||||
HlBlockPrecompileExt::new(ctx.registry.eth_api().clone()).into_rpc(),
|
HlBlockPrecompileExt::new(ctx.registry.eth_api().clone()).into_rpc(),
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
@ -145,8 +145,12 @@ where
|
|||||||
|
|
||||||
match self.command {
|
match self.command {
|
||||||
Commands::Node(command) => runner.run_command_until_exit(|ctx| {
|
Commands::Node(command) => runner.run_command_until_exit(|ctx| {
|
||||||
Self::migrate_db(&command.chain, &command.datadir, &command.db)
|
// NOTE: This is for one time migration around Oct 10 upgrade:
|
||||||
.expect("Failed to migrate database");
|
// It's not necessary anymore, an environment variable gate is added here.
|
||||||
|
if std::env::var("CHECK_DB_MIGRATION").is_ok() {
|
||||||
|
Self::migrate_db(&command.chain, &command.datadir, &command.db)
|
||||||
|
.expect("Failed to migrate database");
|
||||||
|
}
|
||||||
command.execute(ctx, FnLauncher::new::<C, Ext>(launcher))
|
command.execute(ctx, FnLauncher::new::<C, Ext>(launcher))
|
||||||
}),
|
}),
|
||||||
Commands::Init(command) => {
|
Commands::Init(command) => {
|
||||||
|
|||||||
@ -346,7 +346,7 @@ fn migrate_single_static_file<N: HlNodeType>(
|
|||||||
|
|
||||||
// block_ranges into chunks of 50000 blocks
|
// block_ranges into chunks of 50000 blocks
|
||||||
const CHUNK_SIZE: u64 = 50000;
|
const CHUNK_SIZE: u64 = 50000;
|
||||||
for chunk in (0..=block_range.end()).step_by(CHUNK_SIZE as usize) {
|
for chunk in (block_range.start()..=block_range.end()).step_by(CHUNK_SIZE as usize) {
|
||||||
let end = std::cmp::min(chunk + CHUNK_SIZE - 1, block_range.end());
|
let end = std::cmp::min(chunk + CHUNK_SIZE - 1, block_range.end());
|
||||||
let block_range = chunk..=end;
|
let block_range = chunk..=end;
|
||||||
let headers = old_headers_range(sf_in, block_range.clone())?;
|
let headers = old_headers_range(sf_in, block_range.clone())?;
|
||||||
|
|||||||
@ -127,6 +127,19 @@ pub struct SystemTx {
|
|||||||
pub receipt: Option<LegacyReceipt>,
|
pub receipt: Option<LegacyReceipt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SystemTx {
|
||||||
|
pub fn gas_limit(&self) -> u64 {
|
||||||
|
use reth_compat::Transaction;
|
||||||
|
match &self.tx {
|
||||||
|
Transaction::Legacy(tx) => tx.gas_limit,
|
||||||
|
Transaction::Eip2930(tx) => tx.gas_limit,
|
||||||
|
Transaction::Eip1559(tx) => tx.gas_limit,
|
||||||
|
Transaction::Eip4844(tx) => tx.gas_limit,
|
||||||
|
Transaction::Eip7702(tx) => tx.gas_limit,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug,
|
Debug,
|
||||||
Clone,
|
Clone,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
//! Copy of reth codebase to preserve serialization compatibility
|
//! Copy of reth codebase to preserve serialization compatibility
|
||||||
|
use crate::chainspec::TESTNET_CHAIN_ID;
|
||||||
use alloy_consensus::{Header, Signed, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy};
|
use alloy_consensus::{Header, Signed, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy};
|
||||||
use alloy_primitives::{Address, BlockHash, Signature, TxKind, U256};
|
use alloy_primitives::{Address, BlockHash, Signature, TxKind, U256};
|
||||||
use reth_primitives::TransactionSigned as RethTxSigned;
|
use reth_primitives::TransactionSigned as RethTxSigned;
|
||||||
@ -113,10 +114,16 @@ impl SealedBlock {
|
|||||||
&self,
|
&self,
|
||||||
read_precompile_calls: ReadPrecompileCalls,
|
read_precompile_calls: ReadPrecompileCalls,
|
||||||
highest_precompile_address: Option<Address>,
|
highest_precompile_address: Option<Address>,
|
||||||
system_txs: Vec<super::SystemTx>,
|
mut system_txs: Vec<super::SystemTx>,
|
||||||
receipts: Vec<LegacyReceipt>,
|
receipts: Vec<LegacyReceipt>,
|
||||||
chain_id: u64,
|
chain_id: u64,
|
||||||
) -> HlBlock {
|
) -> HlBlock {
|
||||||
|
// NOTE: Filter out system transactions that may be rejected by the EVM (tracked by #97,
|
||||||
|
// testnet only).
|
||||||
|
if chain_id == TESTNET_CHAIN_ID {
|
||||||
|
system_txs = system_txs.into_iter().filter(|tx| tx.receipt.is_some()).collect();
|
||||||
|
}
|
||||||
|
|
||||||
let mut merged_txs = vec![];
|
let mut merged_txs = vec![];
|
||||||
merged_txs.extend(system_txs.iter().map(|tx| system_tx_to_reth_transaction(tx, chain_id)));
|
merged_txs.extend(system_txs.iter().map(|tx| system_tx_to_reth_transaction(tx, chain_id)));
|
||||||
merged_txs.extend(self.body.transactions.iter().map(|tx| tx.to_reth_transaction()));
|
merged_txs.extend(self.body.transactions.iter().map(|tx| tx.to_reth_transaction()));
|
||||||
|
|||||||
Reference in New Issue
Block a user