mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: Make constants consistent
This commit is contained in:
@ -15,6 +15,9 @@ use reth_discv4::NodeRecord;
|
||||
use reth_evm::eth::spec::EthExecutorSpec;
|
||||
use std::{fmt::Display, sync::Arc};
|
||||
|
||||
pub const MAINNET_CHAIN_ID: u64 = 999;
|
||||
pub const TESTNET_CHAIN_ID: u64 = 998;
|
||||
|
||||
/// Hl chain spec type.
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||
pub struct HlChainSpec {
|
||||
@ -144,8 +147,8 @@ impl HlChainSpec {
|
||||
|
||||
pub fn official_rpc_url(&self) -> &'static str {
|
||||
match self.inner.chain().id() {
|
||||
999 => Self::MAINNET_RPC_URL,
|
||||
998 => Self::TESTNET_RPC_URL,
|
||||
MAINNET_CHAIN_ID => Self::MAINNET_RPC_URL,
|
||||
TESTNET_CHAIN_ID => Self::TESTNET_RPC_URL,
|
||||
_ => unreachable!("Unreachable since ChainSpecParser won't return other chains"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@ use revm::{
|
||||
Inspector,
|
||||
};
|
||||
|
||||
use crate::chainspec::MAINNET_CHAIN_ID;
|
||||
|
||||
pub mod builder;
|
||||
pub mod ctx;
|
||||
mod exec;
|
||||
@ -31,7 +33,9 @@ impl<CTX: ContextTr, INSP>
|
||||
let mut instruction = EthInstructions::new_mainnet();
|
||||
|
||||
const NON_PLACEHOLDER_BLOCK_HASH_HEIGHT: u64 = 243_538;
|
||||
if ctx.chain_id() == 999 && ctx.block_number() < NON_PLACEHOLDER_BLOCK_HASH_HEIGHT {
|
||||
if ctx.chain_id() == MAINNET_CHAIN_ID &&
|
||||
ctx.block_number() < NON_PLACEHOLDER_BLOCK_HASH_HEIGHT
|
||||
{
|
||||
instruction.insert_instruction(
|
||||
BLOCKHASH,
|
||||
Instruction::new(patch::blockhash_returning_placeholder, 20),
|
||||
|
||||
@ -3,8 +3,7 @@ use eyre::{Error, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
pub(crate) const MAINNET_CHAIN_ID: u64 = 999;
|
||||
pub(crate) const TESTNET_CHAIN_ID: u64 = 998;
|
||||
use crate::chainspec::{MAINNET_CHAIN_ID, TESTNET_CHAIN_ID};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
struct EvmContract {
|
||||
|
||||
Reference in New Issue
Block a user