Skip to content

Commit 6d53728

Browse files
authored
chore: bumps alloy and zenith versions (#43)
- bump alloy up - remove alloy primitives and import primitives from alloy core instead - fix errors from alloy updates - remove signet-types and reference zenith-types instead
1 parent 54f4cef commit 6d53728

File tree

10 files changed

+30
-40
lines changed

10 files changed

+30
-40
lines changed

Cargo.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,18 @@ name = "transaction-submitter"
2222
path = "bin/submit_transaction.rs"
2323

2424
[dependencies]
25-
zenith-types = { git = "https://github.com/init4tech/zenith-rs", tag = "v0.10.1" }
25+
zenith-types = "0.13"
2626

27-
alloy-primitives = { version = "=0.8.8", features = ["serde", "tiny-keccak"] }
28-
alloy-sol-types = { version = "=0.8.8", features = ["json"] }
27+
alloy = { version = "0.7.3", features = ["full", "json-rpc", "signer-aws", "rpc-types-mev"] }
2928
alloy-rlp = { version = "0.3.4" }
3029

31-
alloy = { version = "0.5.4", features = ["full", "json-rpc", "signer-aws"] }
32-
3330
aws-config = "1.1.7"
3431
aws-sdk-kms = "1.15.0"
3532

3633
hex = { package = "const-hex", version = "1", default-features = false, features = [
3734
"alloc",
3835
] }
3936

40-
signet-types = { git = "ssh://[email protected]/init4tech/signet-node.git" }
41-
4237
serde = { version = "1.0.197", features = ["derive"] }
4338
tracing = "0.1.40"
4439

@@ -55,4 +50,4 @@ tracing-subscriber = "0.3.18"
5550
async-trait = "0.1.80"
5651
oauth2 = "4.4.2"
5752
metrics = "0.24.1"
58-
metrics-exporter-prometheus = "0.16.0"
53+
metrics-exporter-prometheus = "0.16.0"

bin/submit_transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use alloy::{
22
network::{EthereumWallet, TransactionBuilder},
3+
primitives::{Address, U256},
34
providers::{Provider as _, ProviderBuilder, WalletProvider},
45
rpc::types::eth::TransactionRequest,
56
signers::aws::AwsSigner,
67
};
7-
use alloy_primitives::Address;
88
use aws_config::BehaviorVersion;
99
use builder::config::{load_address, load_string, load_u64, load_url, Provider};
1010
use metrics::counter;
@@ -37,7 +37,7 @@ async fn send_transaction(provider: Provider, recipient_address: Address) {
3737
let tx = TransactionRequest::default()
3838
.with_from(provider.default_signer_address())
3939
.with_to(recipient_address)
40-
.with_value(alloy_primitives::U256::from(1))
40+
.with_value(U256::from(1))
4141
.with_gas_limit(30_000);
4242

4343
// start timer to measure how long it takes to mine the transaction

src/config.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use crate::signer::{LocalOrAws, SignerError};
22
use alloy::network::{Ethereum, EthereumWallet};
3+
use alloy::primitives::Address;
34
use alloy::providers::fillers::BlobGasFiller;
45
use alloy::providers::{
56
fillers::{ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, WalletFiller},
67
Identity, ProviderBuilder, RootProvider,
78
};
89
use alloy::transports::BoxTransport;
9-
use alloy_primitives::Address;
1010
use std::{borrow::Cow, env, num, str::FromStr};
1111
use zenith_types::Zenith;
1212

@@ -140,8 +140,7 @@ pub type WalletlessProvider = FillProvider<
140140
BoxTransport,
141141
Ethereum,
142142
>;
143-
144-
pub type ZenithInstance = Zenith::ZenithInstance<BoxTransport, Provider>;
143+
pub type ZenithInstance = Zenith::ZenithInstance<BoxTransport, Provider, alloy::network::Ethereum>;
145144

146145
impl BuilderConfig {
147146
/// Load the builder configuration from environment variables.
@@ -247,7 +246,7 @@ fn load_u16(key: &str) -> Result<u16, ConfigError> {
247246
}
248247

249248
pub fn load_url(key: &str) -> Result<Cow<'static, str>, ConfigError> {
250-
load_string(key).map_err(Into::into).map(Into::into)
249+
load_string(key).map(Into::into)
251250
}
252251

253252
pub fn load_address(key: &str) -> Result<Address, ConfigError> {

src/signer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use alloy::consensus::SignableTransaction;
2+
use alloy::primitives::{Address, ChainId, B256};
23
use alloy::signers::aws::{AwsSigner, AwsSignerError};
34
use alloy::signers::local::{LocalSignerError, PrivateKeySigner};
45
use alloy::signers::Signature;
5-
use alloy_primitives::{Address, ChainId, B256};
66
use aws_config::BehaviorVersion;
77

88
/// Abstraction over local signer or

src/tasks/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use super::bundler::{Bundle, BundlePoller};
22
use super::oauth::Authenticator;
33
use super::tx_poller::TxPoller;
44
use crate::config::{BuilderConfig, WalletlessProvider};
5+
use alloy::primitives::{keccak256, Bytes, B256};
56
use alloy::providers::Provider;
67
use alloy::{
78
consensus::{SidecarBuilder, SidecarCoder, TxEnvelope},
89
eips::eip2718::Decodable2718,
910
};
10-
use alloy_primitives::{keccak256, Bytes, B256};
1111
use alloy_rlp::Buf;
1212
use std::time::{SystemTime, UNIX_EPOCH};
1313
use std::{sync::OnceLock, time::Duration};
@@ -98,7 +98,7 @@ impl InProgressBlock {
9898
}
9999

100100
/// Calculate the hash of the in-progress block, finishing the block.
101-
pub fn contents_hash(&self) -> alloy_primitives::B256 {
101+
pub fn contents_hash(&self) -> B256 {
102102
self.seal();
103103
*self.hash.get().unwrap()
104104
}

src/tasks/bundler.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
//! Bundler service responsible for polling and submitting bundles to the in-progress block.
2-
use std::time::{Duration, Instant};
1+
//! Bundler service responsible for managing bundles.
2+
use super::oauth::Authenticator;
33

44
pub use crate::config::BuilderConfig;
5-
use alloy_primitives::map::HashMap;
6-
use reqwest::Url;
7-
use serde::{Deserialize, Serialize};
8-
use signet_types::SignetEthBundle;
95

106
use oauth2::TokenResponse;
11-
12-
use super::oauth::Authenticator;
7+
use reqwest::Url;
8+
use serde::{Deserialize, Serialize};
9+
use std::collections::HashMap;
10+
use std::time::{Duration, Instant};
11+
use zenith_types::ZenithEthBundle;
1312

1413
#[derive(Debug, Clone, Serialize, Deserialize)]
1514
pub struct Bundle {
1615
pub id: String,
17-
pub bundle: SignetEthBundle,
16+
pub bundle: ZenithEthBundle,
1817
}
1918

2019
/// Response from the tx-pool containing a list of bundles.
@@ -23,6 +22,7 @@ pub struct TxPoolBundleResponse {
2322
pub bundles: Vec<Bundle>,
2423
}
2524

25+
/// The BundlePoller polls the tx-pool for bundles and manages the seen bundles.
2626
pub struct BundlePoller {
2727
pub config: BuilderConfig,
2828
pub authenticator: Authenticator,

src/tasks/oauth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Authenticator {
119119

120120
mod tests {
121121
use crate::config::BuilderConfig;
122-
use alloy_primitives::Address;
122+
use alloy::primitives::Address;
123123
use eyre::Result;
124124

125125
#[ignore = "integration test"]

src/tasks/submit.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,22 @@ use crate::{
66
use alloy::{
77
consensus::{constants::GWEI_TO_WEI, SimpleCoder},
88
eips::BlockNumberOrTag,
9-
network::{TransactionBuilder, TransactionBuilder4844},
10-
providers::SendableTx,
11-
providers::{Provider as _, WalletProvider},
9+
network::TransactionBuilder,
10+
network::TransactionBuilder4844,
11+
primitives::{FixedBytes, U256},
12+
providers::{Provider as _, SendableTx, WalletProvider},
1213
rpc::types::eth::TransactionRequest,
1314
signers::Signer,
14-
sol_types::SolCall,
15+
sol_types::{SolCall, SolError},
1516
transports::TransportError,
1617
};
17-
use alloy_primitives::{FixedBytes, U256};
18-
use alloy_sol_types::SolError;
1918
use eyre::{bail, eyre};
2019
use metrics::{counter, histogram};
2120
use oauth2::TokenResponse;
2221
use std::time::Instant;
2322
use tokio::{sync::mpsc, task::JoinHandle};
2423
use tracing::{debug, error, instrument, trace};
25-
use zenith_types::{
26-
SignRequest, SignResponse,
27-
Zenith::{self, IncorrectHostBlock},
28-
};
24+
use zenith_types::{SignRequest, SignResponse, Zenith, Zenith::IncorrectHostBlock};
2925

3026
macro_rules! spawn_provider_send {
3127
($provider:expr, $tx:expr) => {
@@ -138,7 +134,7 @@ impl SubmitTask {
138134
resp: &SignResponse,
139135
in_progress: &InProgressBlock,
140136
) -> eyre::Result<ControlFlow> {
141-
let v: u8 = resp.sig.v().y_parity_byte() + 27;
137+
let v = resp.sig.v().into();
142138
let r: FixedBytes<32> = resp.sig.r().into();
143139
let s: FixedBytes<32> = resp.sig.s().into();
144140

tests/bundle_poller_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod tests {
2-
use alloy_primitives::Address;
2+
use alloy::primitives::Address;
33
use builder::{config::BuilderConfig, tasks::oauth::Authenticator};
44
use eyre::Result;
55

tests/tx_poller_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ mod tests {
22
use std::str::FromStr;
33

44
use alloy::consensus::{SignableTransaction, TxEip1559, TxEnvelope};
5+
use alloy::primitives::{bytes, Address, TxKind, U256};
56
use alloy::signers::{local::PrivateKeySigner, SignerSync};
6-
use alloy_primitives::{bytes, Address, TxKind, U256};
77
use builder::config::BuilderConfig;
88
use builder::tasks::tx_poller;
99
use eyre::{Ok, Result};

0 commit comments

Comments
 (0)