Skip to content

Commit 7ce5ce6

Browse files
committed
thing: thing thing the thing
1 parent 2dffd30 commit 7ce5ce6

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ tokio = { version = "1.36.0", features = ["full", "macros", "rt-multi-thread"] }
5656
tokio-stream = "0.1.17"
5757
url = "2.5.4"
5858
thiserror = "2.0.17"
59+
futures-util = "0.3.31"
5960

6061
[dev-dependencies]
6162
alloy-hardforks = "0.4.0"

src/quincey.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,23 @@ pub enum QuinceyError {
2525

2626
/// Error contacting the remote quincey API.
2727
#[error("Error contacting quincey API: {0}")]
28-
Remote(#[from] reqwest::Error),
28+
Remote(reqwest::Error),
2929

3030
/// Error with the owned signet.
3131
#[error("Error with owned signet: {0}")]
3232
Owned(#[from] eyre::Report),
3333
}
3434

35+
impl From<reqwest::Error> for QuinceyError {
36+
fn from(err: reqwest::Error) -> Self {
37+
if err.status() == Some(reqwest::StatusCode::FORBIDDEN) {
38+
QuinceyError::NotOurSlot
39+
} else {
40+
QuinceyError::Remote(err)
41+
}
42+
}
43+
}
44+
3545
/// A quincey client for making requests to the Quincey API.
3646
#[derive(Debug, Clone)]
3747
pub enum Quincey {
@@ -89,23 +99,9 @@ impl Quincey {
8999

90100
let token = token.secret().await?;
91101

92-
let resp = client
93-
.post(url.clone())
94-
.json(sig_request)
95-
.bearer_auth(token)
96-
.send()
97-
.await
98-
.map_err(QuinceyError::Remote)?;
99-
100-
if resp.status() == reqwest::StatusCode::FORBIDDEN {
101-
return Err(QuinceyError::NotOurSlot);
102-
}
102+
let resp = client.post(url.clone()).json(sig_request).bearer_auth(token).send().await?;
103103

104-
resp.error_for_status()
105-
.map_err(QuinceyError::Remote)?
106-
.json::<SignResponse>()
107-
.await
108-
.map_err(QuinceyError::Remote)
104+
resp.error_for_status()?.json::<SignResponse>().await.map_err(QuinceyError::Remote)
109105
}
110106

111107
/// Get a signature for the provided request, by either using the owned

src/tasks/submit/flashbots.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl FlashbotsTask {
112112
);
113113

114114
let tx = prep.prep_transaction(sim_result.prev_host()).await?;
115+
115116
let sendable = self
116117
.host_provider()
117118
.fill(tx.into_request())

src/tasks/submit/prep.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use alloy::{
1111
rpc::types::TransactionRequest,
1212
sol_types::SolCall,
1313
};
14+
use futures_util::FutureExt;
1415
use init4_bin_base::deps::metrics::counter;
1516
use signet_sim::BuiltBlock;
1617
use signet_types::{SignRequest, SignResponse};
@@ -103,14 +104,13 @@ impl<'a> SubmitPrep<'a> {
103104
}
104105

105106
/// Encodes the rollup block into a sidecar.
107+
#[instrument(skip(self), level = "debug")]
106108
async fn build_sidecar(&self) -> eyre::Result<BlobTransactionSidecar> {
107-
let sidecar = self.block.encode_blob::<SimpleCoder>().build()?;
108-
109-
Ok(sidecar)
109+
self.block.encode_blob::<SimpleCoder>().build().map_err(Into::into)
110110
}
111111

112112
/// Build a signature and header input for the host chain transaction.
113-
async fn build_input(&self) -> eyre::Result<Vec<u8>> {
113+
async fn build_input(&self) -> eyre::Result<Bytes> {
114114
let (v, r, s) = self.quincey_signature().await?;
115115

116116
let header = Zenith::BlockHeader {
@@ -120,19 +120,21 @@ impl<'a> SubmitPrep<'a> {
120120
rewardAddress: self.sig_request().ru_reward_address,
121121
blockDataHash: *self.block.contents_hash(),
122122
};
123-
debug!(?header.hostBlockNumber, "built zenith block header");
124-
125-
let data = Zenith::submitBlockCall { header, v, r, s, _4: Bytes::new() }.abi_encode();
123+
let call = Zenith::submitBlockCall { header, v, r, s, _4: Bytes::new() };
126124

127-
Ok(data)
125+
Ok(call.abi_encode().into())
128126
}
129127

130128
/// Create a new transaction request for the host chain.
131129
async fn new_tx_request(&self) -> eyre::Result<TransactionRequest> {
132-
let nonce =
133-
self.provider.get_transaction_count(self.provider.default_signer_address()).await?;
130+
let nonce_fut = self
131+
.provider
132+
.get_transaction_count(self.provider.default_signer_address())
133+
.into_future()
134+
.map(|res| res.map_err(Into::into));
134135

135-
let (sidecar, input) = try_join!(self.build_sidecar(), self.build_input())?;
136+
let (nonce, sidecar, input) =
137+
try_join!(nonce_fut, self.build_sidecar(), self.build_input())?;
136138

137139
let tx = TransactionRequest::default()
138140
.with_blob_sidecar(sidecar)
@@ -144,7 +146,6 @@ impl<'a> SubmitPrep<'a> {
144146
}
145147

146148
/// Prepares a transaction for submission to the host chain.
147-
#[instrument(skip_all, level = "debug")]
148149
pub async fn prep_transaction(self, prev_host: &Header) -> eyre::Result<Bumpable> {
149150
let req = self.new_tx_request().in_current_span().await?;
150151
Ok(Bumpable::new(req, prev_host))

0 commit comments

Comments
 (0)