mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(ci): add missing const fn (#8822)
This commit is contained in:
@ -12,7 +12,7 @@ pub(crate) struct CanonicalChain {
|
||||
}
|
||||
|
||||
impl CanonicalChain {
|
||||
pub(crate) fn new(chain: BTreeMap<BlockNumber, BlockHash>) -> Self {
|
||||
pub(crate) const fn new(chain: BTreeMap<BlockNumber, BlockHash>) -> Self {
|
||||
Self { chain }
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ pub struct NoopBlockchainTree {
|
||||
|
||||
impl NoopBlockchainTree {
|
||||
/// Create a new `NoopBlockchainTree` with a canon state notification sender.
|
||||
pub fn with_canon_state_notifications(
|
||||
pub const fn with_canon_state_notifications(
|
||||
canon_state_notification_sender: CanonStateNotificationSender,
|
||||
) -> Self {
|
||||
Self { canon_state_notification_sender: Some(canon_state_notification_sender) }
|
||||
|
||||
@ -56,7 +56,7 @@ pub struct AutoSealConsensus {
|
||||
|
||||
impl AutoSealConsensus {
|
||||
/// Create a new instance of [`AutoSealConsensus`]
|
||||
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
pub const fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self { chain_spec }
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ impl OnForkChoiceUpdated {
|
||||
}
|
||||
|
||||
/// If the forkchoice update was successful and no payload attributes were provided, this method
|
||||
pub(crate) fn updated_with_pending_payload_id(
|
||||
pub(crate) const fn updated_with_pending_payload_id(
|
||||
payload_status: PayloadStatus,
|
||||
pending_payload_id: oneshot::Receiver<Result<PayloadId, PayloadBuilderError>>,
|
||||
) -> Self {
|
||||
|
||||
@ -438,7 +438,7 @@ mod tests {
|
||||
|
||||
impl TestPipelineBuilder {
|
||||
/// Create a new [`TestPipelineBuilder`].
|
||||
fn new() -> Self {
|
||||
const fn new() -> Self {
|
||||
Self {
|
||||
pipeline_exec_outputs: VecDeque::new(),
|
||||
executor_results: Vec::new(),
|
||||
|
||||
@ -57,7 +57,7 @@ pub struct TestEnv<DB> {
|
||||
}
|
||||
|
||||
impl<DB> TestEnv<DB> {
|
||||
fn new(
|
||||
const fn new(
|
||||
db: DB,
|
||||
tip_rx: watch::Receiver<B256>,
|
||||
engine_handle: BeaconConsensusEngineHandle<EthEngineTypes>,
|
||||
|
||||
@ -32,7 +32,7 @@ pub struct EthBeaconConsensus {
|
||||
|
||||
impl EthBeaconConsensus {
|
||||
/// Create a new instance of [`EthBeaconConsensus`]
|
||||
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
pub const fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self { chain_spec }
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ pub struct EthBuiltPayload {
|
||||
|
||||
impl EthBuiltPayload {
|
||||
/// Initializes the payload with the given initial block.
|
||||
pub fn new(id: PayloadId, block: SealedBlock, fees: U256) -> Self {
|
||||
pub const fn new(id: PayloadId, block: SealedBlock, fees: U256) -> Self {
|
||||
Self { id, block, fees, sidecars: Vec::new() }
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ impl EthExecutorProvider {
|
||||
|
||||
impl<EvmConfig> EthExecutorProvider<EvmConfig> {
|
||||
/// Creates a new executor provider.
|
||||
pub fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig) -> Self {
|
||||
pub const fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig) -> Self {
|
||||
Self { chain_spec, evm_config }
|
||||
}
|
||||
}
|
||||
@ -236,7 +236,7 @@ pub struct EthBlockExecutor<EvmConfig, DB> {
|
||||
|
||||
impl<EvmConfig, DB> EthBlockExecutor<EvmConfig, DB> {
|
||||
/// Creates a new Ethereum block executor.
|
||||
pub fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig, state: State<DB>) -> Self {
|
||||
pub const fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig, state: State<DB>) -> Self {
|
||||
Self { executor: EthEvmExecutor { chain_spec, evm_config }, state }
|
||||
}
|
||||
|
||||
|
||||
@ -1152,7 +1152,7 @@ pub struct GetPooledTxRequestFut {
|
||||
|
||||
impl GetPooledTxRequestFut {
|
||||
#[inline]
|
||||
fn new(
|
||||
const fn new(
|
||||
peer_id: PeerId,
|
||||
requested_hashes: RequestTxHashes,
|
||||
response: oneshot::Receiver<RequestResult<PooledTransactions>>,
|
||||
|
||||
@ -38,7 +38,7 @@ pub struct TestHeaderDownloader {
|
||||
|
||||
impl TestHeaderDownloader {
|
||||
/// Instantiates the downloader with the mock responses
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
client: TestHeadersClient,
|
||||
consensus: Arc<TestConsensus>,
|
||||
limit: u64,
|
||||
|
||||
@ -205,7 +205,7 @@ impl NetworkArgs {
|
||||
|
||||
/// Sets the p2p and discovery ports to zero, allowing the OD to assign a random unused port
|
||||
/// when network components bind to sockets.
|
||||
pub fn with_unused_ports(mut self) -> Self {
|
||||
pub const fn with_unused_ports(mut self) -> Self {
|
||||
self = self.with_unused_p2p_port();
|
||||
self.discovery = self.discovery.with_unused_discovery_port();
|
||||
self
|
||||
|
||||
@ -129,7 +129,7 @@ pub struct EngineStoreStream<S> {
|
||||
|
||||
impl<S> EngineStoreStream<S> {
|
||||
/// Create new engine store stream wrapper.
|
||||
pub fn new(stream: S, path: PathBuf) -> Self {
|
||||
pub const fn new(stream: S, path: PathBuf) -> Self {
|
||||
Self { stream, store: EngineMessageStore::new(path) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ pub struct NodeExitFuture {
|
||||
|
||||
impl NodeExitFuture {
|
||||
/// Create a new `NodeExitFuture`.
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
consensus_engine_rx: oneshot::Receiver<Result<(), BeaconConsensusEngineError>>,
|
||||
terminate: bool,
|
||||
) -> Self {
|
||||
|
||||
@ -31,7 +31,7 @@ pub struct NodeBuilderWithTypes<T: FullNodeTypes> {
|
||||
|
||||
impl<T: FullNodeTypes> NodeBuilderWithTypes<T> {
|
||||
/// Creates a new instance of the node builder with the given configuration and types.
|
||||
pub fn new(config: NodeConfig, database: T::DB) -> Self {
|
||||
pub const fn new(config: NodeConfig, database: T::DB) -> Self {
|
||||
Self { config, adapter: NodeTypesAdapter::new(database) }
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ impl OpExecutorProvider {
|
||||
|
||||
impl<EvmConfig> OpExecutorProvider<EvmConfig> {
|
||||
/// Creates a new executor provider.
|
||||
pub fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig) -> Self {
|
||||
pub const fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig) -> Self {
|
||||
Self { chain_spec, evm_config }
|
||||
}
|
||||
}
|
||||
@ -236,7 +236,7 @@ pub struct OpBlockExecutor<EvmConfig, DB> {
|
||||
|
||||
impl<EvmConfig, DB> OpBlockExecutor<EvmConfig, DB> {
|
||||
/// Creates a new Ethereum block executor.
|
||||
pub fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig, state: State<DB>) -> Self {
|
||||
pub const fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig, state: State<DB>) -> Self {
|
||||
Self { executor: OpEvmExecutor { chain_spec, evm_config }, state }
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ pub struct OptimismBuiltPayload {
|
||||
|
||||
impl OptimismBuiltPayload {
|
||||
/// Initializes the payload with the given initial block.
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
id: PayloadId,
|
||||
block: SealedBlock,
|
||||
fees: U256,
|
||||
|
||||
@ -636,7 +636,7 @@ pub struct PendingPayload<P> {
|
||||
|
||||
impl<P> PendingPayload<P> {
|
||||
/// Constructs a `PendingPayload` future.
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
cancel: Cancelled,
|
||||
payload: oneshot::Receiver<Result<BuildOutcome<P>, PayloadBuilderError>>,
|
||||
) -> Self {
|
||||
@ -773,7 +773,7 @@ pub struct BuildArguments<Pool, Client, Attributes, Payload> {
|
||||
|
||||
impl<Pool, Client, Attributes, Payload> BuildArguments<Pool, Client, Attributes, Payload> {
|
||||
/// Create new build arguments.
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
client: Client,
|
||||
pool: Pool,
|
||||
cached_reads: CachedReads,
|
||||
|
||||
@ -22,7 +22,7 @@ pub struct ExecutionPayloadValidator {
|
||||
|
||||
impl ExecutionPayloadValidator {
|
||||
/// Create a new validator.
|
||||
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
pub const fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self { chain_spec }
|
||||
}
|
||||
|
||||
|
||||
@ -633,7 +633,7 @@ impl From<Block> for BlockBody {
|
||||
/// This __does not, and should not guarantee__ that the header is valid with respect to __anything
|
||||
/// else__.
|
||||
#[cfg(any(test, feature = "arbitrary"))]
|
||||
pub fn generate_valid_header(
|
||||
pub const fn generate_valid_header(
|
||||
mut header: Header,
|
||||
eip_4844_active: bool,
|
||||
blob_gas_used: u64,
|
||||
|
||||
@ -15,7 +15,7 @@ pub struct Withdrawals(Vec<Withdrawal>);
|
||||
|
||||
impl Withdrawals {
|
||||
/// Create a new Withdrawals instance.
|
||||
pub fn new(withdrawals: Vec<Withdrawal>) -> Self {
|
||||
pub const fn new(withdrawals: Vec<Withdrawal>) -> Self {
|
||||
Self(withdrawals)
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ use tokio::sync::watch;
|
||||
pub(crate) struct StopHandle(watch::Receiver<()>);
|
||||
|
||||
impl StopHandle {
|
||||
pub(crate) fn new(rx: watch::Receiver<()>) -> Self {
|
||||
pub(crate) const fn new(rx: watch::Receiver<()>) -> Self {
|
||||
Self(rx)
|
||||
}
|
||||
|
||||
|
||||
@ -400,7 +400,7 @@ pub struct SimBundleLogs {
|
||||
|
||||
impl SendBundleRequest {
|
||||
/// Create a new bundle request.
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
block_num: u64,
|
||||
max_block: Option<u64>,
|
||||
protocol_version: ProtocolVersion,
|
||||
|
||||
@ -24,7 +24,7 @@ pub struct AdminApi<N> {
|
||||
|
||||
impl<N> AdminApi<N> {
|
||||
/// Creates a new instance of `AdminApi`.
|
||||
pub fn new(network: N, chain_spec: Arc<ChainSpec>) -> Self {
|
||||
pub const fn new(network: N, chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self { network, chain_spec }
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ pub struct TestStage {
|
||||
}
|
||||
|
||||
impl TestStage {
|
||||
pub fn new(id: StageId) -> Self {
|
||||
pub const fn new(id: StageId) -> Self {
|
||||
Self { id, exec_outputs: VecDeque::new(), unwind_outputs: VecDeque::new() }
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ pub struct TestStages {
|
||||
}
|
||||
|
||||
impl TestStages {
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
exec_outputs: VecDeque<Result<ExecOutput, StageError>>,
|
||||
unwind_outputs: VecDeque<Result<UnwindOutput, StageError>>,
|
||||
) -> Self {
|
||||
|
||||
@ -21,7 +21,7 @@ pub struct MerkleCheckpoint {
|
||||
|
||||
impl MerkleCheckpoint {
|
||||
/// Creates a new Merkle checkpoint.
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
target_block: BlockNumber,
|
||||
last_account_key: B256,
|
||||
walker_stack: Vec<StoredSubNode>,
|
||||
|
||||
@ -36,7 +36,7 @@ pub struct Cursor<K: TransactionKind, T: Table> {
|
||||
}
|
||||
|
||||
impl<K: TransactionKind, T: Table> Cursor<K, T> {
|
||||
pub(crate) fn new_with_metrics(
|
||||
pub(crate) const fn new_with_metrics(
|
||||
inner: reth_libmdbx::Cursor<K>,
|
||||
metrics: Option<Arc<DatabaseEnvMetrics>>,
|
||||
) -> Self {
|
||||
|
||||
@ -53,7 +53,7 @@ impl<K: Key> RawKey<K> {
|
||||
|
||||
/// Creates a raw key from an existing `Vec`. Useful when we already have the encoded
|
||||
/// key.
|
||||
pub fn from_vec(vec: Vec<u8>) -> Self {
|
||||
pub const fn from_vec(vec: Vec<u8>) -> Self {
|
||||
Self { key: vec, _phantom: std::marker::PhantomData }
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ impl<V: Value> RawValue<V> {
|
||||
|
||||
/// Creates a raw value from an existing `Vec`. Useful when we already have the encoded
|
||||
/// value.
|
||||
pub fn from_vec(vec: Vec<u8>) -> Self {
|
||||
pub const fn from_vec(vec: Vec<u8>) -> Self {
|
||||
Self { value: vec, _phantom: std::marker::PhantomData }
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ impl<TX> DatabaseProvider<TX> {
|
||||
|
||||
impl<TX: DbTxMut> DatabaseProvider<TX> {
|
||||
/// Creates a provider with an inner read-write transaction.
|
||||
pub fn new_rw(
|
||||
pub const fn new_rw(
|
||||
tx: TX,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
static_file_provider: StaticFileProvider,
|
||||
@ -252,7 +252,7 @@ where
|
||||
|
||||
impl<TX: DbTx> DatabaseProvider<TX> {
|
||||
/// Creates a provider with an inner read-only transaction.
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
tx: TX,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
static_file_provider: StaticFileProvider,
|
||||
|
||||
@ -20,7 +20,7 @@ pub struct GracefulShutdown {
|
||||
}
|
||||
|
||||
impl GracefulShutdown {
|
||||
pub(crate) fn new(shutdown: Shutdown, guard: GracefulShutdownGuard) -> Self {
|
||||
pub(crate) const fn new(shutdown: Shutdown, guard: GracefulShutdownGuard) -> Self {
|
||||
Self { shutdown, guard: Some(guard) }
|
||||
}
|
||||
|
||||
|
||||
@ -225,13 +225,13 @@ impl TransactionBuilder {
|
||||
}
|
||||
|
||||
/// Increments the nonce value of the transaction builder by 1.
|
||||
pub fn inc_nonce(mut self) -> Self {
|
||||
pub const fn inc_nonce(mut self) -> Self {
|
||||
self.nonce += 1;
|
||||
self
|
||||
}
|
||||
|
||||
/// Decrements the nonce value of the transaction builder by 1, avoiding underflow.
|
||||
pub fn decr_nonce(mut self) -> Self {
|
||||
pub const fn decr_nonce(mut self) -> Self {
|
||||
self.nonce = self.nonce.saturating_sub(1);
|
||||
self
|
||||
}
|
||||
|
||||
@ -1447,7 +1447,7 @@ pub struct MockTransactionSet {
|
||||
|
||||
impl MockTransactionSet {
|
||||
/// Create a new [`MockTransactionSet`] from a list of transactions
|
||||
fn new(transactions: Vec<MockTransaction>) -> Self {
|
||||
const fn new(transactions: Vec<MockTransaction>) -> Self {
|
||||
Self { transactions }
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ pub struct AccountProof {
|
||||
|
||||
impl AccountProof {
|
||||
/// Create new account proof entity.
|
||||
pub fn new(address: Address) -> Self {
|
||||
pub const fn new(address: Address) -> Self {
|
||||
Self {
|
||||
address,
|
||||
info: None,
|
||||
|
||||
Reference in New Issue
Block a user