Skip to content

Commit

Permalink
Merge branch 'master' into feat/pretty_status
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Apr 9, 2024
2 parents 1349460 + 1610c13 commit 857465c
Show file tree
Hide file tree
Showing 185 changed files with 6,253 additions and 5,405 deletions.
1,714 changes: 1,070 additions & 644 deletions Cargo.lock

Large diffs are not rendered by default.

68 changes: 36 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ resolver = "2"
[workspace.package]
version = "0.2.0"
edition = "2021"
rust-version = "1.76" # Remember to update clippy.toml as well
# Remember to update clippy.toml as well
rust-version = "1.76"
authors = ["Foundry Contributors"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/foundry-rs/foundry"
Expand Down Expand Up @@ -106,9 +107,6 @@ codegen-units = 1
[profile.release.package]
mdbook.opt-level = 1
protobuf.opt-level = 1
rusoto_core.opt-level = 1
rusoto_credential.opt-level = 1
rusoto_kms.opt-level = 1
toml_edit.opt-level = 1
trezor-client.opt-level = 1

Expand Down Expand Up @@ -139,16 +137,16 @@ foundry-wallets = { path = "crates/wallets" }
foundry-linking = { path = "crates/linking" }

# solc & compilation utilities
foundry-block-explorers = { version = "0.2.3", default-features = false }
foundry-compilers = { version = "0.3.13", default-features = false }
foundry-block-explorers = { version = "0.2.5", default-features = false }
foundry-compilers = { version = "0.3.14", default-features = false }

## revm
# no default features to avoid c-kzg
revm = { version = "7.1", default-features = false, features = ["std"] }
revm-primitives = { version = "3", default-features = false, features = ["std"] }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "ba0b6ab", features = [
revm = { version = "8", default-features = false }
revm-primitives = { version = "3", default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "510d4d0", features = [
"serde",
] }
] }

## ethers
ethers = { version = "2.0.14", default-features = false }
Expand All @@ -160,29 +158,34 @@ ethers-signers = { version = "2.0.14", default-features = false }
ethers-middleware = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-providers = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", default-features = false }
alloy-primitives = { version = "0.6.3", features = ["getrandom"] }
alloy-dyn-abi = "0.6.3"
alloy-json-abi = "0.6.3"
alloy-sol-types = "0.6.3"
syn-solidity = "0.6.3"
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "5f74d4e", default-features = false }
alloy-primitives = { version = "0.7.0", features = ["getrandom"] }
alloy-dyn-abi = "0.7.0"
alloy-json-abi = "0.7.0"
alloy-sol-types = "0.7.0"
syn-solidity = "0.7.0"
alloy-chains = "0.1"

alloy-trie = "0.3.1"
alloy-rlp = "0.3.3"
solang-parser = "=0.3.3"

Expand Down Expand Up @@ -210,6 +213,7 @@ tracing-subscriber = "0.3"
vergen = { version = "8", default-features = false }
indexmap = "2.2"
tikv-jemallocator = "0.5.4"
num-format = "0.4.4"

axum = "0.6"
hyper = "0.14"
Expand Down
3 changes: 3 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
msrv = "1.76"
# bytes::Bytes is included by default and alloy_primitives::Bytes is a wrapper around it,
# so it is safe to ignore it as well
ignore-interior-mutability = ["bytes::Bytes", "alloy_primitives::Bytes"]
26 changes: 17 additions & 9 deletions crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ path = "src/anvil.rs"
required-features = ["cli"]

[build-dependencies]
vergen = { workspace = true, default-features = false, features = ["build", "git", "gitcl"] }
vergen = { workspace = true, default-features = false, features = [
"build",
"git",
"gitcl",
] }

