Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace anvil OP types with op-alloy #8595

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
1 change: 0 additions & 1 deletion crates/anvil/core/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pub fn transaction_request_to_typed(
other,
} = tx;

// Special case: OP-stack deposit tx
if transaction_type == Some(0x7E) || has_optimism_fields(&other) {
return Some(TypedTransactionRequest::Deposit(DepositTransactionRequest {
from: from.unwrap_or_default(),
Expand Down
9 changes: 6 additions & 3 deletions crates/anvil/core/src/eth/transaction/optimism.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
use alloy_consensus::{SignableTransaction, Signed, Transaction};
use alloy_primitives::{keccak256, Address, Bytes, ChainId, Signature, TxKind, B256, U256};
use alloy_rlp::{
length_of_length, Decodable, Encodable, Error as DecodeError, Header as RlpHeader,
length_of_length, BufMut, Decodable, Encodable, Error as DecodeError, Header as RlpHeader,
};
use bytes::BufMut;
use serde::{Deserialize, Serialize};
use std::mem;

pub const DEPOSIT_TX_TYPE_ID: u8 = 0x7E;

#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
pub struct DepositTransactionRequest {
programskillforverification marked this conversation as resolved.
Show resolved Hide resolved
pub source_hash: B256,
pub from: Address,
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "TxKind::is_create"))]
pub kind: TxKind,
pub mint: U256,
pub value: U256,
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))]
pub gas_limit: u128,
pub is_system_tx: bool,
pub input: Bytes,
Expand Down Expand Up @@ -234,7 +237,7 @@ impl Encodable for DepositTransactionRequest {
}

/// An op-stack deposit transaction.
/// See <https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md#the-deposited-transaction-type>
/// See <https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/deposits.md>
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct DepositTransaction {
pub nonce: u64,
Expand Down
Loading