Skip to content

fix: submit channel refactors #94

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

Merged
merged 11 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ integration = []
[dependencies]
init4-bin-base = { version = "0.4.1", features = ["perms"] }

signet-constants = { git = "https://github.com/init4tech/signet-sdk", rev = "bd183b627dcb0eb682da801093b13f1f8311446b" }
signet-sim = { git = "https://github.com/init4tech/signet-sdk", rev = "bd183b627dcb0eb682da801093b13f1f8311446b" }
signet-tx-cache = { git = "https://github.com/init4tech/signet-sdk", rev = "bd183b627dcb0eb682da801093b13f1f8311446b" }
signet-types = { git = "https://github.com/init4tech/signet-sdk", rev = "bd183b627dcb0eb682da801093b13f1f8311446b" }
signet-zenith = { git = "https://github.com/init4tech/signet-sdk", rev = "bd183b627dcb0eb682da801093b13f1f8311446b" }
signet-constants = { git = "https://github.com/init4tech/signet-sdk", rev = "ba5894f6fac35299d495ae115cd465a1f0791637" }
signet-sim = { git = "https://github.com/init4tech/signet-sdk", rev = "ba5894f6fac35299d495ae115cd465a1f0791637" }
signet-tx-cache = { git = "https://github.com/init4tech/signet-sdk", rev = "ba5894f6fac35299d495ae115cd465a1f0791637" }
signet-types = { git = "https://github.com/init4tech/signet-sdk", rev = "ba5894f6fac35299d495ae115cd465a1f0791637" }
signet-zenith = { git = "https://github.com/init4tech/signet-sdk", rev = "ba5894f6fac35299d495ae115cd465a1f0791637" }
Comment on lines 28 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's upgrade this to the 0.2.0 tag (we can now just use tag instead)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless we need test-utils or rpc, we can actually skip the tag = and just use published?


trevm = { version = "0.23.4", features = ["concurrent-db", "test-utils"] }

Expand Down
16 changes: 8 additions & 8 deletions bin/submit_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use builder::config::HostProvider;
use init4_bin_base::{
deps::{
metrics::{counter, histogram},
tracing,
tracing::{debug, error},
},
init4,
utils::{from_env::FromEnv, signer::LocalOrAwsConfig},
Expand Down Expand Up @@ -52,16 +52,17 @@ async fn main() {
let _guard = init4();

let config = Config::from_env().unwrap();
tracing::trace!("connecting to provider");
debug!(?config.recipient_address, "connecting to provider");

let provider = config.provider().await;
let recipient_address = config.recipient_address;
let sleep_time = config.sleep_time;

loop {
tracing::debug!("attempting transaction");
debug!(?recipient_address, "attempting transaction");
send_transaction(&provider, recipient_address).await;

tracing::debug!(sleep_time, "sleeping");
debug!(sleep_time, "sleeping");
tokio::time::sleep(tokio::time::Duration::from_secs(sleep_time)).await;
}
}
Expand All @@ -78,18 +79,17 @@ async fn send_transaction(provider: &HostProvider, recipient_address: Address) {
let dispatch_start_time: Instant = Instant::now();

// dispatch the transaction
tracing::debug!("dispatching transaction");
let result = provider.send_transaction(tx).await.unwrap();

// wait for the transaction to mine
let receipt = match timeout(Duration::from_secs(240), result.get_receipt()).await {
Ok(Ok(receipt)) => receipt,
Ok(Err(e)) => {
tracing::error!(error = ?e, "failed to get transaction receipt");
error!(error = ?e, "failed to get transaction receipt");
return;
}
Err(_) => {
tracing::error!("timeout waiting for transaction receipt");
error!("timeout waiting for transaction receipt");
counter!("txn_submitter.tx_timeout").increment(1);
return;
}
Expand All @@ -99,6 +99,6 @@ async fn send_transaction(provider: &HostProvider, recipient_address: Address) {

// record metrics for how long it took to mine the transaction
let mine_time = dispatch_start_time.elapsed().as_secs();
tracing::debug!(success = receipt.status(), mine_time, hash, "transaction mined");
debug!(success = receipt.status(), mine_time, hash, "transaction mined");
histogram!("txn_submitter.tx_mine_time").record(mine_time as f64);
}
5 changes: 3 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ pub struct BuilderConfig {
/// NOTE: should not include the host_rpc_url value
#[from_env(
var = "TX_BROADCAST_URLS",
desc = "Additional RPC URLs to which to broadcast transactions",
infallible
desc = "Additional RPC URLs to which the builder broadcasts transactions",
infallible,
optional
)]
pub tx_broadcast_urls: Vec<Cow<'static, str>>,
/// address of the Zenith contract on Host.
Expand Down
9 changes: 4 additions & 5 deletions src/tasks/block/sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ impl Simulator {
self.config.rollup_block_gas_limit,
);

let block = block_build.build().await;
debug!(block = ?block, "finished block simulation");
let built_block = block_build.build().await;
debug!(block_number = ?built_block.block_number(), "finished building block");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ? is unnecessary, as block_number is a u64 which is a valid tracing value


Ok(block)
Ok(built_block)
}

/// Spawns the simulator task, which handles the setup and sets the deadline
Expand Down Expand Up @@ -155,8 +155,7 @@ impl Simulator {

// If no env, skip this run
let Some(block_env) = self.block_env.borrow_and_update().clone() else { return };

debug!(block_env = ?block_env, "building on block");
debug!(block_env = ?block_env, "building on block env");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug!(?block_env, ...)
no need to do = as we're not renaming or invoking any expressions


match self.handle_build(constants, sim_cache, finish_by, block_env).await {
Ok(block) => {
Expand Down
Loading
Loading