Skip to content

Commit

Permalink
chore: bump alloy b63a2c7
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya committed Oct 17, 2024
1 parent 9fd8a65 commit 65254cf
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 33 deletions.
24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ tokio = "1"
c-kzg = { version = "1.0", default-features = false }
k256 = { version = "0.13", default-features = false, features = ["ecdsa"] }

#[patch.crates-io]
#alloy-consensus = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-network = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-network-primitives = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-eips = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-serde = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-signer = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-provider = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
#alloy-transport = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
[patch.crates-io]
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-network-primitives = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "b63a2c7" }
5 changes: 4 additions & 1 deletion crates/consensus/src/receipt/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ impl OpReceiptEnvelope {
}
}

impl<T> TxReceipt<T> for OpReceiptEnvelope<T> {
impl<T> TxReceipt<T> for OpReceiptEnvelope<T>
where
T: Clone + core::fmt::Debug + PartialEq + Eq + Send + Sync,
{
fn status_or_post_state(&self) -> Eip658Value {
self.as_receipt().unwrap().status
}
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/receipt/receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<T> AsRef<Receipt<T>> for OpDepositReceipt<T> {

impl<T> TxReceipt<T> for OpDepositReceipt<T>
where
T: Borrow<Log>,
T: Borrow<Log> + Clone + core::fmt::Debug + PartialEq + Eq + Send + Sync,
{
fn status_or_post_state(&self) -> Eip658Value {
self.inner.status_or_post_state()
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ mod tests {
assert_eq!(tx.mint(), Some(200));
assert!(!tx.is_system_transaction());
assert!(tx.is_deposit());
assert_eq!(tx.to(), TxKind::Call(contract_address));
assert_eq!(tx.kind(), TxKind::Call(contract_address));
}
}
8 changes: 6 additions & 2 deletions crates/consensus/src/transaction/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,19 @@ impl Transaction for TxDeposit {
0
}

fn to(&self) -> TxKind {
fn to(&self) -> Option<Address> {
self.to.into()
}

fn kind(&self) -> TxKind {
self.to
}

fn value(&self) -> U256 {
self.value
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
&self.input
}

Expand Down
16 changes: 13 additions & 3 deletions crates/consensus/src/transaction/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloy_eips::{
eip2930::AccessList,
eip7702::SignedAuthorization,
};
use alloy_primitives::{TxKind, B256, U256};
use alloy_primitives::{Address, Bytes, TxKind, B256, U256};
use alloy_rlp::{Decodable, Encodable, Header};
use derive_more::Display;

Expand Down Expand Up @@ -218,7 +218,7 @@ impl Transaction for OpTxEnvelope {
}
}

fn to(&self) -> TxKind {
fn to(&self) -> Option<Address> {
match self {
Self::Legacy(tx) => tx.tx().to(),
Self::Eip2930(tx) => tx.tx().to(),
Expand All @@ -228,6 +228,16 @@ impl Transaction for OpTxEnvelope {
}
}

fn kind(&self) -> TxKind {
match self {
Self::Legacy(tx) => tx.tx().kind(),
Self::Eip2930(tx) => tx.tx().kind(),
Self::Eip1559(tx) => tx.tx().kind(),
Self::Eip7702(tx) => tx.tx().kind(),
Self::Deposit(tx) => tx.kind(),
}
}

fn value(&self) -> U256 {
match self {
Self::Legacy(tx) => tx.tx().value(),
Expand All @@ -238,7 +248,7 @@ impl Transaction for OpTxEnvelope {
}
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
match self {
Self::Legacy(tx) => tx.tx().input(),
Self::Eip2930(tx) => tx.tx().input(),
Expand Down
16 changes: 13 additions & 3 deletions crates/consensus/src/transaction/typed.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{OpTxEnvelope, OpTxType, TxDeposit};
use alloy_consensus::{Transaction, TxEip1559, TxEip2930, TxEip7702, TxLegacy};
use alloy_eips::eip2930::AccessList;
use alloy_primitives::TxKind;
use alloy_primitives::{Address, Bytes, TxKind};

/// The TypedTransaction enum represents all Ethereum transaction request types, modified for the OP
/// Stack.
Expand Down Expand Up @@ -194,7 +194,7 @@ impl Transaction for OpTypedTransaction {
}
}

fn to(&self) -> TxKind {
fn to(&self) -> Option<Address> {
match self {
Self::Legacy(tx) => tx.to(),
Self::Eip2930(tx) => tx.to(),
Expand All @@ -204,6 +204,16 @@ impl Transaction for OpTypedTransaction {
}
}

fn kind(&self) -> TxKind {
match self {
Self::Legacy(tx) => tx.kind(),
Self::Eip2930(tx) => tx.kind(),
Self::Eip1559(tx) => tx.kind(),
Self::Eip7702(tx) => tx.kind(),
Self::Deposit(tx) => tx.kind(),
}
}

fn value(&self) -> alloy_primitives::U256 {
match self {
Self::Legacy(tx) => tx.value(),
Expand All @@ -214,7 +224,7 @@ impl Transaction for OpTypedTransaction {
}
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
match self {
Self::Legacy(tx) => tx.input(),
Self::Eip2930(tx) => tx.input(),
Expand Down
17 changes: 7 additions & 10 deletions crates/rpc-types/src/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! Optimism specific types related to transactions.

use alloy_eips::{eip2930::AccessList, eip7702::SignedAuthorization};
use alloy_primitives::{BlockHash, ChainId, TxKind, B256, U256};
use alloy_rpc_types_eth::Signature;
use alloy_primitives::{Address, BlockHash, Bytes, ChainId, TxKind, B256, U256};
use alloy_serde::OtherFields;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -62,15 +61,19 @@ impl alloy_consensus::Transaction for Transaction {
self.inner.priority_fee_or_price()
}

fn to(&self) -> TxKind {
fn to(&self) -> Option<Address> {
self.inner.to()
}

fn kind(&self) -> TxKind {
self.inner.kind()
}

fn value(&self) -> U256 {
self.inner.value()
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
self.inner.input()
}

Expand All @@ -92,8 +95,6 @@ impl alloy_consensus::Transaction for Transaction {
}

impl alloy_network_primitives::TransactionResponse for Transaction {
type Signature = Signature;

fn tx_hash(&self) -> alloy_primitives::TxHash {
self.inner.tx_hash()
}
Expand All @@ -117,10 +118,6 @@ impl alloy_network_primitives::TransactionResponse for Transaction {
fn to(&self) -> Option<alloy_primitives::Address> {
self.inner.to()
}

fn signature(&self) -> Option<Self::Signature> {
self.inner.signature()
}
}

/// Optimism specific transaction fields
Expand Down

0 comments on commit 65254cf

Please sign in to comment.