Skip to content

Commit

Permalink
chore: update anemo
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Dec 7, 2022
1 parent 3d50e4b commit 7dab34a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 22 deletions.
8 changes: 5 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "3ac9fa49
fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "3ac9fa490f2d7eecd133c87a7c616328a217b66a", package = "fastcrypto-zkp" }

# anemo dependencies
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4" }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4" }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4" }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20" }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20" }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20" }

# Use the same workspace-hack across crates.
workspace-hack = { path = "crates/workspace-hack" }
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-network/src/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl DiscoveryEventLoop {

let mut interval = tokio::time::interval(DISCOVERY_INTERVAL_PERIOD);
let mut peer_events = {
let (subscriber, _peers) = self.network.subscribe();
let (subscriber, _peers) = self.network.subscribe().unwrap();
subscriber
};

Expand Down
14 changes: 7 additions & 7 deletions crates/sui-network/src/discovery/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ async fn make_connection_to_seed_peer() -> Result<()> {
let network_2 = build_network(|router| router.add_rpc_service(server));
let (mut event_loop_2, _handle_2) = builder.build(network_2.clone());

let (mut subscriber_1, _) = network_1.subscribe();
let (mut subscriber_2, _) = network_2.subscribe();
let (mut subscriber_1, _) = network_1.subscribe()?;
let (mut subscriber_2, _) = network_2.subscribe()?;

event_loop_2.handle_tick(std::time::Instant::now(), now_unix());

Expand Down Expand Up @@ -149,8 +149,8 @@ async fn make_connection_to_seed_peer_with_peer_id() -> Result<()> {
let network_2 = build_network(|router| router.add_rpc_service(server));
let (mut event_loop_2, _handle_2) = builder.build(network_2.clone());

let (mut subscriber_1, _) = network_1.subscribe();
let (mut subscriber_2, _) = network_2.subscribe();
let (mut subscriber_1, _) = network_1.subscribe()?;
let (mut subscriber_2, _) = network_2.subscribe()?;

event_loop_2.handle_tick(std::time::Instant::now(), now_unix());

Expand Down Expand Up @@ -190,9 +190,9 @@ async fn three_nodes_can_connect_via_discovery() -> Result<()> {
let network_3 = build_network(|router| router.add_rpc_service(server));
let (event_loop_3, _handle_3) = builder.build(network_3.clone());

let (mut subscriber_1, _) = network_1.subscribe();
let (mut subscriber_2, _) = network_2.subscribe();
let (mut subscriber_3, _) = network_3.subscribe();
let (mut subscriber_1, _) = network_1.subscribe()?;
let (mut subscriber_2, _) = network_2.subscribe()?;
let (mut subscriber_3, _) = network_3.subscribe()?;

// Start all the event loops
tokio::spawn(event_loop_1.start());
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-network/src/state_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ where

let mut interval = tokio::time::interval(self.config.interval_period());
let mut peer_events = {
let (subscriber, peers) = self.network.subscribe();
let (subscriber, peers) = self.network.subscribe().unwrap();
for peer_id in peers {
self.spawn_get_latest_from_peer(peer_id);
}
Expand Down
10 changes: 5 additions & 5 deletions crates/workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ aho-corasick = { version = "0.7", features = ["std"] }
aliasable = { version = "0.1", features = ["alloc"] }
alloc-no-stdlib = { version = "2", default-features = false }
alloc-stdlib = { version = "0.2", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20", default-features = false }
anes = { version = "0.1" }
ansi_term = { version = "0.12", default-features = false }
anyhow = { version = "1", features = ["backtrace", "std"] }
Expand Down Expand Up @@ -649,9 +649,9 @@ aho-corasick = { version = "0.7", features = ["std"] }
aliasable = { version = "0.1", features = ["alloc"] }
alloc-no-stdlib = { version = "2", default-features = false }
alloc-stdlib = { version = "0.2", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4", default-features = false }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "3716a5669c68bd61d6e4958db99674507e0160b4", default-features = false }
anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20", default-features = false }
anemo-build = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20", default-features = false }
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "7ebdcf82b5cccce71e9483d5b028329475a41a20", default-features = false }
anes = { version = "0.1" }
ansi_term = { version = "0.12", default-features = false }
anyhow = { version = "1", features = ["backtrace", "std"] }
Expand Down
2 changes: 1 addition & 1 deletion narwhal/network/src/anemo_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl WaitingPeer {
use tokio::sync::broadcast::error::RecvError;

let start = Instant::now();
let (mut subscriber, _) = self.network.subscribe();
let (mut subscriber, _) = self.network.subscribe()?;

// If we're connected with the peer immediately make the request
if let Some(mut peer) = self.network.peer(self.peer_id) {
Expand Down
9 changes: 8 additions & 1 deletion narwhal/network/src/connectivity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ impl ConnectionMonitor {
async fn run(self) {
let ((mut subscriber, connected_peers), all_peers) = {
if let Some(network) = self.network.upgrade() {
(network.subscribe(), network.known_peers().get_all())
let Ok((subscriber, connected_peers)) = network.subscribe() else {
return;
};

(
(subscriber, connected_peers),
network.known_peers().get_all(),
)
} else {
return;
}
Expand Down

0 comments on commit 7dab34a

Please sign in to comment.