Skip to content

Commit 127e9b7

Browse files
authored
Merge pull request #7 from graphprotocol/tmigone/remove-oracle-opt
fix: derive oracle address from private key
2 parents e44d409 + b16bad0 commit 127e9b7

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

Cargo.lock

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

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ The Subgraph Oracle verifies the availability of the subgraph files and does oth
33

44
```
55
USAGE:
6-
availability-oracle [FLAGS] [OPTIONS] --contracts <contracts> --ipfs <ipfs> --oracle <oracle> --signing-key <signing-key> --subgraph <subgraph>
6+
availability-oracle [FLAGS] [OPTIONS] --contracts <contracts> --ipfs <ipfs> --signing-key <signing-key> --subgraph <subgraph>
77
88
FLAGS:
99
--dry-run log the results but not send a transaction to the rewards manager
@@ -30,9 +30,6 @@ OPTIONS:
3030
--min-signal <min-signal>
3131
Minimum signal for a subgraph to be checked [env: ORACLE_MIN_SIGNAL=] [default: 100]
3232
33-
-o, --oracle <oracle>
34-
The address used by by the oracle to sign transactions [env: ORACLE_ADDRESS=]
35-
3633
--period <period>
3734
How often the oracle should check the subgraphs. With the default value of 0, the oracle will run once and
3835
terminate [env: ORACLE_PERIOD_SECS=] [default: 0]

availability-oracle/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ wasmparser = "0.74.0"
2626
multibase = "0.8.0"
2727
moka = { version = "0.8", features = ["future"] }
2828
graphql-parser = "0.4.0"
29+
secp256k1 = "0.20.3"

availability-oracle/src/main.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ mod util;
77

88
use common::prelude::*;
99
use common::prometheus;
10+
use common::web3::signing::Key;
1011
use contract::*;
1112
use ipfs::*;
1213
use manifest::{Abi, DataSource, Manifest, Mapping};
1314
use network_subgraph::*;
15+
use secp256k1::key::SecretKey;
1416
use std::sync::Arc;
1517
use std::time::{Duration, Instant};
1618
use std::{fmt::Display, str::FromStr};
@@ -94,15 +96,6 @@ struct Config {
9496
)]
9597
contracts: Option<common::contracts::ContractConfig>,
9698

97-
#[structopt(
98-
short,
99-
long,
100-
env = "ORACLE_ADDRESS",
101-
required_unless("dry-run"),
102-
help = "The address used by by the oracle to sign transactions"
103-
)]
104-
oracle: Option<Address>,
105-
10699
#[structopt(
107100
long,
108101
env = "ORACLE_SIGNING_KEY",
@@ -151,10 +144,10 @@ async fn run(logger: Logger, config: Config) -> Result<()> {
151144
let subgraph = NetworkSubgraphImpl::new(logger.clone(), config.subgraph);
152145
let contract: Box<dyn RewardsManager> = match config.dry_run {
153146
false => {
154-
let signing_key = &config.signing_key.unwrap().parse()?;
147+
let signing_key: &SecretKey = &config.signing_key.unwrap().parse()?;
155148
let contracts_config = config.contracts.unwrap();
156149
let web3_context =
157-
Web3Context::new(&contracts_config.url, config.oracle.unwrap(), signing_key)?;
150+
Web3Context::new(&contracts_config.url, signing_key.address(), signing_key)?;
158151
let contracts = Contracts::new(contracts_config, web3_context);
159152
Box::new(RewardsManagerContract::new(contracts))
160153
}

0 commit comments

Comments
 (0)