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

[wip] chore: rm alloy-eips and bump primitives #1723

Closed
wants to merge 3 commits into from
Closed
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
178 changes: 116 additions & 62 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions bins/revm-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ edition = "2021"
[dependencies]
bytes = "1.7"
hex = "0.4"
revm = { path = "../../crates/revm", version = "13.0.0", default-features=false }
revm = { path = "../../crates/revm", version = "13.0.0", default-features = false }
microbench = "0.5"
alloy-sol-macro = "0.7.7"
alloy-sol-types = "0.7.7"
alloy-sol-macro = "0.8.0"
alloy-sol-types = "0.8.0"
regex = "1.10.6"
eyre = "0.6.12"

Expand Down
12 changes: 7 additions & 5 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ rust_2018_idioms = "deny"
all = "warn"

[dependencies]
alloy-eips = { version = "0.2", default-features = false, features = ["k256"] }
alloy-primitives = { version = "0.7.7", default-features = false, features = [
alloy-eip7702 = { version = "0.1", default-features = false, features = [
"k256",
] }
alloy-eip2930 = { version = "0.1", default-features = false }
alloy-primitives = { version = "0.8.0", default-features = false, features = [
"rlp",
] }
hashbrown = "0.14"
Expand Down Expand Up @@ -59,7 +62,6 @@ hex = { version = "0.4", default-features = false }
default = ["std", "c-kzg", "portable"]
std = [
"serde?/std",
"alloy-eips/std",
"alloy-primitives/std",
"hex/std",
"bitvec/std",
Expand All @@ -68,7 +70,8 @@ std = [
hashbrown = []
serde = [
"dep:serde",
"alloy-eips/serde",
"alloy-eip7702/serde",
"alloy-eip2930/serde",
"alloy-primitives/serde",
"hex/serde",
"hashbrown/serde",
Expand All @@ -79,7 +82,6 @@ serde = [
]
arbitrary = [
"std",
"alloy-eips/arbitrary",
"alloy-primitives/arbitrary",
"bitflags/arbitrary",
]
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/env/eip7702.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use alloy_eips::eip7702::{Authorization, SignedAuthorization};
pub use alloy_eip7702::{Authorization, SignedAuthorization};
pub use alloy_primitives::Signature;

use crate::Address;
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub mod result;
pub mod specification;
pub mod state;
pub mod utilities;
pub use alloy_eips::eip2930::{AccessList, AccessListItem};
pub use alloy_eip2930::{AccessList, AccessListItem};
pub use alloy_primitives::{
self, address, b256, bytes, fixed_bytes, hex, hex_literal, ruint, uint, Address, Bytes,
FixedBytes, Log, LogData, TxKind, B256, I256, U256,
Expand Down
10 changes: 5 additions & 5 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ ethers-providers = { version = "2.0", optional = true }
ethers-core = { version = "2.0", optional = true }

# alloydb
alloy-provider = { version = "0.2", optional = true, default-features = false }
alloy-eips = { version = "0.2", optional = true, default-features = false }
alloy-transport = { version = "0.2", optional = true, default-features = false }
alloy-provider = { version = "0.3", optional = true, default-features = false }
alloy-eips = { version = "0.3", optional = true, default-features = false }
alloy-transport = { version = "0.3", optional = true, default-features = false }

[dev-dependencies]
alloy-sol-types = { version = "0.7.7", default-features = false, features = [
alloy-sol-types = { version = "0.8.0", default-features = false, features = [
"std",
] }
ethers-contract = { version = "2.0.14", default-features = false }
Expand All @@ -64,7 +64,7 @@ indicatif = "0.17"
reqwest = { version = "0.12" }
rstest = "0.22.0"

alloy-provider = "0.2"
alloy-provider = "0.3"

[features]
default = ["std", "c-kzg", "secp256k1", "portable", "blst"]
Expand Down
7 changes: 5 additions & 2 deletions crates/revm/src/db/alloydb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use crate::{
primitives::{AccountInfo, Address, Bytecode, B256, U256},
};
use alloy_eips::BlockId;
use alloy_provider::{Network, Provider};
use alloy_provider::{
network::{BlockResponse, HeaderResponse},
Network, Provider,
};
use alloy_transport::{Transport, TransportError};
use std::future::IntoFuture;
use tokio::runtime::{Handle, Runtime};
Expand Down Expand Up @@ -129,7 +132,7 @@ impl<T: Transport + Clone, N: Network, P: Provider<T, N>> DatabaseRef for AlloyD
.get_block_by_number(number.into(), false),
)?;
// SAFETY: If the number is given, the block is supposed to be finalized, so unwrapping is safe.
Ok(B256::new(*block.unwrap().header.hash.unwrap()))
Ok(B256::new(*block.unwrap().header().hash()))
}

fn code_by_hash_ref(&self, _code_hash: B256) -> Result<Bytecode, Self::Error> {
Expand Down
10 changes: 4 additions & 6 deletions crates/revm/src/handler/mainnet/pre_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ pub fn load_accounts<SPEC: Spec, EXT, DB: Database>(
};

// 2. Verify the chain id is either 0 or the chain's current ID.
if authorization.chain_id() != 0
&& authorization.chain_id() != context.evm.inner.env.cfg.chain_id
if authorization.chain_id() != U256::ZERO
&& authorization.chain_id() != U256::from(context.evm.inner.env.cfg.chain_id)
{
continue;
}
Expand All @@ -81,10 +81,8 @@ pub fn load_accounts<SPEC: Spec, EXT, DB: Database>(
}

// 4. If nonce list item is length one, verify the nonce of authority is equal to nonce.
if let Some(nonce) = authorization.nonce() {
if nonce != authority_acc.info.nonce {
continue;
}
if authorization.nonce() != authority_acc.info.nonce {
continue;
}

// warm code account and get the code.
Expand Down
Loading