Skip to content

Commit c050e7f

Browse files
committed
added tx timeout option
1 parent 07743ad commit c050e7f

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dria-oracle"
33
description = "Dria Knowledge Network Oracle Node"
4-
version = "0.2.0"
4+
version = "0.2.1"
55
edition = "2021"
66
license = "Apache-2.0"
77
readme = "README.md"

src/cli/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ struct Cli {
2828
/// Ethereum wallet's secret (private) key.
2929
#[arg(short, long, env = "SECRET_KEY", value_parser = parse_secret_key)]
3030
secret_key: B256,
31+
32+
#[arg(short, long, env = "TX_TIMEOUT_SECS", default_value = "30")]
33+
tx_timeout: Option<u64>,
3134
}
3235

3336
/// Main CLI entry point.

src/configurations/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Default for DriaOracleConfig {
2626
impl DriaOracleConfig {
2727
pub fn new(secret_key: &B256, rpc_url: Url) -> Result<Self> {
2828
let signer =
29-
PrivateKeySigner::from_bytes(secret_key).wrap_err("Could not parse private key")?;
29+
PrivateKeySigner::from_bytes(secret_key).wrap_err("could not parse private key")?;
3030
let wallet = EthereumWallet::from(signer);
3131

3232
Ok(Self {
@@ -50,6 +50,8 @@ impl DriaOracleConfig {
5050
/// Required environment variables:
5151
/// - `SECRET_KEY`
5252
/// - `RPC_URL`
53+
/// - `TX_TIMEOUT_SECS` (optional)
54+
#[deprecated = "do this in tests instead"]
5355
pub fn new_from_env() -> Result<Self> {
5456
// parse private key
5557
let private_key_hex = env::var("SECRET_KEY").wrap_err("SECRET_KEY is not set")?;
@@ -89,6 +91,7 @@ impl DriaOracleConfig {
8991
}
9092

9193
/// Enables `env_logger`.
94+
#[deprecated = "do this in tests instead"]
9295
pub fn enable_logs(self) -> Self {
9396
if let Err(e) = env_logger::try_init() {
9497
log::error!("Error during env_logger::try_init: {}", e);

src/node/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,12 @@ impl core::fmt::Display for DriaOracle {
188188
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
189189
write!(
190190
f,
191-
"Dria Oracle Node v{}\nAddress: {}\nRPC URL: {}",
191+
"Dria Oracle Node v{}\nOracle Address: {}\nRPC URL: {}\nCoordinator: {}\nTx timeout: {}s",
192192
env!("CARGO_PKG_VERSION"),
193193
self.address(),
194194
self.config.rpc_url,
195+
self.addresses.coordinator,
196+
self.config.tx_timeout.map(|t| t.as_secs()).unwrap_or_default()
195197
)
196198
}
197199
}

0 commit comments

Comments
 (0)