Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: manually construct the nonce to always use latest #52

Closed
wants to merge 2 commits into from
Closed
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
15 changes: 13 additions & 2 deletions src/tasks/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl SubmitTask {
}

/// Builds blob transaction from the provided header and signature values
fn build_blob_tx(
async fn build_blob_tx(
&self,
fills: Vec<FillPermit2>,
header: BundleHelper::BlockHeader,
Expand All @@ -121,10 +121,20 @@ impl SubmitTask {
s: FixedBytes<32>,
in_progress: &InProgressBlock,
) -> eyre::Result<TransactionRequest> {
// Start of Selection
let data = zenith_types::BundleHelper::submitCall { fills, header, v, r, s }.abi_encode();

let sidecar = in_progress.encode_blob::<SimpleCoder>().build()?;

// Manually calculate the nonce
let latest_nonce = self
.host_provider
.get_transaction_count(self.host_provider.default_signer_address())
.latest()
.await?;

Ok(TransactionRequest::default()
.with_nonce(latest_nonce)
.with_blob_sidecar(sidecar)
.with_input(data)
.with_max_priority_fee_per_gas((GWEI_TO_WEI * 16) as u128))
Expand Down Expand Up @@ -155,7 +165,8 @@ impl SubmitTask {

let fills = vec![]; // NB: ignored until fills are implemented
let tx = self
.build_blob_tx(fills, header, v, r, s, in_progress)?
.build_blob_tx(fills, header, v, r, s, in_progress)
.await?
.with_from(self.host_provider.default_signer_address())
.with_to(self.config.builder_helper_address)
.with_gas_limit(1_000_000);
Expand Down