Skip to content

Commit

Permalink
Merge branch 'master' into xcm-transact-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoaguirre authored Nov 26, 2024
2 parents 4479a29 + 8216235 commit 5b9bf84
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 122 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: true

env:
TOOLCHAIN: nightly-2024-06-01
TOOLCHAIN: nightly-2024-10-19

jobs:
preflight:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: install parity-publish
# Set the target dir to cache the build.
run: CARGO_TARGET_DIR=./target/ cargo install parity-publish@0.8.0 --locked -q
run: CARGO_TARGET_DIR=./target/ cargo install parity-publish@0.10.1 --locked -q

- name: check semver
run: |
Expand Down
52 changes: 26 additions & 26 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ rstest = { version = "0.18.2" }
rustc-hash = { version = "1.1.0" }
rustc-hex = { version = "2.1.0", default-features = false }
rustix = { version = "0.36.7", default-features = false }
rustls = { version = "0.23.14", default-features = false, features = ["logging", "ring", "std", "tls12"] }
rustls = { version = "0.23.18", default-features = false, features = ["logging", "ring", "std", "tls12"] }
rustversion = { version = "1.0.17" }
rusty-fork = { version = "0.3.0", default-features = false }
safe-mix = { version = "1.0", default-features = false }
Expand Down Expand Up @@ -1387,7 +1387,7 @@ xcm-procedural = { path = "polkadot/xcm/procedural", default-features = false }
xcm-runtime-apis = { path = "polkadot/xcm/xcm-runtime-apis", default-features = false }
xcm-simulator = { path = "polkadot/xcm/xcm-simulator", default-features = false }
zeroize = { version = "1.7.0", default-features = false }
zombienet-sdk = { version = "0.2.15" }
zombienet-sdk = { version = "0.2.16" }
zstd = { version = "0.12.4", default-features = false }

