Skip to content

Commit af0df0f

Browse files
committed
chore: fmt
1 parent aa92400 commit af0df0f

File tree

7 files changed

+58
-22
lines changed

7 files changed

+58
-22
lines changed

bin/builder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ async fn main() -> eyre::Result<()> {
1414
let config = BuilderConfig::load_from_env()?;
1515
let provider = config.connect_provider().await?;
1616

17-
tracing::debug!(rpc_url = config.host_rpc_url.as_ref(), "instantiated provider");
17+
tracing::debug!(
18+
rpc_url = config.host_rpc_url.as_ref(),
19+
"instantiated provider"
20+
);
1821

1922
let sequencer_signer = config.connect_sequencer_signer().await?;
2023
let zenith = config.connect_zenith(provider.clone());

src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ impl BuilderConfig {
154154
}
155155

156156
pub async fn connect_builder_signer(&self) -> Result<LocalOrAws, ConfigError> {
157-
LocalOrAws::load(&self.builder_key, Some(self.host_chain_id)).await.map_err(Into::into)
157+
LocalOrAws::load(&self.builder_key, Some(self.host_chain_id))
158+
.await
159+
.map_err(Into::into)
158160
}
159161

160162
pub async fn connect_sequencer_signer(&self) -> Result<Option<LocalOrAws>, ConfigError> {

src/service.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,27 @@ pub struct AppError {
3030
impl AppError {
3131
/// Instantiate a new error with the bad request status code.
3232
pub fn bad_req<E: std::error::Error + Send + Sync + 'static>(e: E) -> Self {
33-
Self { code: StatusCode::BAD_REQUEST, eyre: e.into() }
33+
Self {
34+
code: StatusCode::BAD_REQUEST,
35+
eyre: e.into(),
36+
}
3437
}
3538

3639
/// Instantiate a new error with the bad request status code and an error
3740
/// string.
3841
pub fn bad_req_str(e: &str) -> Self {
39-
Self { code: StatusCode::BAD_REQUEST, eyre: eyre::eyre!(e.to_owned()) }
42+
Self {
43+
code: StatusCode::BAD_REQUEST,
44+
eyre: eyre::eyre!(e.to_owned()),
45+
}
4046
}
4147

4248
/// Instantiate a new error with the internal server error status code.
4349
pub fn server_err<E: std::error::Error + Send + Sync + 'static>(e: E) -> Self {
44-
Self { code: StatusCode::INTERNAL_SERVER_ERROR, eyre: e.into() }
50+
Self {
51+
code: StatusCode::INTERNAL_SERVER_ERROR,
52+
eyre: e.into(),
53+
}
4554
}
4655
}
4756

src/signer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ impl LocalOrAws {
5050
async fn aws_signer(key_id: &str, chain_id: Option<u64>) -> Result<AwsSigner, SignerError> {
5151
let config = aws_config::load_defaults(BehaviorVersion::latest()).await;
5252
let client = aws_sdk_kms::Client::new(&config);
53-
AwsSigner::new(client, key_id.to_string(), chain_id).await.map_err(Into::into)
53+
AwsSigner::new(client, key_id.to_string(), chain_id)
54+
.await
55+
.map_err(Into::into)
5456
}
5557
}
5658

src/tasks/block.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ pub struct InProgressBlock {
1919
impl InProgressBlock {
2020
/// Create a new `InProgressBlock`
2121
pub fn new() -> Self {
22-
Self { transactions: Vec::new(), raw_encoding: OnceLock::new(), hash: OnceLock::new() }
22+
Self {
23+
transactions: Vec::new(),
24+
raw_encoding: OnceLock::new(),
25+
hash: OnceLock::new(),
26+
}
2327
}
2428

2529
/// Get the number of transactions in the block.
@@ -40,8 +44,10 @@ impl InProgressBlock {
4044

4145
/// Seal the block by encoding the transactions and calculating the contentshash.
4246
fn seal(&self) {
43-
self.raw_encoding.get_or_init(|| encode_txns::<Alloy2718Coder>(&self.transactions).into());
44-
self.hash.get_or_init(|| keccak256(self.raw_encoding.get().unwrap().as_ref()));
47+
self.raw_encoding
48+
.get_or_init(|| encode_txns::<Alloy2718Coder>(&self.transactions).into());
49+
self.hash
50+
.get_or_init(|| keccak256(self.raw_encoding.get().unwrap().as_ref()));
4551
}
4652

4753
/// Ingest a transaction into the in-progress block. Fails

src/tasks/submit.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,18 @@ impl SubmitTask {
109109
s: FixedBytes<32>,
110110
in_progress: &InProgressBlock,
111111
) -> eyre::Result<TransactionRequest> {
112-
let data = Zenith::submitBlockCall { header, v, r, s, _4: Default::default() }.abi_encode();
112+
let data = Zenith::submitBlockCall {
113+
header,
114+
v,
115+
r,
116+
s,
117+
_4: Default::default(),
118+
}
119+
.abi_encode();
113120
let sidecar = in_progress.encode_blob::<SimpleCoder>().build()?;
114-
Ok(TransactionRequest::default().with_blob_sidecar(sidecar).with_input(data))
121+
Ok(TransactionRequest::default()
122+
.with_blob_sidecar(sidecar)
123+
.with_input(data))
115124
}
116125

117126
async fn host_block_height(&self) -> eyre::Result<u64> {
@@ -191,7 +200,10 @@ impl SubmitTask {
191200
sig = hex::encode(sig.as_bytes()),
192201
"acquired signature from local signer"
193202
);
194-
SignResponse { req: sig_request, sig }
203+
SignResponse {
204+
req: sig_request,
205+
sig,
206+
}
195207
} else {
196208
let resp: SignResponse = self.sup_quincey(&sig_request).await?;
197209
tracing::debug!(

src/tasks/tx_poller.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ pub struct TxPoller {
3232
impl TxPoller {
3333
/// returns a new TxPoller with the given config.
3434
pub fn new(config: &BuilderConfig) -> Self {
35-
Self { config: config.clone(), client: Client::new(), seen_txns: HashMap::new() }
35+
Self {
36+
config: config.clone(),
37+
client: Client::new(),
38+
seen_txns: HashMap::new(),
39+
}
3640
}
3741

3842
/// polls the tx-pool for unique transactions and evicts expired transactions.
@@ -66,15 +70,13 @@ impl TxPoller {
6670
let expired_keys: Vec<TxHash> = self
6771
.seen_txns
6872
.iter()
69-
.filter_map(
70-
|(key, &expiration)| {
71-
if !expiration.elapsed().is_zero() {
72-
Some(*key)
73-
} else {
74-
None
75-
}
76-
},
77-
)
73+
.filter_map(|(key, &expiration)| {
74+
if !expiration.elapsed().is_zero() {
75+
Some(*key)
76+
} else {
77+
None
78+
}
79+
})
7880
.collect();
7981

8082
for key in expired_keys {

0 commit comments

Comments
 (0)