Skip to content

Commit

Permalink
chore(ecies): replace reth-primitives with alloy-primitives (#8812)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jun 13, 2024
1 parent a568535 commit a96884d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions crates/net/ecies/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ repository.workspace = true
workspace = true

[dependencies]
reth-primitives.workspace = true
reth-network-peers = { workspace = true, features = ["secp256k1"] }

alloy-rlp = { workspace = true, features = ["derive"] }
alloy-primitives = { workspace = true, features = ["rand", "rlp"] }
alloy-rlp = { workspace = true, features = ["derive", "arrayvec"] }

futures.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }
tokio = { workspace = true, features = ["time"] }
tokio-stream.workspace = true
tokio-util = { workspace = true, features = ["codec"] }
pin-project.workspace = true
Expand Down
10 changes: 5 additions & 5 deletions crates/net/ecies/src/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ use crate::{
ECIESError,
};
use aes::{cipher::StreamCipher, Aes128, Aes256};
use alloy_primitives::{
bytes::{BufMut, Bytes, BytesMut},
B128, B256, B512 as PeerId,
};
use alloy_rlp::{Encodable, Rlp, RlpEncodable, RlpMaxEncodedLen};
use byteorder::{BigEndian, ByteOrder, ReadBytesExt};
use ctr::Ctr64BE;
use digest::{crypto_common::KeyIvInit, Digest};
use rand::{thread_rng, Rng};
use reth_network_peers::{id2pk, pk2id};
use reth_primitives::{
bytes::{BufMut, Bytes, BytesMut},
B128, B256, B512 as PeerId,
};
use secp256k1::{
ecdsa::{RecoverableSignature, RecoveryId},
PublicKey, SecretKey, SECP256K1,
Expand Down Expand Up @@ -735,7 +735,7 @@ impl ECIES {
#[cfg(test)]
mod tests {
use super::*;
use reth_primitives::{b256, hex};
use alloy_primitives::{b256, hex};

#[test]
fn ecdh() {
Expand Down
2 changes: 1 addition & 1 deletion crates/net/ecies/src/codec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{algorithm::ECIES, ECIESError, EgressECIESValue, IngressECIESValue};
use reth_primitives::{BytesMut, B512 as PeerId};
use alloy_primitives::{bytes::BytesMut, B512 as PeerId};
use secp256k1::SecretKey;
use std::{fmt::Debug, io};
use tokio_util::codec::{Decoder, Encoder};
Expand Down
2 changes: 1 addition & 1 deletion crates/net/ecies/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use error::ECIESError;

mod codec;

use reth_primitives::{
use alloy_primitives::{
bytes::{Bytes, BytesMut},
B512 as PeerId,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/net/ecies/src/mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
//! For more information, refer to the [Ethereum MAC specification](https://github.com/ethereum/devp2p/blob/master/rlpx.md#mac).
use aes::Aes256Enc;
use alloy_primitives::{B128, B256};
use block_padding::NoPadding;
use cipher::BlockEncrypt;
use digest::KeyInit;
use generic_array::GenericArray;
use reth_primitives::{B128, B256};
use sha3::{Digest, Keccak256};
use typenum::U16;

Expand Down
4 changes: 2 additions & 2 deletions crates/net/ecies/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
use crate::{
codec::ECIESCodec, error::ECIESErrorImpl, ECIESError, EgressECIESValue, IngressECIESValue,
};
use futures::{ready, Sink, SinkExt};
use reth_primitives::{
use alloy_primitives::{
bytes::{Bytes, BytesMut},
B512 as PeerId,
};
use futures::{ready, Sink, SinkExt};
use secp256k1::SecretKey;
use std::{
fmt::Debug,
Expand Down
2 changes: 1 addition & 1 deletion crates/net/ecies/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Utility functions for hashing and encoding.
use alloy_primitives::B256;
use hmac::{Hmac, Mac};
use reth_primitives::B256;
use sha2::{Digest, Sha256};

/// Hashes the input data with SHA256.
Expand Down

0 comments on commit a96884d

Please sign in to comment.