Skip to content

Commit

Permalink
chore: update depends so we can use sigp crates directly (#1423)
Browse files Browse the repository at this point in the history
  • Loading branch information
KolbyML authored Sep 5, 2024
1 parent 6d27eee commit 1713c0a
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 278 deletions.
616 changes: 397 additions & 219 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ members = [
]

[workspace.dependencies]
alloy-consensus = { git = "https://github.com/alloy-rs/alloy.git", rev = "d68a6b787b2904061f0ae7fcc02ece8513e3c500"}
alloy-primitives = { version = "0.7.0", features = ["ssz"] }
alloy-rlp = "0.3.4"
alloy-consensus = "0.3.1"
alloy-primitives = "0.8.0"
alloy-rlp = "0.3.8"
anyhow = "1.0.68"
async-trait = "0.1.68"
bytes = "1.3.0"
Expand All @@ -91,9 +91,9 @@ directories = "3.0"
discv5 = { version = "0.4.1", features = ["serde"] }
e2store = { path = "e2store" }
env_logger = "0.9.0"
eth_trie = { git = "https://github.com/kolbyml/eth-trie.rs.git", rev = "7947a83091192a7988f359b750b05121d5d7ba8c" }
ethereum_ssz = "0.5.3"
ethereum_ssz_derive = "0.5.3"
eth_trie = { git = "https://github.com/kolbyml/eth-trie.rs.git", rev = "dc8b95d40ded01396ba53bff10e1ea364bd5ed54" }
ethereum_ssz = "0.7.1"
ethereum_ssz_derive = "0.7.1"
ethportal-api = { path = "ethportal-api" }
futures = "0.3.23"
hex = "0.4.3"
Expand All @@ -111,9 +111,9 @@ r2d2 = "0.8.9"
r2d2_sqlite = "0.24.0"
rand = "0.8.5"
reth-ipc = { tag = "v0.2.0-beta.5", git = "https://github.com/paradigmxyz/reth.git"}
reth-rpc-types = { rev = "8d1d13ef89cf19459adc37ba0c45e7aac6270dc1", git = "https://github.com/paradigmxyz/reth.git"}
revm = { version = "8.0.0", features = ["std", "secp256k1", "serde-json"], default-features = false }
revm-primitives = { version = "3.1.0", features = ["std", "serde"], default-features = false }
reth-rpc-types = { tag = "v1.0.6", git = "https://github.com/paradigmxyz/reth.git"}
revm = { version = "14.0.1", features = ["std", "secp256k1", "serde-json"], default-features = false }
revm-primitives = { version = "9.0.1", features = ["std", "serde"], default-features = false }
rpc = { path = "rpc"}
rstest = "0.18.2"
rusqlite = { version = "0.31.0", features = ["bundled"] }
Expand All @@ -125,7 +125,7 @@ serde-this-or-that = "0.4.2"
serial_test = "0.5.1"
sha3 = "0.9.1"
snap = "1.1.1"
ssz_types = { git = "https://github.com/KolbyML/ssz_types.git", rev = "2a5922de75f00746890bf4ea9ad663c9d5d58efe" }
ssz_types = "0.8.0"
strum = { version = "0.26.1", features = ["derive"] }
surf = { version = "2.3.2", default-features = false, features = ["h1-client-rustls", "middleware-logger", "encoding"] } # we use rustls because OpenSSL cause issues compiling on aarch64
tempfile = "3.3.0"
Expand All @@ -136,8 +136,8 @@ tokio-test = "0.4.2"
tracing = "0.1.36"
tracing-subscriber = "0.3.15"
tracing-test = "0.1"
tree_hash = { git = "https://github.com/KolbyML/tree_hash.git", rev = "8aaf8bb4184148768d48e2cfbbdd0b95d1da8730" }
tree_hash_derive = { git = "https://github.com/KolbyML/tree_hash.git", rev = "8aaf8bb4184148768d48e2cfbbdd0b95d1da8730" }
tree_hash = "0.8.0"
tree_hash_derive = "0.8.0"
trin-beacon = { path = "trin-beacon" }
trin-execution = { path = "trin-execution" }
trin-history = { path = "trin-history" }
Expand Down
4 changes: 2 additions & 2 deletions ethportal-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ clap.workspace = true
const_format = {version = "0.2.0", features = ["rust_1_64"]}
discv5.workspace = true
eth_trie.workspace = true
ethereum_hashing = "0.6.0"
ethereum_serde_utils = "0.5.2"
ethereum_hashing = "0.7.0"
ethereum_serde_utils = "0.7.0"
ethereum_ssz.workspace = true
ethereum_ssz_derive.workspace = true
hex.workspace = true
Expand Down
17 changes: 9 additions & 8 deletions ethportal-api/src/types/execution/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl PartialEq for Header {
/// RpcHeader is a field in reth's `Block` RPC type used in eth_getBlockByHash, for example.
impl From<Header> for RpcHeader {
fn from(header: Header) -> Self {
let hash = Some(header.hash().0.into());
let hash = header.hash();
let Header {
parent_hash,
uncles_hash,
Expand Down Expand Up @@ -262,20 +262,21 @@ impl From<Header> for RpcHeader {
receipts_root,
logs_bloom,
difficulty,
number: Some(U256::from(number)),
gas_limit,
gas_used,
timestamp: U256::from(timestamp),
number,
gas_limit: gas_limit.to(),
gas_used: gas_used.to(),
timestamp,
extra_data: extra_data.into(),
mix_hash,
nonce,
base_fee_per_gas,
base_fee_per_gas: base_fee_per_gas.map(|v| v.to()),
withdrawals_root,
blob_gas_used,
excess_blob_gas,
blob_gas_used: blob_gas_used.map(|v| v.to()),
excess_blob_gas: excess_blob_gas.map(|v| v.to()),
hash,
parent_beacon_block_root: parent_beacon_block_root.map(|h264| h264.0.into()),
total_difficulty: Some(difficulty),
requests_root: None,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions ethportal-api/src/types/state_trie/trie_traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ impl NodeTraversal for Node {
mod tests {
use std::array;

use alloy_primitives::B256;
use eth_trie::{nibbles::Nibbles, node::empty_children};
use rstest::rstest;

Expand Down
1 change: 0 additions & 1 deletion portal-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ authors = ["https://github.com/ethereum/trin/graphs/contributors"]


[dependencies]
alloy-consensus.workspace = true
alloy-primitives.workspace = true
alloy-rlp.workspace = true
anyhow.workspace = true
Expand Down
3 changes: 1 addition & 2 deletions rpc/src/eth_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloy_primitives::{keccak256, Address, Bytes, B256, U256};
use alloy_rlp::Decodable;
use eth_trie::node::Node;
use reth_rpc_types::{other::OtherFields, Block, BlockId, BlockTransactions};
use reth_rpc_types::{Block, BlockId, BlockTransactions};
use tokio::sync::mpsc;

use ethportal_api::{
Expand Down Expand Up @@ -85,7 +85,6 @@ impl EthApiServer for EthApi {
transactions,
uncles: vec![],
size: None,
other: OtherFields::default(),
withdrawals: None,
};
Ok(block)
Expand Down
2 changes: 1 addition & 1 deletion trin-execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ parking_lot.workspace = true
prometheus_exporter.workspace = true
rayon = "1.10.0"
revm.workspace = true
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "848d568" }
revm-inspectors = "0.6"
revm-primitives.workspace = true
rocksdb = "0.22.0"
serde = { workspace = true, features = ["rc"] }
Expand Down
7 changes: 3 additions & 4 deletions trin-execution/src/storage/evm_db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::sync::Arc;

use crate::{config::StateConfig, storage::error::EVMError};
use alloy_consensus::constants::KECCAK_EMPTY;
use alloy_primitives::{Address, B256, U256};
use alloy_rlp::{Decodable, EMPTY_STRING_CODE};
use eth_trie::{EthTrie, RootWithTrieDiff, Trie};
Expand All @@ -11,7 +10,7 @@ use ethportal_api::{
use hashbrown::{HashMap as BrownHashMap, HashSet};
use parking_lot::Mutex;
use revm::{DatabaseCommit, DatabaseRef};
use revm_primitives::{keccak256, Account, AccountInfo, Bytecode, HashMap};
use revm_primitives::{keccak256, Account, AccountInfo, Bytecode, HashMap, KECCAK_EMPTY};
use rocksdb::DB as RocksDB;

use super::{
Expand Down Expand Up @@ -299,8 +298,8 @@ impl DatabaseRef for EvmDB {
}
}

fn block_hash_ref(&self, number: U256) -> Result<B256, Self::Error> {
match self.db.get(keccak256(B256::from(number)))? {
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
match self.db.get(keccak256(B256::from(U256::from(number))))? {
Some(raw_hash) => Ok(B256::from_slice(&raw_hash)),
None => Err(Self::Error::NotFound),
}
Expand Down
43 changes: 14 additions & 29 deletions trin-execution/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use alloy_primitives::U256;
use ethportal_api::types::execution::transaction::{
AccessListTransaction, BlobTransaction, EIP1559Transaction, LegacyTransaction, ToAddress,
};
use revm_primitives::{SpecId, TransactTo, TxEnv};
use revm_primitives::{AccessListItem, SpecId, TransactTo, TxEnv};

use super::spec_id::get_spec_id;

Expand All @@ -17,7 +17,7 @@ impl TxEnvModifier for LegacyTransaction {
tx_env.gas_priority_fee = None;
tx_env.transact_to = match self.to {
ToAddress::Exists(to) => TransactTo::Call(to),
ToAddress::Empty => TransactTo::create(),
ToAddress::Empty => TransactTo::Create,
};
tx_env.value = self.value;
tx_env.data = alloy_primitives::Bytes(self.data.clone());
Expand All @@ -40,7 +40,7 @@ impl TxEnvModifier for EIP1559Transaction {
tx_env.gas_priority_fee = Some(self.max_priority_fee_per_gas);
tx_env.transact_to = match self.to {
ToAddress::Exists(to) => TransactTo::Call(to),
ToAddress::Empty => TransactTo::create(),
ToAddress::Empty => TransactTo::Create,
};
tx_env.value = self.value;
tx_env.data = alloy_primitives::Bytes(self.data.clone());
Expand All @@ -50,14 +50,9 @@ impl TxEnvModifier for EIP1559Transaction {
.access_list
.list
.iter()
.map(|l| {
(
l.address,
l.storage_keys
.iter()
.map(|k| U256::from_be_bytes(k.0))
.collect(),
)
.map(|l| AccessListItem {
address: l.address,
storage_keys: l.storage_keys.clone(),
})
.collect();
tx_env.blob_hashes.clear();
Expand All @@ -72,7 +67,7 @@ impl TxEnvModifier for AccessListTransaction {
tx_env.gas_priority_fee = None;
tx_env.transact_to = match self.to {
ToAddress::Exists(to) => TransactTo::Call(to),
ToAddress::Empty => TransactTo::create(),
ToAddress::Empty => TransactTo::Create,
};
tx_env.value = self.value;
tx_env.data = alloy_primitives::Bytes(self.data.clone());
Expand All @@ -82,14 +77,9 @@ impl TxEnvModifier for AccessListTransaction {
.access_list
.list
.iter()
.map(|l| {
(
l.address,
l.storage_keys
.iter()
.map(|k| U256::from_be_bytes(k.0))
.collect(),
)
.map(|l| AccessListItem {
address: l.address,
storage_keys: l.storage_keys.clone(),
})
.collect();
tx_env.blob_hashes.clear();
Expand All @@ -104,7 +94,7 @@ impl TxEnvModifier for BlobTransaction {
tx_env.gas_priority_fee = Some(self.max_priority_fee_per_gas);
tx_env.transact_to = match self.to {
ToAddress::Exists(to) => TransactTo::Call(to),
ToAddress::Empty => TransactTo::create(),
ToAddress::Empty => TransactTo::Create,
};
tx_env.value = self.value;
tx_env.data = alloy_primitives::Bytes(self.data.clone());
Expand All @@ -114,14 +104,9 @@ impl TxEnvModifier for BlobTransaction {
.access_list
.list
.iter()
.map(|l| {
(
l.address,
l.storage_keys
.iter()
.map(|k| U256::from_be_bytes(k.0))
.collect(),
)
.map(|l| AccessListItem {
address: l.address,
storage_keys: l.storage_keys.clone(),
})
.collect();
tx_env.blob_hashes.clone_from(&self.blob_versioned_hashes);
Expand Down

0 comments on commit 1713c0a

Please sign in to comment.