Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = [ "crates/*" ]
resolver = "2"

[workspace.package]
version = "0.7.3"
version = "0.8.0"
edition = "2021"
rust-version = "1.76"
authors = ["Zenith Contributors"]
Expand All @@ -16,21 +16,8 @@ alloy-primitives = { version = "0.8", features = ["serde", "tiny-keccak"] }
alloy-sol-types = { version = "0.8", features = ["json"] }
alloy-rlp = { version = "0.3.4" }

alloy-contract = { version = "0.3", default-features = false }
alloy-consensus = { version = "0.3", default-features = false, features = ["k256", "kzg"] }
alloy-eips = { version = "0.3", default-features = false}
alloy-json-rpc = { version = "0.3", default-features = false }
alloy-network = { version = "0.3", default-features = false }
alloy-node-bindings = { version = "0.3", default-features = false }
alloy-provider = { version = "0.3", default-features = false, features = ["ws"] }
alloy-rpc-types = { version = "0.3", default-features = false }
alloy-rpc-types-eth = { version = "0.3", default-features = false }
alloy-rpc-client = { version = "0.3", default-features = false }
alloy-signer = { version = "0.3", default-features = false }
alloy-signer-local = { version = "0.3", default-features = false }
alloy-signer-aws = { version = "0.3", default-features = false }
alloy-transport = { version = "0.3", default-features = false }
alloy-transport-http = { version = "0.3", default-features = false }
alloy = { version = "=0.3.6", features = ["full", "json-rpc", "signer-aws"] }
alloy-contract = { version = "=0.3.6", features = ["pubsub"] }

aws-config = "1.1.7"
aws-sdk-kms = "1.15.0"
Expand Down
15 changes: 1 addition & 14 deletions crates/builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,7 @@ alloy-primitives.workspace = true
alloy-rlp.workspace = true
alloy-sol-types.workspace = true

alloy-contract.workspace = true
alloy-consensus.workspace = true
alloy-json-rpc.workspace = true
alloy-network.workspace = true
alloy-node-bindings.workspace = true
alloy-provider.workspace = true
alloy-rpc-types.workspace = true
alloy-rpc-types-eth.workspace = true
alloy-rpc-client.workspace = true
alloy-signer.workspace = true
alloy-signer-local.workspace = true
alloy-signer-aws.workspace = true
alloy-transport.workspace = true
alloy-transport-http.workspace = true
alloy.workspace = true