[dependencies]
# foundry internal
Expand All @@ -32,22 +36,22 @@ foundry-evm.workspace = true
bytes = "1.4.0"
k256.workspace = true
ethers = { workspace = true, features = ["rustls", "ws", "ipc", "optimism"] }
trie-db = "0.23"
hash-db = "0.15"
memory-db = "0.29"
alloy-primitives = { workspace = true, features = ["serde"] }
alloy-consensus = { workspace = true, features = ["k256", "kzg"] }
alloy-network.workspace = true
alloy-eips.workspace = true
alloy-rlp.workspace = true
alloy-signer = { workspace = true, features = ["eip712", "mnemonic"] }
alloy-signer = { workspace = true, features = ["eip712"] }
alloy-signer-wallet = { workspace = true, features = ["mnemonic"] }
alloy-sol-types = { workspace = true, features = ["std"] }
alloy-dyn-abi = { workspace = true, features = ["std", "eip712"] }
alloy-rpc-types.workspace = true
alloy-rpc-trace-types.workspace = true
alloy-providers.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-provider = { workspace = true, features = ["pubsub"] }
alloy-transport.workspace = true
alloy-chains.workspace = true
alloy-genesis.workspace = true
alloy-trie.workspace = true

# axum related
axum.workspace = true
Expand Down Expand Up @@ -77,7 +81,11 @@ rand = "0.8"
eyre.workspace = true

# cli
clap = { version = "4", features = ["derive", "env", "wrap_help"], optional = true }
clap = { version = "4", features = [
"derive",
"env",
"wrap_help",
], optional = true }
clap_complete = { version = "4", optional = true }
chrono.workspace = true
auto_impl = "1"
Expand All @@ -91,7 +99,7 @@ tikv-jemallocator = { workspace = true, optional = true }

[dev-dependencies]
alloy-json-abi.workspace = true
ethers = { workspace = true, features = ["abigen"] }
ethers = { workspace = true, features = ["abigen", "optimism"] }
ethers-core = { workspace = true, features = ["optimism"] }
foundry-compilers = { workspace = true, features = ["project-util", "full"] }

Expand Down
20 changes: 9 additions & 11 deletions crates/anvil/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,26 @@ repository.workspace = true
[dependencies]
foundry-common.workspace = true
foundry-evm.workspace = true
revm = { workspace = true, default-features = false, features = ["std", "serde", "memory_limit"] }
revm = { workspace = true, default-features = false, features = [
"std",
"serde",
"memory_limit",
] }

alloy-primitives = { workspace = true, features = ["serde"] }
alloy-rpc-types = { workspace = true }
alloy-rpc-trace-types.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-rlp.workspace = true
alloy-eips.workspace = true
alloy-network = { workspace = true, features = ["k256"] }
alloy-consensus = { workspace = true, features = ["k256", "kzg"]}
alloy-consensus = { workspace = true, features = ["k256", "kzg"] }
alloy-dyn-abi = { workspace = true, features = ["std", "eip712"] }
alloy-trie.workspace = true

serde = { workspace = true, optional = true }
serde_json.workspace = true
bytes = "1.4"
c-kzg = { version = "0.4.2", features = ["serde"] }

# trie
hash-db = { version = "0.15", default-features = false }
hash256-std-hasher = { version = "0.15", default-features = false }
triehash = { version = "0.8", default-features = false }
reference-trie = "0.25"
keccak-hasher = "0.15"
c-kzg = { version = "1", features = ["serde"] }

# misc
rand = "0.8"
Expand Down
37 changes: 18 additions & 19 deletions crates/anvil/core/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::{
trie,
};
use alloy_consensus::Header;
use alloy_primitives::{Address, Bloom, Bytes, B256, U256};
use alloy_primitives::{Address, Bloom, Bytes, B256, B64, U256};
use alloy_rlp::{RlpDecodable, RlpEncodable};

// Type alias to optionally support impersonated transactions
Expand Down Expand Up @@ -88,13 +88,13 @@ pub struct PartialHeader {
pub logs_bloom: Bloom,
pub difficulty: U256,
pub number: u64,
pub gas_limit: u64,
pub gas_used: u64,
pub gas_limit: u128,
pub gas_used: u128,
pub timestamp: u64,
pub extra_data: Bytes,
pub mix_hash: B256,
pub nonce: u64,
pub base_fee: Option<u64>,
pub nonce: B64,
pub base_fee: Option<u128>,
}

