Skip to content
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

fix: watcher receives hashmap of connection managers #898

Closed
wants to merge 4 commits into from
Closed
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
3 changes: 2 additions & 1 deletion rust/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ target
processordb
updaterdb
relayerdb
kathydb
kathydb
watcherdb
4 changes: 2 additions & 2 deletions rust/agents/watcher/src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! Configuration

use optics_base::{decl_settings, ChainSetup, SignerConf};
use std::collections::HashMap;

decl_settings!(Watcher {
/// The watcher's attestation signer
watcher: SignerConf,
/// The connection managers to notify of failure
connection_managers: Vec<ChainSetup>,
managers: HashMap<String, ChainSetup>,
/// The polling interval (in seconds)
interval: String,
});
2 changes: 1 addition & 1 deletion rust/agents/watcher/src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl OpticsAgent for Watcher {
Self: Sized,
{
let mut connection_managers = vec![];
for chain_setup in settings.connection_managers.iter() {
for (_, chain_setup) in settings.managers.iter() {
let signer = settings.base.get_signer(&chain_setup.name).await;
let manager = chain_setup.try_into_connection_manager(signer).await;
connection_managers.push(manager);
Expand Down
10 changes: 5 additions & 5 deletions rust/config/development/rinkeby_config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"environment": "dev",
"index": {
"from": "9430441",
"chunk": "1999"
"from": "9247158",
"chunk": "9999"
},
"signers": {
"rinkeby": {
Expand All @@ -26,7 +26,7 @@
"rpcStyle": "ethereum",
"connection": {
"type": "http",
"url": ""
"url": "https://eth-kovan.alchemyapi.io/v2/aJP38P1ZeHbXP3Td8vVh8vFmxkKT9pnR"
}
},
"alfajores": {
Expand All @@ -36,7 +36,7 @@
"rpcStyle": "ethereum",
"connection": {
"type": "http",
"url": ""
"url": "https://alfajores-forno.celo-testnet.org"
}
}
},
Expand All @@ -47,7 +47,7 @@
"rpcStyle": "ethereum",
"connection": {
"type": "http",
"url": ""
"url": "https://eth-rinkeby.alchemyapi.io/v2/uOf-lO18qM7rAT6NOgMAZQoyuS__lhqN"
}
},
"tracing": {
Expand Down
36 changes: 16 additions & 20 deletions rust/config/development/watcher-partial.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,26 @@
"key": "",
"type": "hexKey"
},
"connectionManagers": [
{
"address": "0x0000000000000000000000000000000000000000",
"domain": "60",
"name": "ethereum",
"managers": {
"kovanbridgerouter": {
"address": "0xAF24a3DB95Ca55eEFADD7b1753F71c774810Df80",
"domain": "3000",
"name": "kovan",
"rpcStyle": "ethereum",
"config": {
"connection": {
"type": "ws",
"url": "ws://localhost:8545"
}
"connection": {
"type": "http",
"url": "https://eth-kovan.alchemyapi.io/v2/aJP38P1ZeHbXP3Td8vVh8vFmxkKT9pnR"
}
},
{
"address": "0x0000000000000000000000000000000000000000",
"domain": "61",
"name": "eth-classic",
"alfajoresbridgerouter": {
"address": "0x3e8391dEB0f2ad863d8b61dfbcadE009BD5243A1",
"domain": "1000",
"name": "alfajores",
"rpcStyle": "ethereum",
"config": {
"connection": {
"type": "ws",
"url": "ws://localhost:8545"
}
"connection": {
"type": "http",
"url": "https://alfajores-forno.celo-testnet.org"
}
}
]
}
}