Skip to content

Commit

Permalink
feat: adds bundle helper submission call
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanlott committed Dec 20, 2024
1 parent 7188a09 commit bdeb394
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ name = "integration-test"
path = "bin/submit_transaction.rs"

[dependencies]
zenith-types = { git = "https://github.com/init4tech/zenith-rs", tag = "v0.10.1" }
# zenith-types = { git = "https://github.com/init4tech/zenith-rs", tag = "v0.10.1" }
zenith-types = { git = "https://github.com/init4tech/zenith-rs", branch = "dylan/adds-bundle-helper-abi" } # for local dev

alloy-primitives = { version = "=0.8.8", features = ["serde", "tiny-keccak"] }
alloy-sol-types = { version = "=0.8.8", features = ["json"] }
Expand Down
29 changes: 22 additions & 7 deletions src/tasks/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use alloy::{
consensus::{constants::GWEI_TO_WEI, SimpleCoder},
eips::BlockNumberOrTag,
network::{TransactionBuilder, TransactionBuilder4844},
providers::Provider as _,
providers::SendableTx,
providers::{Provider as _, WalletProvider},
rpc::types::eth::TransactionRequest,
signers::Signer,
sol_types::SolCall,
Expand All @@ -23,6 +23,7 @@ use std::time::Instant;
use tokio::{sync::mpsc, task::JoinHandle};
use tracing::{debug, error, instrument, trace};
use zenith_types::{
bundle_helper::{submitCall, BlockHeader, FillPermit2},
SignRequest, SignResponse,
Zenith::{self, IncorrectHostBlock},
};
Expand Down Expand Up @@ -142,19 +143,33 @@ impl SubmitTask {
let r: FixedBytes<32> = resp.sig.r().into();
let s: FixedBytes<32> = resp.sig.s().into();

let header = Zenith::BlockHeader {
// TODO: Build fills
let fills: Vec<FillPermit2> = vec![];

let header = BlockHeader {
hostBlockNumber: resp.req.host_block_number,
rollupChainId: U256::from(self.config.ru_chain_id),
gasLimit: resp.req.gas_limit,
rewardAddress: resp.req.ru_reward_address,
blockDataHash: in_progress.contents_hash(),
};

let tx = self
.build_blob_tx(header, v, r, s, in_progress)?
.with_from(self.host_provider.default_signer_address())
.with_to(self.config.zenith_address)
.with_gas_limit(1_000_000);
let submit_call = submitCall { fills, header, v, r, s }.abi_encode();

let tx = TransactionRequest::default()
.with_input(submit_call)
.with_max_priority_fee_per_gas((GWEI_TO_WEI * 16) as u128);

if let Err(TransportError::ErrorResp(e)) =
self.host_provider.call(&tx).block(BlockNumberOrTag::Pending.into()).await
{
error!(
code = e.code,
message = %e.message,
data = ?e.data,
"error in transaction submission"
);
}

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

0 comments on commit bdeb394

Please sign in to comment.