[profile.release]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ async fn process_msg<Context>(
);
}
},
msg @ (ReportCollator(..) | Invalid(..) | Seconded(..)) => {
msg @ (Invalid(..) | Seconded(..)) => {
gum::warn!(
target: LOG_TARGET,
"{:?} message is not expected on the collator side of the protocol",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1462,9 +1462,6 @@ async fn process_msg<Context>(
"DistributeCollation message is not expected on the validator side of the protocol",
);
},
ReportCollator(id) => {
report_collator(&mut state.reputation, ctx.sender(), &state.peer_data, id).await;
},
NetworkBridgeUpdate(event) => {
if let Err(e) = handle_network_msg(ctx, state, keystore, event).await {
gum::warn!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,66 +638,6 @@ fn act_on_advertisement_v2() {
});
}

// Test that other subsystems may modify collators' reputations.
#[test]
fn collator_reporting_works() {
let test_state = TestState::default();

test_harness(ReputationAggregator::new(|_| true), |test_harness| async move {
let TestHarness { mut virtual_overseer, .. } = test_harness;

overseer_send(
&mut virtual_overseer,
CollatorProtocolMessage::NetworkBridgeUpdate(NetworkBridgeEvent::OurViewChange(
our_view![test_state.relay_parent],
)),
)
.await;

respond_to_runtime_api_queries(&mut virtual_overseer, &test_state, test_state.relay_parent)
.await;

let peer_b = PeerId::random();
let peer_c = PeerId::random();

connect_and_declare_collator(
&mut virtual_overseer,
peer_b,
test_state.collators[0].clone(),
test_state.chain_ids[0],
CollationVersion::V1,
)
.await;

connect_and_declare_collator(
&mut virtual_overseer,
peer_c,
test_state.collators[1].clone(),
test_state.chain_ids[0],
CollationVersion::V1,
)
.await;

overseer_send(
&mut virtual_overseer,
CollatorProtocolMessage::ReportCollator(test_state.collators[0].public()),
)
.await;

assert_matches!(
overseer_recv(&mut virtual_overseer).await,
AllMessages::NetworkBridgeTx(
NetworkBridgeTxMessage::ReportPeer(ReportPeerMessage::Single(peer, rep)),
) => {
assert_eq!(peer, peer_b);
assert_eq!(rep.value, COST_REPORT_BAD.cost_or_benefit());
}
);

virtual_overseer
});
}

// Test that we verify the signatures on `Declare` and `AdvertiseCollation` messages.
#[test]
fn collator_authentication_verification_works() {
Expand Down
15 changes: 6 additions & 9 deletions polkadot/node/subsystem-types/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ use polkadot_primitives::{
CommittedCandidateReceiptV2 as CommittedCandidateReceipt, CoreState,
},
ApprovalVotingParams, AuthorityDiscoveryId, BlockNumber, CandidateCommitments, CandidateHash,
CandidateIndex, CollatorId, CoreIndex, DisputeState, ExecutorParams, GroupIndex,
GroupRotationInfo, Hash, HeadData, Header as BlockHeader, Id as ParaId, InboundDownwardMessage,
InboundHrmpMessage, MultiDisputeStatementSet, NodeFeatures, OccupiedCoreAssumption,
PersistedValidationData, PvfCheckStatement, PvfExecKind as RuntimePvfExecKind, SessionIndex,
SessionInfo, SignedAvailabilityBitfield, SignedAvailabilityBitfields, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
CandidateIndex, CoreIndex, DisputeState, ExecutorParams, GroupIndex, GroupRotationInfo, Hash,
HeadData, Header as BlockHeader, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
MultiDisputeStatementSet, NodeFeatures, OccupiedCoreAssumption, PersistedValidationData,
PvfCheckStatement, PvfExecKind as RuntimePvfExecKind, SessionIndex, SessionInfo,
SignedAvailabilityBitfield, SignedAvailabilityBitfields, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex, ValidatorSignature,
};
use polkadot_statement_table::v2::Misbehavior;
use std::{
Expand Down Expand Up @@ -250,9 +250,6 @@ pub enum CollatorProtocolMessage {
/// The core index where the candidate should be backed.
core_index: CoreIndex,
},
/// Report a collator as having provided an invalid collation. This should lead to disconnect
/// and blacklist of the collator.
ReportCollator(CollatorId),
/// Get a network bridge update.
#[from]
NetworkBridgeUpdate(NetworkBridgeEvent<net_protocol::CollatorProtocolMessage>),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ time per relay parent. This reduces the bandwidth requirements and as we can sec
the others are probably not required anyway. If the request times out, we need to note the collator as being unreliable
and reduce its priority relative to other collators.

As a validator, once the collation has been fetched some other subsystem will inspect and do deeper validation of the
collation. The subsystem will report to this subsystem with a [`CollatorProtocolMessage`][CPM]`::ReportCollator`. In
that case, if we are connected directly to the collator, we apply a cost to the `PeerId` associated with the collator
and potentially disconnect or blacklist it. If the collation is seconded, we notify the collator and apply a benefit to
the `PeerId` associated with the collator.

### Interaction with [Candidate Backing][CB]

As collators advertise the availability, a validator will simply second the first valid parablock candidate per relay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ digraph {
cand_sel -> coll_prot [arrowhead = "diamond", label = "FetchCollation"]
cand_sel -> cand_back [arrowhead = "onormal", label = "Second"]
cand_sel -> coll_prot [arrowhead = "onormal", label = "ReportCollator"]
cand_val -> runt_api [arrowhead = "diamond", label = "Request::PersistedValidationData"]
cand_val -> runt_api [arrowhead = "diamond", label = "Request::ValidationCode"]
Expand Down Expand Up @@ -231,7 +230,7 @@ sequenceDiagram
VS ->> CandidateSelection: Collation
Note over CandidateSelection: Lots of other machinery in play here,<br/>but there are only three outcomes from the<br/>perspective of the `CollatorProtocol`:
Note over CandidateSelection: Lots of other machinery in play here,<br/>but there are only two outcomes from the<br/>perspective of the `CollatorProtocol`:
alt happy path
CandidateSelection -->> VS: FetchCollation
Expand All @@ -242,10 +241,6 @@ sequenceDiagram
NB ->> VS: Collation
Deactivate VS
else collation invalid or unexpected
CandidateSelection ->> VS: ReportCollator
VS ->> NB: ReportPeer
else CandidateSelection already selected a different candidate
Note over CandidateSelection: silently drop
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,6 @@ enum CollatorProtocolMessage {
DistributeCollation(CandidateReceipt, PoV, Option<oneshot::Sender<CollationSecondedSignal>>),
/// Fetch a collation under the given relay-parent for the given ParaId.
FetchCollation(Hash, ParaId, ResponseChannel<(CandidateReceipt, PoV)>),
/// Report a collator as having provided an invalid collation. This should lead to disconnect
/// and blacklist of the collator.
ReportCollator(CollatorId),
/// Note a collator as having provided a good collation.
NoteGoodCollation(CollatorId, SignedFullStatement),
/// Notify a collator that its collation was seconded.
Expand Down
Loading

0 comments on commit 5b9bf84

Please sign in to comment.