Skip to content

Commit 115d5fe

Browse files
committed
cleanup
1 parent 7b0065b commit 115d5fe

File tree

2 files changed

+60
-41
lines changed

2 files changed

+60
-41
lines changed

crates/primitives/src/env.rs

+60-29
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ impl Env {
256256
}
257257
}
258258

259+
259260
/// EVM configuration.
260261
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
261262
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -464,18 +465,6 @@ pub struct BlockEnv {
464465
pub blob_excess_gas_and_price: Option<BlobExcessGasAndPrice>,
465466
}
466467

467-
/// Structure holding block blob excess gas and it calculates blob fee.
468-
///
469-
/// Incorporated as part of the Cancun upgrade via [EIP-4844].
470-
///
471-
/// [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
472-
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
473-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
474-
pub struct BlobExcessGasAndPrice {
475-
pub excess_blob_gas: u64,
476-
pub blob_gasprice: u128,
477-
}
478-
479468
impl BlobExcessGasAndPrice {
480469
/// Takes excess blob gas and calculated blob fee with [`calc_blob_fee`]
481470
pub fn new(excess_blob_gas: u64) -> Self {
@@ -487,23 +476,6 @@ impl BlobExcessGasAndPrice {
487476
}
488477
}
489478

490-
#[cfg(all(feature = "optimism", not(feature = "taiko")))]
491-
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
492-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
493-
pub struct OptimismFields {
494-
pub source_hash: Option<B256>,
495-
pub mint: Option<u128>,
496-
pub is_system_transaction: Option<bool>,
497-
/// An enveloped EIP-2718 typed transaction. This is used
498-
/// to compute the L1 tx cost using the L1 block info, as
499-
/// opposed to requiring downstream apps to compute the cost
500-
/// externally.
501-
/// This field is optional to allow the [TxEnv] to be constructed
502-
/// for non-optimism chains when the `optimism` feature is enabled,
503-
/// but the [CfgEnv] `optimism` field is set to false.
504-
pub enveloped_tx: Option<Bytes>,
505-
}
506-
507479
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
508480
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
509481
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -644,6 +616,65 @@ impl TxEnv {
644616
}
645617
}
646618

619+
/// Structure holding block blob excess gas and it calculates blob fee.
620+
///
621+
/// Incorporated as part of the Cancun upgrade via [EIP-4844].
622+
///
623+
/// [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
624+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
625+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
626+
pub struct BlobExcessGasAndPrice {
627+
/// The excess blob gas of the block.
628+
pub excess_blob_gas: u64,
629+
/// The calculated blob gas price based on the `excess_blob_gas`, See [calc_blob_gasprice]
630+
pub blob_gasprice: u128,
631+
}
632+
633+
impl BlobExcessGasAndPrice {
634+
/// Creates a new instance by calculating the blob gas price with [`calc_blob_gasprice`].
635+
pub fn new(excess_blob_gas: u64) -> Self {
636+
let blob_gasprice = calc_blob_gasprice(excess_blob_gas);
637+
Self {
638+
excess_blob_gas,
639+
blob_gasprice,
640+
}
641+
}
642+
}
643+
644+
/// Additional [TxEnv] fields for optimism.
645+
#[cfg(feature = "optimism")]
646+
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
647+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
648+
pub struct OptimismFields {
649+
/// The source hash is used to make sure that deposit transactions do
650+
/// not have identical hashes.
651+
///
652+
/// L1 originated deposit transaction source hashes are computed using
653+
/// the hash of the l1 block hash and the l1 log index.
654+
/// L1 attributes deposit source hashes are computed with the l1 block
655+
/// hash and the sequence number = l2 block number - l2 epoch start
656+
/// block number.
657+
///
658+
/// These two deposit transaction sources specify a domain in the outer
659+
/// hash so there are no collisions.
660+
pub source_hash: Option<B256>,
661+
/// The amount to increase the balance of the `from` account as part of
662+
/// a deposit transaction. This is unconditional and is applied to the
663+
/// `from` account even if the deposit transaction fails since
664+
/// the deposit is pre-paid on L1.
665+
pub mint: Option<u128>,
666+
/// Whether or not the transaction is a system transaction.
667+
pub is_system_transaction: Option<bool>,
668+
/// An enveloped EIP-2718 typed transaction. This is used
669+
/// to compute the L1 tx cost using the L1 block info, as
670+
/// opposed to requiring downstream apps to compute the cost
671+
/// externally.
672+
/// This field is optional to allow the [TxEnv] to be constructed
673+
/// for non-optimism chains when the `optimism` feature is enabled,
674+
/// but the [CfgEnv] `optimism` field is set to false.
675+
pub enveloped_tx: Option<Bytes>,
676+
}
677+
647678
impl Default for TxEnv {
648679
fn default() -> Self {
649680
Self {

crates/revm/src/handler.rs

-12
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ impl<'a, H: Host, EXT: 'a, DB: Database + 'a> Handler<'a, H, EXT, DB> {
5151
}
5252
}
5353

54-
/// Handler for the taiko
55-
// #[cfg(all(feature = "taiko", not(feature = "optimism")))]
56-
// pub fn taiko<SPEC: Spec>() -> Self {
57-
// use crate::taiko::handler;
58-
// Self {
59-
// call_return: mainnet::handle_call_return::<SPEC>,
60-
// calculate_gas_refund: mainnet::calculate_gas_refund::<SPEC>,
61-
// reimburse_caller: handler::handle_reimburse_caller::<SPEC, DB>,
62-
// reward_beneficiary: handler::reward_beneficiary::<SPEC, DB>,
63-
// }
64-
// }
65-
6654
/// Creates handler with variable spec id, inside it will call `mainnet::<SPEC>` for
6755
/// appropriate spec.
6856
pub fn mainnet_with_spec(spec_id: SpecId) -> Self {

0 commit comments

Comments
 (0)