impl From<Header> for PartialHeader {
Expand All @@ -120,7 +120,6 @@ impl From<Header> for PartialHeader {

#[cfg(test)]
mod tests {
use alloy_network::Sealable;
use alloy_primitives::{
b256,
hex::{self, FromHex},
Expand All @@ -143,11 +142,11 @@ mod tests {
difficulty: Default::default(),
number: 124u64,
gas_limit: Default::default(),
gas_used: 1337u64,
gas_used: 1337u128,
timestamp: 0,
extra_data: Default::default(),
mix_hash: Default::default(),
nonce: 99u64,
nonce: B64::with_last_byte(99),
withdrawals_root: Default::default(),
blob_gas_used: Default::default(),
excess_blob_gas: Default::default(),
Expand All @@ -159,7 +158,7 @@ mod tests {
let decoded: Header = Header::decode(&mut encoded.as_ref()).unwrap();
assert_eq!(header, decoded);

header.base_fee_per_gas = Some(12345u64);
header.base_fee_per_gas = Some(12345u128);

let encoded = alloy_rlp::encode(&header);
let decoded: Header = Header::decode(&mut encoded.as_ref()).unwrap();
Expand All @@ -182,16 +181,16 @@ mod tests {
logs_bloom: Bloom::from_hex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap(),
difficulty: U256::from(2222),
number: 0xd05u64,
gas_limit: 0x115cu64,
gas_used: 0x15b3u64,
gas_limit: 0x115cu128,
gas_used: 0x15b3u128,
timestamp: 0x1a0au64,
extra_data: hex::decode("7788").unwrap().into(),
mix_hash: B256::from_str("0000000000000000000000000000000000000000000000000000000000000000").unwrap(),
withdrawals_root: None,
blob_gas_used: None,
excess_blob_gas: None,
parent_beacon_block_root: None,
nonce: 0,
nonce: B64::ZERO,
base_fee_per_gas: None,
};

Expand All @@ -214,12 +213,12 @@ mod tests {
logs_bloom: <[u8; 256]>::from_hex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap().into(),
difficulty: U256::from(2222),
number: 0xd05u64,
gas_limit: 0x115cu64,
gas_used: 0x15b3u64,
gas_limit: 0x115cu128,
gas_used: 0x15b3u128,
timestamp: 0x1a0au64,
extra_data: hex::decode("7788").unwrap().into(),
mix_hash: B256::from_str("0000000000000000000000000000000000000000000000000000000000000000").unwrap(),
nonce: 0,
nonce: B64::ZERO,
withdrawals_root: None,
blob_gas_used: None,
excess_blob_gas: None,
Expand All @@ -245,19 +244,19 @@ mod tests {
logs_bloom: Bloom::from_hex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap(),
difficulty: U256::from(0x020000),
number: 1u64,
gas_limit: U256::from(0x016345785d8a0000u128).to::<u64>(),
gas_used: U256::from(0x015534).to::<u64>(),
gas_limit: U256::from(0x016345785d8a0000u128).to::<u128>(),
gas_used: U256::from(0x015534).to::<u128>(),
timestamp: 0x079e,
extra_data: hex::decode("42").unwrap().into(),
mix_hash: B256::from_str("0000000000000000000000000000000000000000000000000000000000000000").unwrap(),
nonce: 0,
nonce: B64::ZERO,
base_fee_per_gas: Some(875),
withdrawals_root: None,
blob_gas_used: None,
excess_blob_gas: None,
parent_beacon_block_root: None,
};
assert_eq!(header.hash(), expected_hash);
assert_eq!(header.hash_slow(), expected_hash);
}

#[test]
Expand Down
Loading

0 comments on commit 857465c

Please sign in to comment.