Skip to content

Commit 9cc8cbf

Browse files
authored
BM-245: Add timeout to set-verifier module (github#69)
This PR addresses a bug where the txn_timeout was not applied to the set-verifier module. Additionally I refactored the default TXN_TIMEOUT to be shared and increased from 30 -> 45s defaults
1 parent 62ee118 commit 9cc8cbf

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

crates/boundless-market/src/contracts/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ use alloy_primitives::{
1919
};
2020
use alloy_sol_types::{eip712_domain, Eip712Domain};
2121
use serde::{Deserialize, Serialize};
22+
use std::time::Duration;
2223
#[cfg(not(target_os = "zkvm"))]
2324
use thiserror::Error;
2425
use url::Url;
2526

2627
use risc0_zkvm::sha::Digest;
2728

29+
const TXN_CONFIRM_TIMEOUT: Duration = Duration::from_secs(45);
30+
2831
// proof_market.rs is a copy of IProofMarket.sol with alloy derive statements added.
2932
// See the build.rs script in this crate for more details.
3033
include!(concat!(env!("OUT_DIR"), "/proof_market.rs"));

crates/boundless-market/src/contracts/proof_market.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use thiserror::Error;
1818
use super::{
1919
request_id, Fulfillment,
2020
IProofMarket::{self, IProofMarketErrors, IProofMarketInstance},
21-
Offer, ProofStatus, ProvingRequest, TxnErr,
21+
Offer, ProofStatus, ProvingRequest, TxnErr, TXN_CONFIRM_TIMEOUT,
2222
};
2323

2424
/// Proof market errors.
@@ -97,7 +97,7 @@ where
9797
Self {
9898
instance,
9999
caller,
100-
timeout: Duration::from_secs(30),
100+
timeout: TXN_CONFIRM_TIMEOUT,
101101
event_query_config: EventQueryConfig::default(),
102102
}
103103
}

crates/boundless-market/src/contracts/set_verifier.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ use alloy::{
1212
};
1313
use anyhow::{Context, Result};
1414

15-
use super::IRiscZeroSetVerifier::{self, IRiscZeroSetVerifierErrors, IRiscZeroSetVerifierInstance};
15+
use super::{
16+
IRiscZeroSetVerifier::{self, IRiscZeroSetVerifierErrors, IRiscZeroSetVerifierInstance},
17+
TXN_CONFIRM_TIMEOUT,
18+
};
1619

1720
#[derive(Clone)]
1821
pub struct SetVerifierService<T, P> {
@@ -26,12 +29,10 @@ where
2629
T: Transport + Clone,
2730
P: Provider<T, Ethereum> + 'static + Clone,
2831
{
29-
const TX_TIMEOUT: Duration = Duration::from_secs(30);
30-
3132
pub fn new(address: Address, provider: P, caller: Address) -> Self {
3233
let instance = IRiscZeroSetVerifier::new(address, provider);
3334

34-
Self { instance, caller, tx_timeout: Self::TX_TIMEOUT }
35+
Self { instance, caller, tx_timeout: TXN_CONFIRM_TIMEOUT }
3536
}
3637

3738
pub fn instance(&self) -> &IRiscZeroSetVerifierInstance<T, P, Ethereum> {

crates/broker/src/submitter.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ where
6767
market = market.with_timeout(Duration::from_secs(txn_timeout));
6868
}
6969

70-
let set_verifier = SetVerifierService::new(
70+
let mut set_verifier = SetVerifierService::new(
7171
set_verifier_addr,
7272
provider.clone(),
7373
provider.default_signer_address(),
7474
);
75+
if let Some(txn_timeout) = txn_timeout_opt {
76+
set_verifier.with_timeout(Duration::from_secs(txn_timeout));
77+
}
7578

7679
Ok(Self { db, prover, market, set_verifier, set_builder_img_id })
7780
}

0 commit comments

Comments
 (0)