Migrate from ethereum-types to alloy-primitives (#6078)

* Remove use of ethers_core::RlpStream

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into remove_use_of_ethers_core

* Remove old code

* Simplify keccak call

* Remove unused package

* Merge branch 'unstable' of https://github.com/ethDreamer/lighthouse into remove_use_of_ethers_core

* Merge branch 'unstable' into remove_use_of_ethers_core

* Run clippy

* Merge branch 'remove_use_of_ethers_core' of https://github.com/dospore/lighthouse into remove_use_of_ethers_core

* Check all cargo fmt

* migrate to alloy primitives init

* fix deps

* integrate alloy-primitives

* resolve dep issues

* more changes based on dep changes

* add TODOs

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into remove_use_of_ethers_core

* Revert lock

* Add BeaconBlocksByRange v3

* continue migration

* Revert "Add BeaconBlocksByRange v3"

This reverts commit e3ce7fc5ea.

* impl hash256 extended trait

* revert some uneeded diffs

* merge conflict resolved

* fix subnet id rshift calc

* rename to FixedBytesExtended

* debugging

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives

* fix failed test

* fixing more tests

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into remove_use_of_ethers_core

* introduce a shim to convert between the two u256 types

* move alloy to wrokspace

* align alloy versions

* update

* update web3signer test certs

* refactor

* resolve failing tests

* linting

* fix graffiti string test

* fmt

* fix ef test

* resolve merge conflicts

* remove udep and revert cert

* cargo patch

* cyclic dep

* fix build error

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives

* resolve conflicts, update deps

* merge unstable

* fmt

* fix deps

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives

* resolve merge conflicts

* resolve conflicts, make necessary changes

* Remove patch

* fmt

* remove file

* merge conflicts

* sneaking in a smol change

* bump versions

* Merge remote-tracking branch 'origin/unstable' into migrate-to-alloy-primitives

* Updates for peerDAS

* Update ethereum_hashing to prevent dupe

* updated alloy-consensus, removed TODOs

* cargo update

* endianess fix

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives

* fmt

* fix merge

* fix test

* fixed_bytes crate

* minor fixes

* convert u256 to i64

* panic free mixin to_low_u64_le

* from_str_radix

* computbe_subnet api and ensuring we use big-endian

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives

* fix test

* Simplify subnet_id test

* Simplify some more tests

* Add tests to fixed_bytes crate

* Merge branch 'unstable' into migrate-to-alloy-primitives
This commit is contained in:
Eitan Seri-Levi
2024-09-02 01:03:24 -07:00
committed by GitHub
parent 002ca2cdeb
commit 99e53b88c3
152 changed files with 1050 additions and 718 deletions

View File

@@ -14,6 +14,7 @@ eth2 = { workspace = true }
gossipsub = { workspace = true }
[dependencies]
alloy-primitives = { workspace = true }
async-channel = { workspace = true }
anyhow = { workspace = true }
beacon_chain = { workspace = true }

View File

@@ -15,7 +15,7 @@ use std::collections::{hash_map::Entry, HashMap};
use std::sync::Arc;
use tokio_stream::StreamExt;
use types::blob_sidecar::BlobIdentifier;
use types::{Epoch, EthSpec, ForkName, Hash256, Slot};
use types::{Epoch, EthSpec, FixedBytesExtended, ForkName, Hash256, Slot};
impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
/* Auxiliary functions */

View File

@@ -4,7 +4,7 @@ use store::{DBColumn, Error as StoreError, HotColdDB, ItemStore, StoreItem};
use types::{EthSpec, Hash256};
/// 32-byte key for accessing the `DhtEnrs`. All zero because `DhtEnrs` has its own column.
pub const DHT_DB_KEY: Hash256 = Hash256::zero();
pub const DHT_DB_KEY: Hash256 = Hash256::ZERO;
pub fn load_dht<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>(
store: Arc<HotColdDB<E, Hot, Cold>>,

View File

@@ -809,7 +809,7 @@ impl<T: BeaconChainTypes> NetworkService<T> {
}
} else {
for column_subnet in DataColumnSubnetId::compute_custody_subnets::<T::EthSpec>(
self.network_globals.local_enr().node_id().raw().into(),
self.network_globals.local_enr().node_id().raw(),
self.network_globals
.local_enr()
.custody_subnet_count::<<T as BeaconChainTypes>::EthSpec>(

View File

@@ -176,7 +176,7 @@ mod tests {
// Make sure the service is subscribed to the topics.
let (old_topic1, old_topic2) = {
let mut subnets = SubnetId::compute_subnets_for_epoch::<MinimalEthSpec>(
network_globals.local_enr().node_id().raw().into(),
network_globals.local_enr().node_id().raw(),
beacon_chain.epoch().unwrap(),
&spec,
)

View File

@@ -1,5 +1,5 @@
use beacon_chain::{BeaconChain, BeaconChainTypes};
use types::{EthSpec, Hash256};
use types::{EthSpec, FixedBytesExtended, Hash256};
use lighthouse_network::rpc::StatusMessage;
/// Trait to produce a `StatusMessage` representing the state of the given `beacon_chain`.

View File

@@ -315,7 +315,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
})?;
let (subnets, next_subscription_epoch) = SubnetId::compute_subnets_for_epoch::<T::EthSpec>(
self.node_id.raw().into(),
self.node_id.raw(),
current_epoch,
&self.beacon_chain.spec,
)

View File

@@ -118,7 +118,7 @@ pub(crate) fn find_oldest_fork_ancestor(
#[cfg(test)]
mod tests {
use super::{compute_parent_chains, find_oldest_fork_ancestor, Node};
use types::Hash256;
use types::{FixedBytesExtended, Hash256};
fn h(n: u64) -> Hash256 {
Hash256::from_low_u64_be(n)

View File

@@ -300,7 +300,7 @@ impl TestRig {
fn expect_no_active_sampling(&mut self) {
assert_eq!(
self.sync_manager.active_sampling_requests(),
vec![],
Vec::<Hash256>::new(),
"expected no active sampling"
);
}

View File

@@ -406,7 +406,7 @@ mod tests {
use std::collections::HashSet;
use store::MemoryStore;
use tokio::sync::mpsc;
use types::{ForkName, MinimalEthSpec as E};
use types::{FixedBytesExtended, ForkName, MinimalEthSpec as E};
#[derive(Debug)]
struct FakeStorage {