From d8347ee76814dcf3f0beb5bd78487fb45346f403 Mon Sep 17 00:00:00 2001 From: refcell Date: Sun, 17 Nov 2024 08:04:55 -0500 Subject: [PATCH] chore: simplify signature definitions --- crates/consensus/src/hardforks/ecotone.rs | 4 ++-- crates/consensus/src/hardforks/fjord.rs | 4 ++-- crates/consensus/src/hardforks/mod.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/consensus/src/hardforks/ecotone.rs b/crates/consensus/src/hardforks/ecotone.rs index 66039ffa..00ad1769 100644 --- a/crates/consensus/src/hardforks/ecotone.rs +++ b/crates/consensus/src/hardforks/ecotone.rs @@ -6,7 +6,7 @@ use crate::{OpTxEnvelope, TxDeposit}; use alloc::{string::String, vec, vec::Vec}; use alloy_consensus::Sealable; use alloy_eips::eip2718::Encodable2718; -use alloy_primitives::{address, bytes, Address, Bytes, TxKind, U256}; +use alloy_primitives::{address, bytes, hex, Address, Bytes, TxKind, U256}; use spin::Lazy; use crate::UpgradeDepositSource; @@ -32,7 +32,7 @@ pub const NEW_L1_BLOCK_ADDRESS: Address = address!("07dbe8500fc591d1852b76fee44d pub const GAS_PRICE_ORACLE_ADDRESS: Address = address!("b528d11cc114e026f138fe568744c6d45ce6da7a"); /// The Enable Ecotone Input Method 4Byte Signature -pub const ENABLE_ECOTONE_INPUT: &[u8] = &[0x22, 0xb9, 0x08, 0xb3]; +pub const ENABLE_ECOTONE_INPUT: [u8; 4] = hex!("22b908b3"); /// EIP-4788 From Address pub const EIP4788_FROM: Address = address!("0B799C86a49DEeb90402691F1041aa3AF2d3C875"); diff --git a/crates/consensus/src/hardforks/fjord.rs b/crates/consensus/src/hardforks/fjord.rs index e85eba80..2b475190 100644 --- a/crates/consensus/src/hardforks/fjord.rs +++ b/crates/consensus/src/hardforks/fjord.rs @@ -6,7 +6,7 @@ use crate::{OpTxEnvelope, TxDeposit}; use alloc::{string::String, vec, vec::Vec}; use alloy_consensus::Sealable; use alloy_eips::eip2718::Encodable2718; -use alloy_primitives::{address, Address, Bytes, TxKind, U256}; +use alloy_primitives::{address, hex, Address, Bytes, TxKind, U256}; use spin::Lazy; use crate::UpgradeDepositSource; @@ -46,7 +46,7 @@ static ENABLE_FJORD_SOURCE: Lazy = Lazy::new(|| UpgradeDep pub const ENABLE_FJORD_FUNC_SIGNATURE: &str = "setFjord()"; /// The Set Fjord Four Byte Method Signature. -pub const SET_FJORD_METHOD_SIGNATURE: &[u8] = &[0x8e, 0x98, 0xb1, 0x06]; +pub const SET_FJORD_METHOD_SIGNATURE: [u8; 4] = hex!("8e98b106"); impl super::Hardforks { /// Returns the fjord gas price oracle deployment bytecode. diff --git a/crates/consensus/src/hardforks/mod.rs b/crates/consensus/src/hardforks/mod.rs index 8e71a59b..532f3170 100644 --- a/crates/consensus/src/hardforks/mod.rs +++ b/crates/consensus/src/hardforks/mod.rs @@ -4,7 +4,7 @@ pub mod ecotone; pub mod fjord; /// UpgradeTo Function 4Byte Signature -pub(crate) const UPGRADE_TO_FUNC_BYTES_4: &[u8] = &[0x36, 0x59, 0xcf, 0xe6]; +pub(crate) const UPGRADE_TO_FUNC_BYTES_4: [u8; 4] = alloy_primitives::hex!("3659cfe6"); /// Optimism Hardforks ///