diff --git a/Cargo.lock b/Cargo.lock index 598ea77..570bb45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,7 +120,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "availability-oracle" -version = "0.3.0" +version = "0.3.4" dependencies = [ "async-trait", "bytes 1.3.0", @@ -132,6 +132,7 @@ dependencies = [ "moka", "multibase", "reqwest", + "secp256k1", "serde", "serde_derive", "serde_json", diff --git a/README.md b/README.md index af3481d..4b5912f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ The Subgraph Oracle verifies the availability of the subgraph files and does oth ``` USAGE: - availability-oracle [FLAGS] [OPTIONS] --contracts --ipfs --oracle --signing-key --subgraph + availability-oracle [FLAGS] [OPTIONS] --contracts --ipfs --signing-key --subgraph FLAGS: --dry-run log the results but not send a transaction to the rewards manager @@ -30,9 +30,6 @@ OPTIONS: --min-signal Minimum signal for a subgraph to be checked [env: ORACLE_MIN_SIGNAL=] [default: 100] - -o, --oracle - The address used by by the oracle to sign transactions [env: ORACLE_ADDRESS=] - --period How often the oracle should check the subgraphs. With the default value of 0, the oracle will run once and terminate [env: ORACLE_PERIOD_SECS=] [default: 0] diff --git a/availability-oracle/Cargo.toml b/availability-oracle/Cargo.toml index 17943fe..924225b 100644 --- a/availability-oracle/Cargo.toml +++ b/availability-oracle/Cargo.toml @@ -26,3 +26,4 @@ wasmparser = "0.74.0" multibase = "0.8.0" moka = { version = "0.8", features = ["future"] } graphql-parser = "0.4.0" +secp256k1 = "0.20.3" diff --git a/availability-oracle/src/main.rs b/availability-oracle/src/main.rs index e89ceca..8034aac 100644 --- a/availability-oracle/src/main.rs +++ b/availability-oracle/src/main.rs @@ -7,10 +7,12 @@ mod util; use common::prelude::*; use common::prometheus; +use common::web3::signing::Key; use contract::*; use ipfs::*; use manifest::{Abi, DataSource, Manifest, Mapping}; use network_subgraph::*; +use secp256k1::key::SecretKey; use std::sync::Arc; use std::time::{Duration, Instant}; use std::{fmt::Display, str::FromStr}; @@ -94,15 +96,6 @@ struct Config { )] contracts: Option, - #[structopt( - short, - long, - env = "ORACLE_ADDRESS", - required_unless("dry-run"), - help = "The address used by by the oracle to sign transactions" - )] - oracle: Option
, - #[structopt( long, env = "ORACLE_SIGNING_KEY", @@ -151,10 +144,10 @@ async fn run(logger: Logger, config: Config) -> Result<()> { let subgraph = NetworkSubgraphImpl::new(logger.clone(), config.subgraph); let contract: Box = match config.dry_run { false => { - let signing_key = &config.signing_key.unwrap().parse()?; + let signing_key: &SecretKey = &config.signing_key.unwrap().parse()?; let contracts_config = config.contracts.unwrap(); let web3_context = - Web3Context::new(&contracts_config.url, config.oracle.unwrap(), signing_key)?; + Web3Context::new(&contracts_config.url, signing_key.address(), signing_key)?; let contracts = Contracts::new(contracts_config, web3_context); Box::new(RewardsManagerContract::new(contracts)) }