Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
3e9abcf
stupid, but it compiles
ordian Sep 5, 2020
e1fe858
redo
ordian Sep 8, 2020
d09622b
cleanup
ordian Sep 8, 2020
9e8cfe2
add ValidatorDiscovery to msgs
ordian Sep 8, 2020
0bae9e4
sketch network bridge code
ordian Sep 8, 2020
4fa0236
ConnectToAuthorities instead of validators
ordian Sep 9, 2020
9f81f90
more stuff
ordian Sep 10, 2020
d8d1302
cleanup
ordian Sep 10, 2020
6c18572
more stuff
ordian Sep 10, 2020
251427d
complete ConnectToAuthoritiesState
ordian Sep 10, 2020
31d7329
Update node/network/bridge/src/lib.rs
ordian Sep 10, 2020
f715c33
Collator protocol subsystem (#1659)
montekki Sep 10, 2020
b80e050
handle multiple in-flight connection requests
ordian Sep 10, 2020
0e0525d
handle cancelled requests
ordian Sep 10, 2020
64dcdb1
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 10, 2020
2cf1610
Update node/core/runtime-api/src/lib.rs
ordian Sep 11, 2020
1bee32c
redo it again
ordian Sep 11, 2020
c0d3a5a
more stuff
ordian Sep 12, 2020
de19f1d
redo it again
ordian Sep 14, 2020
eb1afd7
Merge branch 'ao-validator-discovery-api' of github.com:paritytech/po…
ordian Sep 14, 2020
dbbfe23
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 14, 2020
e6a0a85
update comments
ordian Sep 14, 2020
36cf3f4
workaround Future is not Send
ordian Sep 14, 2020
9f20552
fix trailing spaces
ordian Sep 14, 2020
ef4c6da
clarify comments
ordian Sep 14, 2020
6305c41
bridge: fix compilation in tests
ordian Sep 14, 2020
14fe353
update more comments
ordian Sep 14, 2020
7ea8588
small fixes
ordian Sep 14, 2020
f6a4068
port collator protocol to new validator discovery api
ordian Sep 14, 2020
ac02180
collator tests compile
ordian Sep 15, 2020
3dea047
collator tests pass
ordian Sep 15, 2020
62e46a1
do not revoke a request when the stream receiver is closed
ordian Sep 15, 2020
bbaf435
make revoking opt-in
ordian Sep 15, 2020
8cfab6f
fix is_fulfilled
ordian Sep 15, 2020
68fc8bb
handle request revokation in collator
ordian Sep 16, 2020
a23edc0
tests
ordian Sep 16, 2020
0a9c064
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 16, 2020
98d8346
wait for validator connections asyncronously
ordian Sep 17, 2020
c03f766
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 17, 2020
e077b51
fix compilation
ordian Sep 17, 2020
2132114
relabel my todos
ordian Sep 17, 2020
eb3bacb
apply Fedor's patch
ordian Sep 17, 2020
1112368
resolve reconnection TODO
ordian Sep 18, 2020
6fbca68
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 18, 2020
3d2def9
resolve revoking TODO
ordian Sep 18, 2020
dee8b27
resolve channel capacity TODO
ordian Sep 18, 2020
c59d5a7
resolve peer cloning TODO
ordian Sep 18, 2020
0580441
resolve peer disconnected TODO
ordian Sep 18, 2020
db37a2f
resolve PeerSet TODO
ordian Sep 18, 2020
a237119
wip tests
ordian Sep 18, 2020
a8e3105
more tests
ordian Sep 22, 2020
95f989e
resolve Arc TODO
ordian Sep 22, 2020
86a64fa
rename pending to non_revoked
ordian Sep 22, 2020
7585d6e
one more test
ordian Sep 22, 2020
9534c2b
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 22, 2020
f83534c
extract utility function into util crate
ordian Sep 22, 2020
cb97211
fix compilation in tests
ordian Sep 22, 2020
c1da4c6
Apply suggestions from code review
ordian Sep 23, 2020
c6aa649
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 23, 2020
ae7f529
revert pin_project removal
ordian Sep 23, 2020
fbf8901
fix while let loop
ordian Sep 23, 2020
78216fc
Revert "revert pin_project removal"
ordian Sep 23, 2020
4cb79ad
fix compilation
ordian Sep 23, 2020
0295436
Update node/subsystem/src/messages.rs
ordian Sep 23, 2020
66a6eed
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 28, 2020
7e67489
docs on pub items
ordian Sep 28, 2020
30da479
guide updates
ordian Sep 28, 2020
9c5b654
Merge branch 'master' into ao-validator-discovery-api
ordian Sep 28, 2020
0e9771c
remove a TODO
ordian Sep 28, 2020
4cc5f3e
small guide update
ordian Sep 28, 2020
23bde8d
fix a typo
ordian Sep 28, 2020
88e83ed
link to the issue
ordian Sep 28, 2020
3893324
Merge branch 'master' into ao-validator-discovery-api
ordian Oct 6, 2020
a7b5ddc
validator discovery: on_request docs
ordian Oct 6, 2020
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
Prev Previous commit
Next Next commit
resolve revoking TODO
  • Loading branch information
ordian committed Sep 18, 2020
commit 3d2def934e3c1d16bc5a0f2a49e835e25dcd2690
16 changes: 5 additions & 11 deletions node/network/bridge/src/validator_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,11 @@ impl PendingConnectionRequestState {
let _ = self.pending.remove(authority);
}

pub fn is_fulfilled(&mut self) -> bool {
self.sender.is_closed() && self.revoke.try_recv().is_err()
}

/// Returns `true` if the request is revoked.
pub fn is_revoked(&mut self) -> bool {
self.revoke
.try_recv()
.map_or(false, |r| r.is_some())
.map_or(true, |r| r.is_some())
}

pub fn requested(&self) -> &[AuthorityDiscoveryId] {
Expand Down Expand Up @@ -224,8 +220,8 @@ impl<N: Network, AD: AuthorityDiscovery> Service<N, AD> {
}
}

// clean up revoked and fulfilled requests
let mut revoked_or_fulfilled_indexes = Vec::new();
// clean up revoked requests
let mut revoked_indices = Vec::new();
let mut revoked_validators = Vec::new();
for (i, pending) in self.pending_discovery_requests.iter_mut().enumerate() {
if pending.is_revoked() {
Expand All @@ -234,14 +230,12 @@ impl<N: Network, AD: AuthorityDiscovery> Service<N, AD> {
revoked_validators.push(id);
}
}
revoked_or_fulfilled_indexes.push(i);
} else if pending.is_fulfilled() {
revoked_or_fulfilled_indexes.push(i)
revoked_indices.push(i);
}
}

// clean up pending requests states
for to_revoke in revoked_or_fulfilled_indexes.into_iter().rev() {
for to_revoke in revoked_indices.into_iter().rev() {
drop(self.pending_discovery_requests.swap_remove(to_revoke));
}

Expand Down
7 changes: 3 additions & 4 deletions node/subsystem/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ pub enum NetworkBridgeMessage {
///
/// Also ask the network to stay connected to these peers at least
/// until the request is revoked.
///
/// NOTE: dropping the revoke's sender will revoke the request.
ConnectToValidators {
/// Ids of the validators to connect to.
validator_ids: Vec<AuthorityDiscoveryId>,
Expand All @@ -212,10 +214,7 @@ pub enum NetworkBridgeMessage {
/// It doesn't necessarily lead to peers disconnection though.
/// The revokation is enacted on in the next connection request.
///
/// This can be done by sending to the channel.
/// NOTE: if the revoke's sender is dropped instead,
/// we will never disconnect from the given validator list.
// TODO (ordian): will we ever want such behavior?
/// This can be done by sending to the channel or dropping the sender.
revoke: oneshot::Receiver<()>,
},
}
Expand Down