mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 02:07:56 +00:00
feat/view: assure heads in a view are sorted (#2493)
* feat/view: assure heads in a view are sorted Allows O(n) comparisons, adds an alternate equiv relation which takes O(n^2) for integrity verification. Ref #2133 * revert: remove custom PartialEq impl, there are no duplicates * fix: do not sort the live_heads, that alters the local view * refactor/view: heads should not be public * chore/spellcheck: add unfinalized * fix/view: add missing len() and is_empty() fns * quirk * vec is not view * Update node/network/approval-distribution/src/tests.rs Co-authored-by: Andronik Ordian <write@reusable.software> * Update node/network/bridge/src/lib.rs Co-authored-by: Andronik Ordian <write@reusable.software> * Update node/network/protocol/src/lib.rs Co-authored-by: Andronik Ordian <write@reusable.software> * fixup comment * fix botched test Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
committed by
GitHub
parent
571651e326
commit
e3f776abed
@@ -330,7 +330,7 @@ fn spam_attack_results_in_negative_reputation_change() {
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), View { heads: Default::default(), finalized_number: 2 })
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), View::with_finalized(2))
|
||||
)
|
||||
).await;
|
||||
|
||||
@@ -666,7 +666,7 @@ fn update_peer_view() {
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), View { heads: vec![hash_b, hash_c, hash_d], finalized_number: 2 })
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), View::new(vec![hash_b, hash_c, hash_d], 2))
|
||||
)
|
||||
).await;
|
||||
|
||||
@@ -713,7 +713,7 @@ fn update_peer_view() {
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), View { heads: vec![], finalized_number })
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), View::with_finalized(finalized_number))
|
||||
)
|
||||
).await;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user