Skip to content

Commit 2b829f3

Browse files
authored
feat: guardian source from ethereum to pythnet (#894)
1 parent b8778c0 commit 2b829f3

File tree

7 files changed

+270
-249
lines changed

7 files changed

+270
-249
lines changed

hermes/src/config.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use {
22
libp2p::Multiaddr,
3+
solana_sdk::pubkey::Pubkey,
34
std::net::SocketAddr,
45
structopt::StructOpt,
56
};
@@ -15,6 +16,9 @@ pub enum Options {
1516
#[structopt(long, env = "PYTHNET_WS_ENDPOINT")]
1617
pythnet_ws_endpoint: String,
1718

19+
#[structopt(long, env = "PYTHNET_HTTP_ENDPOINT")]
20+
pythnet_http_endpoint: String,
21+
1822
/// Network ID for Wormhole
1923
#[structopt(
2024
long,
@@ -45,20 +49,8 @@ pub enum Options {
4549
#[structopt(long, default_value = "127.0.0.1:33999")]
4650
api_addr: SocketAddr,
4751

48-
/// Ethereum RPC endpoint
49-
#[structopt(long, env = "ETH_RPC_ENDPOINT")]
50-
eth_rpc_endpoint: String,
51-
52-
/// Wormhole contract address on Ethereum
53-
#[structopt(
54-
long,
55-
env = "WORMHOLE_CONTRACT_ADDRESS",
56-
default_value = "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
57-
)]
58-
wormhole_eth_contract_address: String,
59-
60-
/// Ethereum RPC polling duration
61-
#[structopt(long, env = "ETH_POLLING_INTERVAL", default_value = "10s")]
62-
eth_polling_interval: humantime::Duration,
52+
/// Address of the Wormhole contract on the target PythNet cluster.
53+
#[structopt(long, default_value = "H3fxXJ86ADW2PNuDDmZJg6mzTtPxkYCpNuQUTgmJ7AjU")]
54+
wh_contract_addr: Pubkey,
6355
},
6456
}

hermes/src/main.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ async fn init() -> Result<()> {
2222
match config::Options::from_args() {
2323
config::Options::Run {
2424
pythnet_ws_endpoint,
25+
pythnet_http_endpoint,
2526
wh_network_id,
2627
wh_bootstrap_addrs,
2728
wh_listen_addrs,
29+
wh_contract_addr,
2830
api_addr,
29-
eth_rpc_endpoint,
30-
wormhole_eth_contract_address,
31-
eth_polling_interval,
3231
} => {
3332
// A channel to emit state updates to api
3433
let (update_tx, update_rx) = tokio::sync::mpsc::channel(1000);
@@ -46,23 +45,16 @@ async fn init() -> Result<()> {
4645
)
4746
.await?;
4847

49-
// Spawn the Ethereum guardian set watcher
50-
log::info!(
51-
"Starting Ethereum guardian set watcher using {}",
52-
eth_rpc_endpoint
53-
);
54-
network::ethereum::spawn(
48+
// Spawn the Pythnet listener
49+
log::info!("Starting Pythnet listener using {}", pythnet_ws_endpoint);
50+
network::pythnet::spawn(
5551
store.clone(),
56-
eth_rpc_endpoint,
57-
wormhole_eth_contract_address,
58-
eth_polling_interval.into(),
52+
pythnet_ws_endpoint,
53+
pythnet_http_endpoint,
54+
wh_contract_addr,
5955
)
6056
.await?;
6157

62-
// Spawn the Pythnet listener
63-
log::info!("Starting Pythnet listener using {}", pythnet_ws_endpoint);
64-
network::pythnet::spawn(store.clone(), pythnet_ws_endpoint).await?;
65-
6658
// Run the RPC server and wait for it to shutdown gracefully.
6759
log::info!("Starting RPC server on {}", api_addr);
6860
api::run(store.clone(), update_rx, api_addr.to_string()).await?;

hermes/src/network.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
pub mod ethereum;
21
pub mod p2p;
32
pub mod pythnet;

hermes/src/network/ethereum.rs

Lines changed: 0 additions & 187 deletions
This file was deleted.

0 commit comments

Comments
 (0)