Skip to content

Commit 3ec2a49

Browse files
committed
feat: adds bundle helper submission call
1 parent 59ba745 commit 3ec2a49

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ name = "zenith-builder-example"
1818
path = "bin/builder.rs"
1919

2020
[dependencies]
21-
zenith-types = { git = "https://github.com/init4tech/zenith-rs", branch = "main" }
21+
zenith-types = { git = "https://github.com/init4tech/zenith-rs", branch = "dylan/adds-bundle-helper-abi" }
2222

2323
alloy-primitives = { version = "=0.8.8", features = ["serde", "tiny-keccak"] }
2424
alloy-sol-types = { version = "=0.8.8", features = ["json"] }

src/tasks/submit.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use alloy::{
77
consensus::{constants::GWEI_TO_WEI, SimpleCoder},
88
eips::BlockNumberOrTag,
99
network::{TransactionBuilder, TransactionBuilder4844},
10+
providers::Provider as _,
1011
providers::SendableTx,
11-
providers::{Provider as _, WalletProvider},
1212
rpc::types::eth::TransactionRequest,
1313
signers::Signer,
1414
sol_types::SolCall,
@@ -23,6 +23,7 @@ use std::time::Instant;
2323
use tokio::{sync::mpsc, task::JoinHandle};
2424
use tracing::{debug, error, instrument, trace};
2525
use zenith_types::{
26+
bundle_helper::{submitCall, BlockHeader, FillPermit2},
2627
SignRequest, SignResponse,
2728
Zenith::{self, IncorrectHostBlock},
2829
};
@@ -142,19 +143,33 @@ impl SubmitTask {
142143
let r: FixedBytes<32> = resp.sig.r().into();
143144
let s: FixedBytes<32> = resp.sig.s().into();
144145

145-
let header = Zenith::BlockHeader {
146+
// TODO: Build fills
147+
let fills: Vec<FillPermit2> = vec![];
148+
149+
let header = BlockHeader {
146150
hostBlockNumber: resp.req.host_block_number,
147151
rollupChainId: U256::from(self.config.ru_chain_id),
148152
gasLimit: resp.req.gas_limit,
149153
rewardAddress: resp.req.ru_reward_address,
150154
blockDataHash: in_progress.contents_hash(),
151155
};
152156

153-
let tx = self
154-
.build_blob_tx(header, v, r, s, in_progress)?
155-
.with_from(self.host_provider.default_signer_address())
156-
.with_to(self.config.zenith_address)
157-
.with_gas_limit(1_000_000);
157+
let submit_call = submitCall { fills, header, v, r, s }.abi_encode();
158+
159+
let tx = TransactionRequest::default()
160+
.with_input(submit_call)
161+
.with_max_priority_fee_per_gas((GWEI_TO_WEI * 16) as u128);
162+
163+
if let Err(TransportError::ErrorResp(e)) =
164+
self.host_provider.call(&tx).block(BlockNumberOrTag::Pending.into()).await
165+
{
166+
error!(
167+
code = e.code,
168+
message = %e.message,
169+
data = ?e.data,
170+
"error in transaction submission"
171+
);
172+
}
158173

159174
if let Err(TransportError::ErrorResp(e)) =
160175
self.host_provider.call(&tx).block(BlockNumberOrTag::Pending.into()).await

0 commit comments

Comments
 (0)