Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit b6d7bcf

Browse files
committed
chore(deps): use alloy for everything
removes alloy primitives. Closes ENG-732
1 parent 56a324b commit b6d7bcf

File tree

8 files changed

+17
-20
lines changed

8 files changed

+17
-20
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ license = "AGPL-3.0"
1212

1313
[dependencies]
1414
alloy = { version = "=0.7.3", features = ["full", "json-rpc", "signer-aws", "rpc-types-mev"] }
15-
alloy-primitives = { version = "0.8.11", features = ["serde", "tiny-keccak"] }
1615
alloy-sol-types = { version = "0.8.11", features = ["json"] }
1716
alloy-rlp = { version = "0.3.4" }
1817
alloy-contract = { version = "=0.7.3", features = ["pubsub"] }

src/bindings.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![allow(clippy::too_many_arguments)]
22
#![allow(missing_docs)]
3-
use alloy_primitives::{Address, Bytes, FixedBytes, U256};
4-
3+
use alloy::primitives::{Address, Bytes, FixedBytes, U256};
54
mod mint {
65
alloy::sol_types::sol!(
76
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]

src/block.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{marker::PhantomData, sync::OnceLock};
33
use crate::Zenith::BlockHeader as ZenithHeader;
44
use alloy::consensus::TxEnvelope;
55
use alloy::eips::eip2718::{Decodable2718, Encodable2718};
6-
use alloy_primitives::{keccak256, Address, B256};
6+
use alloy::primitives::{keccak256, Address, B256};
77
use alloy_rlp::Decodable;
88

99
/// Zenith processes normal Ethereum txns.
@@ -223,8 +223,7 @@ where
223223
#[cfg(test)]
224224
mod test {
225225
use alloy::consensus::{Signed, TxEip1559};
226-
use alloy_primitives::PrimitiveSignature;
227-
use alloy_primitives::{b256, bytes, Address, U256};
226+
use alloy::primitives::{b256, bytes, Address, PrimitiveSignature, U256};
228227

229228
use super::*;
230229

src/bundle.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use alloy::primitives::{keccak256, Address, Bytes, B256, U256};
12
use alloy::{
23
eips::{eip2718::Encodable2718, BlockNumberOrTag},
34
rpc::types::mev::{EthCallBundle, EthCallBundleResponse, EthSendBundle},
45
};
5-
use alloy_primitives::{keccak256, Address, Bytes, B256, U256};
66
use serde::{Deserialize, Serialize};
77
use std::collections::BTreeMap;
88

@@ -222,7 +222,7 @@ impl ZenithCallBundle {
222222
/// `keccak(NUM_OF_ASSETS_LE + asset1 + NUM_OF_FILLS_LE + asset1_user1 + user1_amount2 + ... + asset1_usern + asset1_amountn + ...)`.
223223
/// For the number of users/fills and amounts in the host_preimage, the amounts are serialized as little-endian U256 slice.
224224
pub fn bundle_hash(&self) -> B256 {
225-
let mut hasher = alloy_primitives::Keccak256::new();
225+
let mut hasher = alloy::primitives::Keccak256::new();
226226

227227
// Concatenate the transaction hashes, to then hash them. This is the tx_preimage.
228228
for tx in self.bundle.txs.iter() {
@@ -237,7 +237,7 @@ impl ZenithCallBundle {
237237
// 3. Concatenate the asset address.
238238
// 4. Prefix the number of fills.
239239
// 5. For each fill, concatenate the user and amount, the latter encoded as a little-endian U256 slice.
240-
let mut hasher = alloy_primitives::Keccak256::new();
240+
let mut hasher = alloy::primitives::Keccak256::new();
241241

242242
// Prefix the list of users with the number of assets.
243243
hasher.update(U256::from(self.host_fills.len()).as_le_slice());
@@ -259,7 +259,7 @@ impl ZenithCallBundle {
259259
// Hash the host pre-image.
260260
let host_preimage = hasher.finalize();
261261

262-
let mut pre_image = alloy_primitives::Keccak256::new();
262+
let mut pre_image = alloy::primitives::Keccak256::new();
263263
pre_image.update(tx_preimage.as_slice());
264264
pre_image.update(host_preimage.as_slice());
265265

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ pub use req::SignRequest;
3333
mod resp;
3434
pub use resp::SignResponse;
3535

36-
use alloy_primitives::{address, Address};
36+
use alloy::primitives::{address, Address};
3737

3838
/// System address with permission to mint tokens on pre-deploys.
3939
pub const MINTER_ADDRESS: Address = address!("00000000000000000000746f6b656e61646d696e");
4040

4141
/// A [`RequestSigner`] signs [`SignRequest`]s by delegating to an
4242
/// [`alloy::signers::Signer`].
4343
pub trait RequestSigner {
44-
/// Signs a [`SignRequest`] and returns the [`alloy_primitives::Signature`].
44+
/// Signs a [`SignRequest`] and returns the [`alloy::primitives::Signature`].
4545
fn sign_request(
4646
&self,
4747
request: &SignRequest,
4848
) -> impl std::future::Future<
49-
Output = Result<alloy_primitives::PrimitiveSignature, alloy::signers::Error>,
49+
Output = Result<alloy::primitives::PrimitiveSignature, alloy::signers::Error>,
5050
> + Send;
5151
}
5252

@@ -57,7 +57,7 @@ where
5757
async fn sign_request(
5858
&self,
5959
request: &SignRequest,
60-
) -> Result<alloy_primitives::PrimitiveSignature, alloy::signers::Error> {
60+
) -> Result<alloy::primitives::PrimitiveSignature, alloy::signers::Error> {
6161
let hash = request.signing_hash();
6262
self.sign_hash(&hash).await
6363
}

src/orders/agg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::RollupOrders;
2-
use alloy_primitives::{Address, U256};
2+
use alloy::primitives::{Address, U256};
33
use std::collections::HashMap;
44

55
/// Aggregated orders for a transaction or set of transactions.
@@ -67,7 +67,7 @@ impl<'a> FromIterator<&'a RollupOrders::Order> for AggregateOrders {
6767
#[cfg(test)]
6868
mod test {
6969
use super::*;
70-
use alloy_primitives::{Address, U256};
70+
use alloy::primitives::{Address, U256};
7171

7272
const ASSET_A: Address = Address::repeat_byte(1);
7373
const ASSET_B: Address = Address::repeat_byte(2);

src/req.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use alloy_primitives::{Address, Keccak256, B256, U256};
1+
use alloy::primitives::{Address, Keccak256, B256, U256};
22
use serde::{Deserialize, Serialize};
33

44
/// The domain binding for the signing service.
@@ -55,7 +55,7 @@ impl core::fmt::Display for SignRequest {
5555
#[cfg(test)]
5656
mod test {
5757
use super::*;
58-
use alloy_primitives::b256;
58+
use alloy::primitives::b256;
5959

6060
#[test]
6161
fn roundtrip() {

src/resp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::SignRequest;
2-
use alloy_primitives::{Address, PrimitiveSignature, SignatureError};
2+
use alloy::primitives::{Address, PrimitiveSignature, SignatureError};
33
use serde::{Deserialize, Serialize};
44

55
/// A signature response from a [`RequestSigner`].
@@ -29,7 +29,7 @@ impl SignResponse {
2929
mod test {
3030
use super::*;
3131
use crate::{RequestSigner, SignRequest};
32-
use alloy_primitives::U256;
32+
use alloy::primitives::U256;
3333

3434
#[tokio::test]
3535
async fn test_sign_response() {

0 commit comments

Comments
 (0)