Skip to content

dep: bump alloy to 0.3.6 #55

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

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trevm"
version = "0.10.1"
version = "0.11.0"
rust-version = "1.79.0"
edition = "2021"
authors = ["init4"]
Expand Down Expand Up @@ -30,14 +30,11 @@ redundant-clone = "warn"
alloy-primitives = "0.8"
alloy-sol-types = "0.8"

alloy-consensus = { version = "0.3", features = ["k256"] }
alloy-eips = "0.3"
alloy-rpc-types-eth = "0.3"
alloy-rpc-types-mev = "0.3"
alloy = { version = "=0.3.6", features = ["rpc-types-mev"] }

revm = { version = "14.0.0", default-features = false, features = ["std"] }

zenith-types = "0.7"
zenith-types = "0.8"

thiserror = "1.0"
alloy-rlp = "0.3"
Expand All @@ -46,13 +43,6 @@ alloy-rlp = "0.3"
revm = { version = "14.0.0", features = ["test-utils", "serde-json", "std", "alloydb"] }
tokio = { version = "1.39", features = ["macros", "rt-multi-thread"] }

# alloydb
alloy-provider = "0.3"
alloy-transport = "0.3"

alloy-signer = { version = "0.3", default-features = false }
alloy-signer-local = { version = "0.3", default-features = false }

alloy-rlp = { version = "0.3", default-features = false }

serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
Expand Down
14 changes: 8 additions & 6 deletions examples/basic_transact.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
//! Simple TREVM example that demonstrates how to execute a transaction on a contract.
//! It simply loads the contract bytecode and executes a transaction.

