Skip to content

Commit da4b819

Browse files
committed
feat: adds bundle helper submission call
1 parent dfa90a0 commit da4b819

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

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.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.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.provider.call(&tx).block(BlockNumberOrTag::Pending.into()).await

0 commit comments

Comments
 (0)