Skip to content

Commit 2575ee3

Browse files
[p2p/lookup] Support IP Updates Between Set Updates (#3047)
1 parent 4e85927 commit 2575ee3

27 files changed

Lines changed: 945 additions & 295 deletions

File tree

consensus/src/marshal/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ mod tests {
234234
let backfill = control.register(1, TEST_QUOTA).await.unwrap();
235235
let resolver_cfg = resolver::Config {
236236
public_key: validator.clone(),
237-
manager: oracle.manager(),
237+
provider: oracle.manager(),
238238
blocker: control.clone(),
239239
mailbox_size: config.mailbox_size,
240240
initial: Duration::from_secs(1),
@@ -475,7 +475,7 @@ mod tests {
475475
// Register the initial peer set.
476476
let mut manager = oracle.manager();
477477
manager
478-
.update(0, participants.clone().try_into().unwrap())
478+
.track(0, participants.clone().try_into().unwrap())
479479
.await;
480480
for (i, validator) in participants.iter().enumerate() {
481481
let (application, actor, _processed_height) = setup_validator(
@@ -625,7 +625,7 @@ mod tests {
625625
// Register the initial peer set.
626626
let mut manager = oracle.manager();
627627
manager
628-
.update(0, participants.clone().try_into().unwrap())
628+
.track(0, participants.clone().try_into().unwrap())
629629
.await;
630630
for (i, validator) in participants.iter().enumerate().skip(1) {
631631
let (application, actor, _processed_height) = setup_validator(
@@ -831,7 +831,7 @@ mod tests {
831831
let backfill = control.register(0, TEST_QUOTA).await.unwrap();
832832
let resolver_cfg = resolver::Config {
833833
public_key: validator.clone(),
834-
manager: oracle_manager,
834+
provider: oracle_manager,
835835
blocker: control.clone(),
836836
mailbox_size: config.mailbox_size,
837837
initial: Duration::from_secs(1),
@@ -1695,7 +1695,7 @@ mod tests {
16951695
// Register the initial peer set
16961696
let mut manager = oracle.manager();
16971697
manager
1698-
.update(0, participants.clone().try_into().unwrap())
1698+
.track(0, participants.clone().try_into().unwrap())
16991699
.await;
17001700

17011701
// Set up two validators

consensus/src/marshal/resolver/p2p.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ use crate::{
55
Block,
66
};
77
use commonware_cryptography::PublicKey;
8-
use commonware_p2p::{Blocker, Manager, Receiver, Sender};
8+
use commonware_p2p::{Blocker, Provider, Receiver, Sender};
99
use commonware_resolver::p2p;
1010
use commonware_runtime::{Clock, Metrics, Spawner};
1111
use commonware_utils::channel::mpsc;
1212
use rand::Rng;
1313
use std::time::Duration;
1414

1515
/// Configuration for the P2P [Resolver](commonware_resolver::Resolver).
16-
pub struct Config<P: PublicKey, C: Manager<PublicKey = P>, B: Blocker<PublicKey = P>> {
16+
pub struct Config<P: PublicKey, C: Provider<PublicKey = P>, B: Blocker<PublicKey = P>> {
1717
/// The public key to identify this node.
1818
pub public_key: P,
1919

2020
/// The provider of peers that can be consulted for fetching data.
21-
pub manager: C,
21+
pub provider: C,
2222

2323
/// The blocker that will be used to block peers that send invalid responses.
2424
pub blocker: B,
@@ -53,7 +53,7 @@ pub fn init<E, C, Bl, B, S, R, P>(
5353
)
5454
where
5555
E: Rng + Spawner + Clock + Metrics,
56-
C: Manager<PublicKey = P>,
56+
C: Provider<PublicKey = P>,
5757
Bl: Blocker<PublicKey = P>,
5858
B: Block,
5959
S: Sender<PublicKey = P>,
@@ -65,7 +65,7 @@ where
6565
let (resolver_engine, resolver) = p2p::Engine::new(
6666
ctx.with_label("resolver"),
6767
p2p::Config {
68-
manager: config.manager,
68+
provider: config.provider,
6969
blocker: config.blocker,
7070
consumer: handler.clone(),
7171
producer: handler,

consensus/src/simplex/actors/resolver/actor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use bytes::Bytes;
1515
use commonware_codec::{Decode, Encode};
1616
use commonware_cryptography::Digest;
1717
use commonware_macros::select_loop;
18-
use commonware_p2p::{utils::StaticManager, Blocker, Receiver, Sender};
18+
use commonware_p2p::{utils::StaticProvider, Blocker, Receiver, Sender};
1919
use commonware_parallel::Strategy;
2020
use commonware_resolver::p2p;
2121
use commonware_runtime::{spawn_cell, Clock, ContextCell, Handle, Metrics, Spawner};
@@ -107,7 +107,7 @@ impl<
107107
let (resolver_engine, mut resolver) = p2p::Engine::new(
108108
self.context.with_label("resolver"),
109109
p2p::Config {
110-
manager: StaticManager::new(self.epoch.get(), participants),
110+
provider: StaticProvider::new(self.epoch.get(), participants),
111111
blocker: self.blocker.take().expect("blocker must be set"),
112112
consumer: handler.clone(),
113113
producer: handler,

examples/bridge/src/bin/validator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fn main() {
196196
//
197197
// In a real-world scenario, this would be updated as new peer sets are created (like when
198198
// the composition of a validator set changes).
199-
oracle.update(0, validators.clone()).await;
199+
oracle.track(0, validators.clone()).await;
200200

201201
// Register consensus channels
202202
//

examples/chat/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ fn main() {
172172
//
173173
// In a real-world scenario, this would be updated as new peer sets are created (like when
174174
// the composition of a validator set changes).
175-
oracle.update(0, recipients).await;
175+
oracle.track(0, recipients).await;
176176

177177
// Initialize chat
178178
const MAX_MESSAGE_BACKLOG: usize = 128;

examples/flood/src/bin/flood.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn main() {
140140
discovery::Network::new(context.with_label("network"), p2p_cfg);
141141

142142
// Provide authorized peers
143-
oracle.update(0, peer_keys.clone()).await;
143+
oracle.track(0, peer_keys.clone()).await;
144144

145145
// Register flood channel
146146
let (mut flood_sender, mut flood_receiver) = network.register(

examples/log/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn main() {
169169
//
170170
// In a real-world scenario, this would be updated as new peer sets are created (like when
171171
// the composition of a validator set changes).
172-
oracle.update(0, validators.clone()).await;
172+
oracle.track(0, validators.clone()).await;
173173

174174
// Register consensus channels
175175
//

examples/reshare/src/dkg/actor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub struct Config<C: Signer, P> {
112112
pub struct Actor<E, P, H, C, V>
113113
where
114114
E: Spawner + Metrics + CryptoRngCore + Clock + RuntimeStorage,
115-
P: Manager<PublicKey = C::PublicKey, Peers = Set<C::PublicKey>>,
115+
P: Manager<PublicKey = C::PublicKey>,
116116
H: Hasher,
117117
C: Signer,
118118
V: Variant,
@@ -135,7 +135,7 @@ where
135135
impl<E, P, H, C, V> Actor<E, P, H, C, V>
136136
where
137137
E: Spawner + Metrics + CryptoRngCore + Clock + RuntimeStorage,
138-
P: Manager<PublicKey = C::PublicKey, Peers = Set<C::PublicKey>>,
138+
P: Manager<PublicKey = C::PublicKey>,
139139
H: Hasher,
140140
C: Signer,
141141
V: Variant,
@@ -296,7 +296,7 @@ where
296296
// - Dealers and players for the active epoch
297297
// - Players for the next epoch
298298
self.manager
299-
.update(
299+
.track(
300300
epoch.get(),
301301
Set::from_iter_dedup(
302302
dealers

examples/reshare/src/engine.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use commonware_runtime::{
2828
Storage,
2929
};
3030
use commonware_storage::archive::immutable;
31-
use commonware_utils::{channel::mpsc, ordered::Set, union, NZUsize, NZU16, NZU32, NZU64};
31+
use commonware_utils::{channel::mpsc, union, NZUsize, NZU16, NZU32, NZU64};
3232
use futures::future::try_join_all;
3333
use rand_core::CryptoRngCore;
3434
use std::{
@@ -56,7 +56,7 @@ const MAX_REPAIR: NonZero<usize> = NZUsize!(50);
5656

5757
pub struct Config<C, P, B, V, T>
5858
where
59-
P: Manager<PublicKey = C::PublicKey, Peers = Set<C::PublicKey>>,
59+
P: Manager<PublicKey = C::PublicKey>,
6060
C: Signer,
6161
B: Blocker<PublicKey = C::PublicKey>,
6262
V: Variant,
@@ -78,7 +78,7 @@ pub struct Engine<E, C, P, B, H, V, S, L, T>
7878
where
7979
E: Spawner + Metrics + CryptoRngCore + Clock + Storage + Network,
8080
C: Signer,
81-
P: Manager<PublicKey = C::PublicKey, Peers = Set<C::PublicKey>>,
81+
P: Manager<PublicKey = C::PublicKey>,
8282
B: Blocker<PublicKey = C::PublicKey>,
8383
H: Hasher,
8484
V: Variant,
@@ -122,7 +122,7 @@ impl<E, C, P, B, H, V, S, L, T> Engine<E, C, P, B, H, V, S, L, T>
122122
where
123123
E: Spawner + Metrics + CryptoRngCore + Clock + Storage + Network,
124124
C: Signer,
125-
P: Manager<PublicKey = C::PublicKey, Peers = Set<C::PublicKey>>,
125+
P: Manager<PublicKey = C::PublicKey>,
126126
B: Blocker<PublicKey = C::PublicKey>,
127127
H: Hasher,
128128
V: Variant,

examples/reshare/src/validator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub async fn run<S, L>(
105105
// Create a static resolver for marshal
106106
let resolver_cfg = marshal_resolver::Config {
107107
public_key: config.signing_key.public_key(),
108-
manager: oracle.clone(),
108+
provider: oracle.clone(),
109109
blocker: oracle.clone(),
110110
mailbox_size: 200,
111111
initial: Duration::from_secs(1),
@@ -373,7 +373,7 @@ mod test {
373373
*restart_count += 1;
374374
let resolver_cfg = marshal_resolver::Config {
375375
public_key: pk.clone(),
376-
manager: oracle.manager(),
376+
provider: oracle.manager(),
377377
blocker: oracle.control(pk.clone()),
378378
mailbox_size: 200,
379379
initial: Duration::from_secs(1),

0 commit comments

Comments
 (0)