use revm::{
inspector_handle_register,
inspectors::TracerEip3155,
primitives::{hex, AccountInfo, Address, Bytecode, TransactTo, U256},
EvmBuilder, InMemoryDB,
use trevm::{
revm::{
inspector_handle_register,
inspectors::TracerEip3155,
primitives::{hex, AccountInfo, Address, Bytecode, TransactTo, U256},
EvmBuilder, InMemoryDB,
},
trevm_aliases, NoopBlock, NoopCfg, TrevmBuilder, Tx,
};
use trevm::{trevm_aliases, NoopBlock, NoopCfg, TrevmBuilder, Tx};

/// Foundry's default Counter.sol contract bytecode.
const CONTRACT_BYTECODE: &str = "0x6080604052348015600f57600080fd5b5060043610603c5760003560e01c80633fb5c1cb1460415780638381f58a146053578063d09de08a14606d575b600080fd5b6051604c3660046083565b600055565b005b605b60005481565b60405190815260200160405180910390f35b6051600080549080607c83609b565b9190505550565b600060208284031215609457600080fd5b5035919050565b60006001820160ba57634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220091e48831e9eee32d4571d6291233a4fdaaa34b7dced8770f36f5368be825c5264736f6c63430008190033";
Expand Down
19 changes: 9 additions & 10 deletions examples/fork_ref_transact.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
//! This example demonstrates how to query storage slots of a contract, using AlloyDB.

use alloy_eips::BlockId;
use alloy_primitives::Address;
use alloy_provider::ProviderBuilder;
use alloy_sol_types::sol;
use alloy_sol_types::SolCall;
use revm::{
db::{AlloyDB, CacheDB},
primitives::{address, TxKind, U256},
Evm,
use alloy::{eips::BlockId, providers::ProviderBuilder};
use alloy_primitives::{address, Address, TxKind, U256};
use alloy_sol_types::{sol, SolCall};
use trevm::{
revm::{
db::{AlloyDB, CacheDB},
Evm,
},
NoopBlock, NoopCfg, TrevmBuilder, Tx,
};
use trevm::{NoopBlock, NoopCfg, TrevmBuilder, Tx};

sol! {
#[allow(missing_docs)]
Expand Down
16 changes: 9 additions & 7 deletions src/driver/alloy.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use crate::{
trevm_bail, trevm_ensure, unwrap_or_trevm_err, Block, BundleDriver, DriveBundleResult,
};
use alloy_consensus::{Transaction, TxEip4844Variant, TxEnvelope};
use alloy_eips::{eip2718::Decodable2718, BlockNumberOrTag};
use alloy_primitives::{bytes::Buf, keccak256, Address, Bytes, TxKind, U256};
use alloy_rpc_types_mev::{
EthBundleHash, EthCallBundle, EthCallBundleResponse, EthCallBundleTransactionResult,
EthSendBundle,
use alloy::{
consensus::{Transaction, TxEip4844Variant, TxEnvelope},
eips::{eip2718::Decodable2718, BlockNumberOrTag},
rpc::types::mev::{
EthBundleHash, EthCallBundle, EthCallBundleResponse, EthCallBundleTransactionResult,
EthSendBundle,
},
};
use alloy_primitives::{bytes::Buf, keccak256, Address, Bytes, TxKind, U256};
use revm::primitives::{EVMError, ExecutionResult, MAX_BLOB_GAS_PER_BLOCK};
use thiserror::Error;

Expand All @@ -34,7 +36,7 @@ pub enum BundleError<Db: revm::Database> {
UnsupportedTransactionType,
/// An error occurred while decoding a transaction contained in the bundle.
#[error("transaction decoding error")]
TransactionDecodingError(#[from] alloy_eips::eip2718::Eip2718Error),
TransactionDecodingError(#[from] alloy::eips::eip2718::Eip2718Error),
/// An error ocurred while recovering the sender of a transaction
#[error("transaction sender recovery error")]
TransactionSenderRecoveryError(#[from] alloy_primitives::SignatureError),
Expand Down
28 changes: 14 additions & 14 deletions src/fill/alloy.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use alloy_consensus::Signed;
use alloy::consensus::Signed;
use alloy_primitives::U256;
use revm::primitives::{BlobExcessGasAndPrice, BlockEnv, TxEnv};

use crate::{Block, Tx};

impl Tx for Signed<alloy_consensus::TxLegacy> {
impl Tx for Signed<alloy::consensus::TxLegacy> {
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
let TxEnv {
caller,
Expand Down Expand Up @@ -37,7 +37,7 @@ impl Tx for Signed<alloy_consensus::TxLegacy> {
}
}

impl Tx for Signed<alloy_consensus::TxEip2930> {
impl Tx for Signed<alloy::consensus::TxEip2930> {
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
let TxEnv {
caller,
Expand Down Expand Up @@ -70,7 +70,7 @@ impl Tx for Signed<alloy_consensus::TxEip2930> {
}
}

impl Tx for Signed<alloy_consensus::TxEip1559> {
impl Tx for Signed<alloy::consensus::TxEip1559> {
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
let TxEnv {
caller,
Expand Down Expand Up @@ -103,7 +103,7 @@ impl Tx for Signed<alloy_consensus::TxEip1559> {
}
}

impl Tx for Signed<alloy_consensus::TxEip4844> {
impl Tx for Signed<alloy::consensus::TxEip4844> {
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
let TxEnv {
caller,
Expand Down Expand Up @@ -136,7 +136,7 @@ impl Tx for Signed<alloy_consensus::TxEip4844> {
}
}

impl Tx for Signed<alloy_consensus::TxEip4844WithSidecar> {
impl Tx for Signed<alloy::consensus::TxEip4844WithSidecar> {
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
let TxEnv {
caller,
Expand Down Expand Up @@ -169,7 +169,7 @@ impl Tx for Signed<alloy_consensus::TxEip4844WithSidecar> {
}
}

impl Tx for Signed<alloy_consensus::TxEip4844Variant> {
impl Tx for Signed<alloy::consensus::TxEip4844Variant> {
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
let TxEnv {
caller,
Expand All @@ -187,8 +187,8 @@ impl Tx for Signed<alloy_consensus::TxEip4844Variant> {
authorization_list,
} = tx_env;
let tx = match self.tx() {
alloy_consensus::TxEip4844Variant::TxEip4844(tx) => tx,
alloy_consensus::TxEip4844Variant::TxEip4844WithSidecar(tx) => &tx.tx,
alloy::consensus::TxEip4844Variant::TxEip4844(tx) => tx,
alloy::consensus::TxEip4844Variant::TxEip4844WithSidecar(tx) => &tx.tx,
};
*caller = self.recover_signer().unwrap();
*gas_limit = tx.gas_limit as u64;
Expand All @@ -206,7 +206,7 @@ impl Tx for Signed<alloy_consensus::TxEip4844Variant> {
}
}

impl Tx for alloy_consensus::TxEnvelope {
impl Tx for alloy::consensus::TxEnvelope {
fn fill_tx_env(&self, tx_env: &mut revm::primitives::TxEnv) {
match self {
Self::Legacy(t) => t.fill_tx_env(tx_env),
Expand All @@ -218,7 +218,7 @@ impl Tx for alloy_consensus::TxEnvelope {
}
}

impl Block for alloy_consensus::Header {
impl Block for alloy::consensus::Header {
fn fill_block_env(&self, block_env: &mut revm::primitives::BlockEnv) {
let BlockEnv {
number,
Expand Down Expand Up @@ -249,7 +249,7 @@ impl Block for alloy_consensus::Header {
}
}

impl Block for alloy_rpc_types_eth::Header {
impl Block for alloy::rpc::types::eth::Header {
fn fill_block_env(&self, block_env: &mut revm::primitives::BlockEnv) {
let BlockEnv {
number,
Expand All @@ -273,7 +273,7 @@ impl Block for alloy_rpc_types_eth::Header {
}
}

impl<T> Block for alloy_rpc_types_eth::Block<T> {
impl<T> Block for alloy::rpc::types::eth::Block<T> {
fn fill_block_env(&self, block_env: &mut revm::primitives::BlockEnv) {
self.header.fill_block_env(block_env);
}
Expand All @@ -286,7 +286,7 @@ impl<T> Block for alloy_rpc_types_eth::Block<T> {
#[cfg(test)]
mod tests {
use crate::{NoopBlock, NoopCfg, TrevmBuilder};
use alloy_consensus::{Header, TxEnvelope, EMPTY_ROOT_HASH};
use alloy::consensus::{Header, TxEnvelope, EMPTY_ROOT_HASH};

use alloy_rlp::Decodable;

Expand Down
2 changes: 1 addition & 1 deletion src/fill/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub trait Cfg {

#[cfg(test)]
mod test {
use alloy_consensus::constants::GWEI_TO_WEI;
use alloy::consensus::constants::GWEI_TO_WEI;
use alloy_primitives::{B256, U256};
use revm::primitives::{BlobExcessGasAndPrice, BlockEnv, CfgEnv};

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@
//! [`eip6110`]: crate::system::eip6110
//! [`eip7002`]: crate::system::eip7002
//! [`eip7251`]: crate::system::eip7251
//! [`WithdrawalRequest`]: alloy_eips::eip7002::WithdrawalRequest
//! [`ConsolidationRequest`]: alloy_eips::eip7251::ConsolidationRequest
//! [`WithdrawalRequest`]: alloy::eips::eip7002::WithdrawalRequest
//! [`ConsolidationRequest`]: alloy::eips::eip7251::ConsolidationRequest

#![doc(
html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
Expand Down
6 changes: 4 additions & 2 deletions src/lifecycle/output.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use alloy_consensus::{ReceiptEnvelope, TxReceipt};
use alloy_eips::eip6110::DepositRequest;
use alloy::{
consensus::{ReceiptEnvelope, TxReceipt},
eips::eip6110::DepositRequest,
};
use alloy_primitives::{Address, Bloom, Log};
use std::sync::OnceLock;

Expand Down
4 changes: 2 additions & 2 deletions src/lifecycle/receipt.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use alloy_consensus::{Receipt, ReceiptWithBloom};
use alloy::consensus::{Receipt, ReceiptWithBloom};
use revm::primitives::ExecutionResult;

/// Create an Ethereum [`ReceiptEnvelope`] from an execution result.
///
/// [`ReceiptEnvelope`]: alloy_consensus::ReceiptEnvelope
/// [`ReceiptEnvelope`]: alloy::consensus::ReceiptEnvelope
pub fn ethereum_receipt(result: ExecutionResult, prior_gas_used: u128) -> ReceiptWithBloom {
let cumulative_gas_used = prior_gas_used.saturating_add(result.gas_used() as u128);

Expand Down
2 changes: 1 addition & 1 deletion src/system/eip2935.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use revm::{
Database, DatabaseCommit,
};

pub use alloy_eips::eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE};
pub use alloy::eips::eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE};

use super::checked_insert_code;

Expand Down
2 changes: 1 addition & 1 deletion src/system/eip4788.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use revm::{
/// The number of beacon roots to store in the beacon roots contract.
pub const HISTORY_BUFFER_LENGTH: u64 = 8191;

pub use alloy_eips::eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE};
pub use alloy::eips::eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE};

impl SystemTx {
/// Instantiate a system call for the pre-block beacon roots as specified in
Expand Down
4 changes: 2 additions & 2 deletions src/system/eip4895.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{EvmExtUnchecked, EvmNeedsTx};
use alloy_eips::eip4895::Withdrawal;
use alloy::eips::eip4895::Withdrawal;
use alloy_primitives::U256;
use revm::{primitives::EVMError, Database, DatabaseCommit};
use std::collections::HashMap;
Expand Down Expand Up @@ -37,7 +37,7 @@ impl<'a, Ext, Db: Database + DatabaseCommit> EvmNeedsTx<'a, Ext, Db> {

#[cfg(test)]
mod test {
use alloy_eips::eip4895::{Withdrawal, GWEI_TO_WEI};
use alloy::eips::eip4895::{Withdrawal, GWEI_TO_WEI};
use alloy_primitives::{Address, U256};

use crate::{NoopBlock, NoopCfg};
Expand Down
11 changes: 6 additions & 5 deletions src/system/eip6110.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use alloy_consensus::ReceiptEnvelope;
use alloy_eips::eip6110::DepositRequest;
use alloy::{consensus::ReceiptEnvelope, eips::eip6110::DepositRequest};
use alloy_primitives::Log;
use alloy_sol_types::{sol, SolEvent};

/// The address for the Ethereum 2.0 deposit contract on the mainnet.
pub use alloy_eips::eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS;
pub use alloy::eips::eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS;

sol! {
#[allow(missing_docs)]
Expand Down Expand Up @@ -119,8 +118,10 @@ pub fn check_receipt_for_deposits(

#[cfg(test)]
mod test {
use alloy_consensus::{Receipt, ReceiptEnvelope};
use alloy_eips::eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS;
use alloy::{
consensus::{Receipt, ReceiptEnvelope},
eips::eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS,
};
use alloy_primitives::{Log, LogData};
use alloy_sol_types::SolEvent;

Expand Down
6 changes: 3 additions & 3 deletions src/system/eip7002.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{checked_insert_code, execute_system_tx};
use crate::{system::SystemTx, EvmNeedsTx};
use alloy_eips::eip7002::{WithdrawalRequest, WITHDRAWAL_REQUEST_PREDEPLOY_CODE};
use alloy::eips::eip7002::{WithdrawalRequest, WITHDRAWAL_REQUEST_PREDEPLOY_CODE};
use alloy_primitives::{Address, Bytes};
use revm::{
primitives::{EVMError, SpecId},
Expand All @@ -10,7 +10,7 @@ use revm::{
/// The address for the [EIP-7002] withdrawal requests contract.
///
/// [EIP-7002]: https://eips.ethereum.org/EIPS/eip-7002
pub use alloy_eips::eip7002::WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS;
pub use alloy::eips::eip7002::WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS;

/// The size of a withdrawal request in bytes.
pub const WITHDRAWAL_REQUEST_BYTES: usize = 20 + 48 + 8;
Expand Down Expand Up @@ -94,7 +94,7 @@ impl<'a, Ext, Db: Database + DatabaseCommit> EvmNeedsTx<'a, Ext, Db> {
#[cfg(test)]
mod test {
use super::*;
use alloy_consensus::constants::ETH_TO_WEI;
use alloy::consensus::constants::ETH_TO_WEI;
use alloy_primitives::{fixed_bytes, FixedBytes, TxKind, U256};

use crate::{NoopBlock, NoopCfg, Tx};
Expand Down
6 changes: 3 additions & 3 deletions src/system/eip7251.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{checked_insert_code, execute_system_tx};
use crate::{system::SystemTx, EvmNeedsTx};
use alloy_eips::eip7251::{ConsolidationRequest, CONSOLIDATION_REQUEST_PREDEPLOY_CODE};
use alloy::eips::eip7251::{ConsolidationRequest, CONSOLIDATION_REQUEST_PREDEPLOY_CODE};
use alloy_primitives::{Address, Bytes};
use revm::{
primitives::{EVMError, SpecId},
Expand All @@ -10,7 +10,7 @@ use revm::{
/// The address for the [EIP-7251] consolidation requests contract
///
/// [`EIP-7251`]: https://eips.ethereum.org/EIPS/eip-7251
pub use alloy_eips::eip7251::CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS;
pub use alloy::eips::eip7251::CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS;

/// The size of a consolidation request in bytes.
pub const CONSOLIDATION_REQUEST_BYTES: usize = 20 + 48 + 48;
Expand Down Expand Up @@ -94,7 +94,7 @@ impl<'a, Ext, Db: Database + DatabaseCommit> EvmNeedsTx<'a, Ext, Db> {
#[cfg(test)]
mod test {
use super::*;
use alloy_consensus::constants::ETH_TO_WEI;
use alloy::consensus::constants::ETH_TO_WEI;
use alloy_primitives::{fixed_bytes, FixedBytes, TxKind, U256};

use crate::{NoopBlock, NoopCfg, Tx};
Expand Down