aws-sdk-kms.workspace = true
aws-config.workspace = true
Expand Down
16 changes: 10 additions & 6 deletions crates/builder/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::signer::{LocalOrAws, SignerError};
use alloy_network::{Ethereum, EthereumWallet};
use alloy_primitives::Address;
use alloy_provider::{
use alloy::network::{Ethereum, EthereumWallet};
use alloy::providers::fillers::BlobGasFiller;
use alloy::providers::{
fillers::{ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, WalletFiller},
Identity, ProviderBuilder, RootProvider,
};
use alloy_transport::BoxTransport;
use alloy::transports::BoxTransport;
use alloy_primitives::Address;
use std::{borrow::Cow, env, num, str::FromStr};
use zenith_types::Zenith;

Expand Down Expand Up @@ -81,7 +82,7 @@ pub enum ConfigError {
Hex(#[from] hex::FromHexError),
/// Error connecting to the provider
#[error("failed to connect to provider: {0}")]
Provider(#[from] alloy_transport::TransportError),
Provider(#[from] alloy::transports::TransportError),
/// Error connecting to the signer
#[error("failed to connect to signer: {0}")]
Signer(#[from] SignerError),
Expand All @@ -97,7 +98,10 @@ impl ConfigError {
/// Provider type used by this transaction
pub type Provider = FillProvider<
JoinFill<
JoinFill<JoinFill<JoinFill<Identity, GasFiller>, NonceFiller>, ChainIdFiller>,
JoinFill<
Identity,
JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>,
>,
WalletFiller<EthereumWallet>,
>,
RootProvider<BoxTransport>,
Expand Down
14 changes: 7 additions & 7 deletions crates/builder/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{fmt::Debug, net::SocketAddr};

use alloy_consensus::TxEnvelope;
use alloy_json_rpc::{ErrorPayload, Id};
use alloy_network::eip2718::Decodable2718;
use alloy::consensus::TxEnvelope;
use alloy::network::eip2718::Decodable2718;
use alloy::rpc::json_rpc::{ErrorPayload, Id};
use alloy_primitives::B256;
use axum::{
extract::State,
Expand Down Expand Up @@ -121,8 +121,8 @@ pub async fn ingest_rpc_handler(

// MUST be eth_sendRawTransaction method
if method != "eth_sendRawTransaction" {
return Ok(Json(alloy_json_rpc::Response {
payload: alloy_json_rpc::ResponsePayload::<(), ()>::Failure(ErrorPayload {
return Ok(Json(alloy::rpc::json_rpc::Response {
payload: alloy::rpc::json_rpc::ResponsePayload::<(), ()>::Failure(ErrorPayload {
code: -6969,
message: "Method not found".to_string(),
data: None,
Expand All @@ -140,8 +140,8 @@ pub async fn ingest_rpc_handler(
let hash = include_tx(state, tx).await?;

// return JSON-RPC response
let resp = alloy_json_rpc::Response {
payload: alloy_json_rpc::ResponsePayload::<_, ()>::Success(hash),
let resp = alloy::rpc::json_rpc::Response {
payload: alloy::rpc::json_rpc::ResponsePayload::<_, ()>::Success(hash),
id,
};

Expand Down
16 changes: 8 additions & 8 deletions crates/builder/src/signer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use alloy_consensus::SignableTransaction;
use alloy::consensus::SignableTransaction;
use alloy::signers::aws::{AwsSigner, AwsSignerError};
use alloy::signers::local::{LocalSignerError, PrivateKeySigner};
use alloy::signers::Signature;
use alloy_primitives::{Address, ChainId, B256};
use alloy_signer::Signature;
use alloy_signer_aws::{AwsSigner, AwsSignerError};
use alloy_signer_local::{LocalSignerError, PrivateKeySigner};
use aws_config::BehaviorVersion;

/// Abstraction over local signer or
Expand Down Expand Up @@ -55,7 +55,7 @@ impl LocalOrAws {
}

#[async_trait::async_trait]
impl alloy_network::TxSigner<Signature> for LocalOrAws {
impl alloy::network::TxSigner<Signature> for LocalOrAws {
fn address(&self) -> Address {
match self {
LocalOrAws::Local(signer) => signer.address(),
Expand All @@ -66,7 +66,7 @@ impl alloy_network::TxSigner<Signature> for LocalOrAws {
async fn sign_transaction(
&self,
tx: &mut dyn SignableTransaction<Signature>,
) -> alloy_signer::Result<Signature> {
) -> alloy::signers::Result<Signature> {
match self {
LocalOrAws::Local(signer) => signer.sign_transaction(tx).await,
LocalOrAws::Aws(signer) => signer.sign_transaction(tx).await,
Expand All @@ -75,9 +75,9 @@ impl alloy_network::TxSigner<Signature> for LocalOrAws {
}

#[async_trait::async_trait]
impl alloy_signer::Signer<Signature> for LocalOrAws {
impl alloy::signers::Signer<Signature> for LocalOrAws {
/// Signs the given hash.
async fn sign_hash(&self, hash: &B256) -> alloy_signer::Result<Signature> {
async fn sign_hash(&self, hash: &B256) -> alloy::signers::Result<Signature> {
match self {
LocalOrAws::Local(signer) => signer.sign_hash(hash).await,
LocalOrAws::Aws(signer) => signer.sign_hash(hash).await,
Expand Down
2 changes: 1 addition & 1 deletion crates/builder/src/tasks/block.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_consensus::{SidecarBuilder, SidecarCoder, TxEnvelope};
use alloy::consensus::{SidecarBuilder, SidecarCoder, TxEnvelope};
use alloy_primitives::{keccak256, Bytes, B256};
use std::{sync::OnceLock, time::Duration};
use tokio::{select, sync::mpsc, task::JoinHandle};
Expand Down
14 changes: 7 additions & 7 deletions crates/builder/src/tasks/submit.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use alloy_consensus::SimpleCoder;
use alloy_network::TransactionBuilder;
use alloy::consensus::SimpleCoder;
use alloy::network::{TransactionBuilder, TransactionBuilder4844};
use alloy::providers::{Provider as _, WalletProvider};
use alloy::rpc::types::eth::TransactionRequest;
use alloy::signers::Signer;
use alloy::sol_types::SolCall;
use alloy::transports::TransportError;
use alloy_primitives::{FixedBytes, U256};
use alloy_provider::{Provider as _, WalletProvider};
use alloy_rpc_types_eth::TransactionRequest;
use alloy_signer::Signer;
use alloy_sol_types::SolCall;
use alloy_transport::TransportError;
use eyre::{bail, eyre};
use tokio::{sync::mpsc, task::JoinHandle};
use tracing::{debug, error, instrument, trace};
Expand Down
2 changes: 1 addition & 1 deletion crates/builder/src/tasks/tx_poller.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::time::Duration;
use std::{collections::HashMap, time};

use alloy_consensus::TxEnvelope;
use alloy::consensus::TxEnvelope;
use alloy_primitives::TxHash;

use eyre::Error;
Expand Down
5 changes: 2 additions & 3 deletions crates/builder/tests/tx_poller_test.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
mod tests {
use std::str::FromStr;

use alloy_consensus::{SignableTransaction, TxEip1559, TxEnvelope};
use alloy::consensus::{SignableTransaction, TxEip1559, TxEnvelope};
use alloy::signers::{local::PrivateKeySigner, SignerSync};
use alloy_primitives::{bytes, Address, TxKind, U256};
use alloy_signer::SignerSync;
use alloy_signer_local::PrivateKeySigner;

use builder::config::BuilderConfig;
use builder::tasks::{block::BlockBuilder, tx_poller};
Expand Down
8 changes: 3 additions & 5 deletions crates/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ repository.workspace = true
[dependencies]
alloy-primitives.workspace = true
alloy-sol-types.workspace = true
alloy-rlp.workspace = true

alloy-consensus.workspace = true
alloy.workspace = true
alloy-contract.workspace = true
alloy-eips.workspace = true
alloy-signer.workspace = true

serde.workspace = true
alloy-rlp.workspace = true

[dev-dependencies]
serde_json = "1.0.116"
alloy-signer-local.workspace = true
alloy.workspace = true
tokio = { version = "1.37.0", features = ["macros"] }
10 changes: 5 additions & 5 deletions crates/types/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use alloy_primitives::{Address, Bytes, FixedBytes, U256};

mod mint {
alloy_sol_types::sol!(
alloy::sol_types::sol!(
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
function mint(address to, uint256 amount);
);
Expand All @@ -13,7 +13,7 @@ pub use mint::mintCall;
mod zenith {
use super::*;

alloy_sol_types::sol!(
alloy::sol_types::sol!(
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[sol(rpc)]
Zenith,
Expand Down Expand Up @@ -107,7 +107,7 @@ mod zenith {
mod passage {
use super::*;

alloy_sol_types::sol!(
alloy::sol_types::sol!(
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[sol(rpc)]
Passage,
Expand Down Expand Up @@ -207,7 +207,7 @@ mod passage {
mod orders {
use super::*;

alloy_sol_types::sol!(
alloy::sol_types::sol!(
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[sol(rpc)]
Orders,
Expand Down Expand Up @@ -303,7 +303,7 @@ mod orders {
mod transactor {
use super::*;

alloy_sol_types::sol!(
alloy::sol_types::sol!(
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[sol(rpc)]
Transactor,
Expand Down
8 changes: 4 additions & 4 deletions crates/types/src/block.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{marker::PhantomData, sync::OnceLock};

use crate::Zenith::BlockHeader as ZenithHeader;
use alloy_consensus::TxEnvelope;
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
use alloy::consensus::TxEnvelope;
use alloy::eips::eip2718::{Decodable2718, Encodable2718};
use alloy_primitives::{keccak256, Address, B256};
use alloy_rlp::Decodable;

Expand Down Expand Up @@ -222,9 +222,9 @@ where

#[cfg(test)]
mod test {
use alloy_consensus::{Signed, TxEip1559};
use alloy::consensus::{Signed, TxEip1559};
use alloy::signers::Signature;
use alloy_primitives::{b256, bytes, Address, U256};
use alloy_signer::Signature;

use super::*;

Expand Down
9 changes: 5 additions & 4 deletions crates/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,24 @@ use alloy_primitives::{address, Address};
pub const MINTER_ADDRESS: Address = address!("00000000000000000000746f6b656e61646d696e");

/// A [`RequestSigner`] signs [`SignRequest`]s by delegating to an
/// [`alloy_signer::Signer`].
/// [`alloy::signers::Signer`].
pub trait RequestSigner {
/// Signs a [`SignRequest`] and returns the [`alloy_primitives::Signature`].
fn sign_request(
&self,
request: &SignRequest,
) -> impl std::future::Future<Output = Result<alloy_primitives::Signature, alloy_signer::Error>> + Send;
) -> impl std::future::Future<Output = Result<alloy_primitives::Signature, alloy::signers::Error>>
+ Send;
}

impl<T> RequestSigner for T
where
T: alloy_signer::Signer + Send + Sync,
T: alloy::signers::Signer + Send + Sync,
{
async fn sign_request(
&self,
request: &SignRequest,
) -> Result<alloy_primitives::Signature, alloy_signer::Error> {
) -> Result<alloy_primitives::Signature, alloy::signers::Error> {
let hash = request.signing_hash();
self.sign_hash(&hash).await
}
Expand Down
4 changes: 2 additions & 2 deletions crates/types/src/resp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mod test {
ru_reward_address: Address::repeat_byte(6),
contents: [7u8; 32].into(),
};
let signer = alloy_signer_local::PrivateKeySigner::from_slice(&[8u8; 32]).unwrap();
let signer = alloy::signers::local::PrivateKeySigner::from_slice(&[8u8; 32]).unwrap();
let sig = signer.sign_request(&req).await.unwrap();
let resp = SignResponse { req, sig };
let addr = resp.signer().unwrap();
Expand All @@ -59,7 +59,7 @@ mod test {
ru_reward_address: Address::repeat_byte(6),
contents: [7u8; 32].into(),
};
let signer = alloy_signer_local::PrivateKeySigner::from_slice(&[8u8; 32]).unwrap();
let signer = alloy::signers::local::PrivateKeySigner::from_slice(&[8u8; 32]).unwrap();

let sig = signer.sign_request(&req).await.unwrap();

Expand Down