mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: Sync with hyper-evm-sync
This commit is contained in:
@ -20,14 +20,14 @@ pub trait FullSignedTx: SignedTransaction + MaybeCompact + MaybeSerdeBincodeComp
|
|||||||
impl<T> FullSignedTx for T where T: SignedTransaction + MaybeCompact + MaybeSerdeBincodeCompat {}
|
impl<T> FullSignedTx for T where T: SignedTransaction + MaybeCompact + MaybeSerdeBincodeCompat {}
|
||||||
|
|
||||||
/// Hyperliquid system transaction from address.
|
/// Hyperliquid system transaction from address.
|
||||||
pub const HL_SYSTEM_TX_FROM_ADDR: Address = address!("2222222222222222222222222222222222222222");
|
pub const NATIVE_TOKEN_SYSTEM_ADDRESS: Address = address!("2222222222222222222222222222222222222222");
|
||||||
|
|
||||||
/// Check if the transaction is impersonated.
|
/// Check if the transaction is impersonated.
|
||||||
/// Signature part is introduced in block_ingest, while the gas_price is trait of hyperliquid system transactions.
|
/// Signature part is introduced in block_ingest, while the gas_price is trait of hyperliquid system transactions.
|
||||||
pub fn is_impersonated_tx(signature: &Signature, gas_price: Option<u128>) -> Option<Address> {
|
pub fn is_impersonated_tx(signature: &Signature, gas_price: Option<u128>) -> Option<Address> {
|
||||||
if signature.r() == U256::from(1) && signature.v() == true && gas_price == Some(0u128) {
|
if signature.r() == U256::from(1) && signature.v() == true && gas_price == Some(0u128) {
|
||||||
if signature.s() == U256::from(1) {
|
if signature.s() == U256::from(1) {
|
||||||
Some(HL_SYSTEM_TX_FROM_ADDR)
|
Some(NATIVE_TOKEN_SYSTEM_ADDRESS)
|
||||||
} else {
|
} else {
|
||||||
let s = signature.s().reduce_mod(U256::from(U160::MAX).add(U256::from(1)));
|
let s = signature.s().reduce_mod(U256::from(U160::MAX).add(U256::from(1)));
|
||||||
let s = U160::from(s);
|
let s = U160::from(s);
|
||||||
|
|||||||
@ -159,7 +159,8 @@ impl<DB: EvmStateProvider> DatabaseRef for StateProviderDatabase<DB> {
|
|||||||
///
|
///
|
||||||
/// Returns `Ok` with the block hash if found, or the default hash otherwise.
|
/// Returns `Ok` with the block hash if found, or the default hash otherwise.
|
||||||
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
|
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
|
||||||
if number >= 270000 {
|
const NON_PLACEHOLDER_BLOCK_HASH_HEIGHT: u64 = 243_538;
|
||||||
|
if number >= NON_PLACEHOLDER_BLOCK_HASH_HEIGHT {
|
||||||
// Get the block hash or default hash with an attempt to convert U256 block number to u64
|
// Get the block hash or default hash with an attempt to convert U256 block number to u64
|
||||||
Ok(self.0.block_hash(number)?.unwrap_or_default())
|
Ok(self.0.block_hash(number)?.unwrap_or_default())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user