Skip to content

Commit 53af4b3

Browse files
committed
chore: update to [email protected]
- adds init4 metrics - updates provider types to account for alloy changes
1 parent e815024 commit 53af4b3

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ path = "bin/submit_transaction.rs"
2424
[dependencies]
2525
init4-bin-base = "0.1.0"
2626

27-
zenith-types = "0.13"
27+
zenith-types = "0.15"
2828

29-
alloy = { version = "0.7.3", features = ["full", "json-rpc", "signer-aws", "rpc-types-mev", "rlp"] }
29+
alloy = { version = "=0.11.1", features = ["full", "json-rpc", "signer-aws", "rpc-types-mev", "rlp", "node-bindings"] }
3030

3131
aws-config = "1.1.7"
3232
aws-sdk-kms = "1.15.0"
@@ -48,3 +48,5 @@ tokio = { version = "1.36.0", features = ["full", "macros", "rt-multi-thread"] }
4848

4949
async-trait = "0.1.80"
5050
oauth2 = "4.4.2"
51+
metrics = "0.24.1"
52+
metrics-exporter-prometheus = "0.16.0"

bin/submit_transaction.rs

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ async fn connect_from_config() -> (Provider, Address, u64) {
8282
let signer = AwsSigner::new(client, kms_key_id.to_string(), Some(chain_id)).await.unwrap();
8383

8484
let provider = ProviderBuilder::new()
85-
.with_recommended_fillers()
8685
.wallet(EthereumWallet::from(signer))
8786
.on_builtin(&rpc_url)
8887
.await

src/config.rs

+22-24
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use alloy::{
99
},
1010
Identity, ProviderBuilder, RootProvider,
1111
},
12-
transports::BoxTransport,
1312
};
1413
use std::{borrow::Cow, env, num, str::FromStr};
14+
1515
use zenith_types::Zenith;
1616

1717
// Keys for .env variables that need to be set to configure the builder.
@@ -125,7 +125,7 @@ impl ConfigError {
125125
}
126126
}
127127

128-
/// Provider type used to read & write.
128+
/// Defines a full provider
129129
pub type Provider = FillProvider<
130130
JoinFill<
131131
JoinFill<
@@ -134,26 +134,22 @@ pub type Provider = FillProvider<
134134
>,
135135
WalletFiller<EthereumWallet>,
136136
>,
137-
RootProvider<BoxTransport>,
138-
BoxTransport,
137+
RootProvider,
139138
Ethereum,
140139
>;
141140

142-
/// Provider type used to read-only.
141+
/// Defines a read-only wallet
143142
pub type WalletlessProvider = FillProvider<
144143
JoinFill<
145144
Identity,
146145
JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>,
147146
>,
148-
RootProvider<BoxTransport>,
149-
BoxTransport,
147+
RootProvider,
150148
Ethereum,
151149
>;
152150

153-
/// A Zenith contract instance, using some provider `P` (defaults to
154-
/// [`Provider`]).
155-
pub type ZenithInstance<P = Provider> =
156-
Zenith::ZenithInstance<BoxTransport, P, alloy::network::Ethereum>;
151+
/// Defines a [`Zenith`] instance that is generic over [`Provider`]
152+
pub type ZenithInstance = Zenith::ZenithInstance<(), Provider, alloy::network::Ethereum>;
157153

158154
impl BuilderConfig {
159155
/// Load the builder configuration from environment variables.
@@ -210,32 +206,33 @@ impl BuilderConfig {
210206

211207
/// Connect to the Rollup rpc provider.
212208
pub async fn connect_ru_provider(&self) -> Result<WalletlessProvider, ConfigError> {
213-
ProviderBuilder::new()
214-
.with_recommended_fillers()
209+
let provider = ProviderBuilder::new()
215210
.on_builtin(&self.ru_rpc_url)
216211
.await
217-
.map_err(Into::into)
212+
.map_err(ConfigError::Provider)?;
213+
214+
Ok(provider)
218215
}
219216

220217
/// Connect to the Host rpc provider.
221218
pub async fn connect_host_provider(&self) -> Result<Provider, ConfigError> {
222219
let builder_signer = self.connect_builder_signer().await?;
223-
ProviderBuilder::new()
224-
.with_recommended_fillers()
220+
let provider = ProviderBuilder::new()
225221
.wallet(EthereumWallet::from(builder_signer))
226222
.on_builtin(&self.host_rpc_url)
227223
.await
228-
.map_err(Into::into)
224+
.map_err(ConfigError::Provider)?;
225+
226+
Ok(provider)
229227
}
230228

231-
/// Connect additional broadcast providers.
232-
pub async fn connect_additional_broadcast(
233-
&self,
234-
) -> Result<Vec<RootProvider<BoxTransport>>, ConfigError> {
235-
let mut providers = Vec::with_capacity(self.tx_broadcast_urls.len());
229+
/// Connect additionally configured non-host providers to broadcast transactions to.
230+
pub async fn connect_additional_broadcast(&self) -> Result<Vec<WalletlessProvider>, ConfigError> {
231+
let mut providers: Vec<WalletlessProvider> = Vec::with_capacity(self.tx_broadcast_urls.len());
236232
for url in self.tx_broadcast_urls.iter() {
237233
let provider =
238-
ProviderBuilder::new().on_builtin(url).await.map_err(Into::<ConfigError>::into)?;
234+
ProviderBuilder::new().on_builtin(url).await.map_err(ConfigError::Provider)?;
235+
239236
providers.push(provider);
240237
}
241238
Ok(providers)
@@ -278,5 +275,6 @@ pub fn load_url(key: &str) -> Result<Cow<'static, str>, ConfigError> {
278275
/// Load an address from an environment variable.
279276
pub fn load_address(key: &str) -> Result<Address, ConfigError> {
280277
let address = load_string(key)?;
281-
Address::from_str(&address).map_err(Into::into)
278+
Address::from_str(&address)
279+
.map_err(|_| ConfigError::Var(format!("Invalid address format for {}", key)))
282280
}

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ pub mod tasks;
2727
/// Utilities.
2828
pub mod utils;
2929

30+
/// Anonymous crate dependency imports.
31+
use metrics as _;
32+
use metrics_exporter_prometheus as _;
3033
use openssl as _;

0 commit comments

Comments
 (0)