Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/fmt-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
container:
image: docker.io/paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240109
image: docker.io/paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v20240408
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: arc-runners-polkadot-sdk
timeout-minutes: 30
container:
image: "docker.io/paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240109"
image: "docker.io/paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v20240408"
env:
RUSTFLAGS: "-C debug-assertions -D warnings"
RUST_BACKTRACE: 1
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: arc-runners-polkadot-sdk
timeout-minutes: 30
container:
image: "docker.io/paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240109"
image: "docker.io/paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v20240408"
env:
RUSTFLAGS: "-C debug-assertions -D warnings"
RUST_BACKTRACE: "full"
Expand Down
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ workflow:
- if: $CI_COMMIT_BRANCH

variables:
CI_IMAGE: !reference [.ci-unified, variables, CI_IMAGE]
# CI_IMAGE: !reference [.ci-unified, variables, CI_IMAGE]
CI_IMAGE: "docker.io/paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v20240408"
# BUILDAH_IMAGE is defined in group variables
BUILDAH_COMMAND: "buildah --storage-driver overlay2"
RELENG_SCRIPTS_BRANCH: "master"
Expand Down
2 changes: 1 addition & 1 deletion docs/contributor/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The command below allows building a Linux binary without having to even install
docker run --rm -it \
-w /polkadot-sdk \
-v $(pwd):/polkadot-sdk \
paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240222 \
docker.io/paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v20240408 \
cargo build --release --locked -p polkadot-parachain-bin --bin polkadot-parachain
sudo chown -R $(id -u):$(id -g) target/
```
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/src/reference_docs/development_environment_advice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//! // Use nightly formatting.
//! // See the polkadot-sdk CI job that checks formatting for the current version used in
//! // polkadot-sdk.
//! "rust-analyzer.rustfmt.extraArgs": ["+nightly-2024-01-22"],
//! "rust-analyzer.rustfmt.extraArgs": ["+nightly-2024-04-10"],
//! }
//! ```
//!
Expand Down Expand Up @@ -79,7 +79,7 @@
//! # Use nightly formatting.
//! # See the polkadot-sdk CI job that checks formatting for the current version used in
//! # polkadot-sdk.
//! extraArgs = { "+nightly-2024-01-22" },
//! extraArgs = { "+nightly-2024-04-10" },
//! },
//! },
//! ```
Expand Down
17 changes: 7 additions & 10 deletions polkadot/node/core/runtime-api/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use polkadot_primitives::{
CandidateCommitments, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreIndex,
CoreState, DisputeState, ExecutorParams, GroupRotationInfo, Hash, Id as ParaId,
InboundDownwardMessage, InboundHrmpMessage, NodeFeatures, OccupiedCoreAssumption,
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
PersistedValidationData, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex,
};

/// For consistency we have the same capacity for all caches. We use 128 as we'll only need that
Expand Down Expand Up @@ -561,7 +561,7 @@ pub(crate) enum RequestResult {
// The structure of each variant is (relay_parent, [params,]*, result)
Authorities(Hash, Vec<AuthorityDiscoveryId>),
Validators(Hash, Vec<ValidatorId>),
MinimumBackingVotes(Hash, SessionIndex, u32),
MinimumBackingVotes(SessionIndex, u32),
ValidatorGroups(Hash, (Vec<Vec<ValidatorIndex>>, GroupRotationInfo)),
AvailabilityCores(Hash, Vec<CoreState>),
PersistedValidationData(Hash, ParaId, OccupiedCoreAssumption, Option<PersistedValidationData>),
Expand Down Expand Up @@ -589,19 +589,16 @@ pub(crate) enum RequestResult {
FetchOnChainVotes(Hash, Option<ScrapedOnChainVotes>),
PvfsRequirePrecheck(Hash, Vec<ValidationCodeHash>),
// This is a request with side-effects and no result, hence ().
SubmitPvfCheckStatement(Hash, PvfCheckStatement, ValidatorSignature, ()),
#[allow(dead_code)]
SubmitPvfCheckStatement(()),
ValidationCodeHash(Hash, ParaId, OccupiedCoreAssumption, Option<ValidationCodeHash>),
Version(Hash, u32),
Disputes(Hash, Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)>),
UnappliedSlashes(Hash, Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)>),
KeyOwnershipProof(Hash, ValidatorId, Option<slashing::OpaqueKeyOwnershipProof>),
// This is a request with side-effects.
SubmitReportDisputeLost(
Hash,
slashing::DisputeProof,
slashing::OpaqueKeyOwnershipProof,
Option<()>,
),
#[allow(dead_code)]
SubmitReportDisputeLost(Option<()>),
ApprovalVotingParams(Hash, SessionIndex, ApprovalVotingParams),
DisabledValidators(Hash, Vec<ValidatorIndex>),
ParaBackingState(Hash, ParaId, Option<async_backing::BackingState>),
Expand Down
19 changes: 11 additions & 8 deletions polkadot/node/core/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ where
self.requests_cache.cache_authorities(relay_parent, authorities),
Validators(relay_parent, validators) =>
self.requests_cache.cache_validators(relay_parent, validators),
MinimumBackingVotes(_, session_index, minimum_backing_votes) => self
MinimumBackingVotes(session_index, minimum_backing_votes) => self
.requests_cache
.cache_minimum_backing_votes(session_index, minimum_backing_votes),
ValidatorGroups(relay_parent, groups) =>
Expand Down Expand Up @@ -155,7 +155,7 @@ where
self.requests_cache.cache_on_chain_votes(relay_parent, scraped),
PvfsRequirePrecheck(relay_parent, pvfs) =>
self.requests_cache.cache_pvfs_require_precheck(relay_parent, pvfs),
SubmitPvfCheckStatement(_, _, _, ()) => {},
SubmitPvfCheckStatement(()) => {},
ValidationCodeHash(relay_parent, para_id, assumption, hash) => self
.requests_cache
.cache_validation_code_hash((relay_parent, para_id, assumption), hash),
Expand All @@ -170,7 +170,7 @@ where
.cache_key_ownership_proof((relay_parent, validator_id), key_ownership_proof),
RequestResult::ApprovalVotingParams(_relay_parent, session_index, params) =>
self.requests_cache.cache_approval_voting_params(session_index, params),
SubmitReportDisputeLost(_, _, _, _) => {},
SubmitReportDisputeLost(_) => {},
DisabledValidators(relay_parent, disabled_validators) =>
self.requests_cache.cache_disabled_validators(relay_parent, disabled_validators),
ParaBackingState(relay_parent, para_id, constraints) => self
Expand Down Expand Up @@ -370,7 +370,7 @@ where
async fn poll_requests(&mut self) {
// If there are no active requests, this future should be pending forever.
if self.active_requests.len() == 0 {
return futures::pending!()
return futures::pending!();
}

// If there are active requests, this will always resolve to `Some(_)` when a request is
Expand Down Expand Up @@ -439,7 +439,7 @@ where
}};
($req_variant:ident, $api_name:ident ($($param:expr),*), ver = $version:expr, $sender:expr, result = ( $($results:expr),* ) ) => {{
let sender = $sender;
let version: u32 = $version; // enforce type for the version expression
let version: u32 = $version; // enforce type for the version expression
let runtime_version = client.api_version_parachain_host(relay_parent).await
.unwrap_or_else(|e| {
gum::warn!(
Expand Down Expand Up @@ -570,7 +570,8 @@ where
SubmitPvfCheckStatement,
submit_pvf_check_statement(stmt, signature),
ver = 2,
sender
sender,
result = ()
)
},
Request::PvfsRequirePrecheck(sender) => {
Expand Down Expand Up @@ -606,13 +607,15 @@ where
SubmitReportDisputeLost,
submit_report_dispute_lost(dispute_proof, key_ownership_proof),
ver = Request::SUBMIT_REPORT_DISPUTE_LOST_RUNTIME_REQUIREMENT,
sender
sender,
result = ()
),
Request::MinimumBackingVotes(index, sender) => query!(
MinimumBackingVotes,
minimum_backing_votes(index),
ver = Request::MINIMUM_BACKING_VOTES_RUNTIME_REQUIREMENT,
sender
sender,
result = (index)
),
Request::DisabledValidators(sender) => query!(
DisabledValidators,
Expand Down
1 change: 1 addition & 0 deletions polkadot/node/network/approval-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ enum ApprovalEntryError {
InvalidCandidateIndex,
DuplicateApproval,
UnknownAssignment,
#[allow(dead_code)]
AssignmentsFollowedDifferentPaths(RequiredRouting, RequiredRouting),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ enum AdvertisementError {
/// parent.
ProtocolMisuse,
/// Advertisement is invalid.
#[allow(dead_code)]
Invalid(InsertAdvertisementError),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use std::collections::{HashMap, HashSet};

use futures::{future::RemoteHandle, Future, FutureExt};
use futures::{Future, FutureExt};

use polkadot_node_network_protocol::{
request_response::{
Expand Down Expand Up @@ -64,7 +64,7 @@ pub struct SendTask<M> {
/// Status of a particular vote/statement delivery to a particular validator.
enum DeliveryStatus {
/// Request is still in flight.
Pending(RemoteHandle<()>),
Pending,
/// Succeeded - no need to send request to this peer anymore.
Succeeded,
}
Expand Down Expand Up @@ -297,9 +297,8 @@ async fn send_requests<Context, M: 'static + Send + Sync>(
metrics.time_dispute_request(),
);

let (remote, remote_handle) = fut.remote_handle();
ctx.spawn("dispute-sender", remote.boxed()).map_err(FatalError::SpawnTask)?;
statuses.insert(receiver, DeliveryStatus::Pending(remote_handle));
ctx.spawn("dispute-sender", fut.boxed()).map_err(FatalError::SpawnTask)?;
statuses.insert(receiver, DeliveryStatus::Pending);
}

let msg = NetworkBridgeTxMessage::SendRequests(reqs, IfDisconnected::ImmediateError);
Expand Down
47 changes: 35 additions & 12 deletions polkadot/runtime/parachains/src/inclusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,22 +377,45 @@ pub mod pallet {
const LOG_TARGET: &str = "runtime::inclusion";

/// The reason that a candidate's outputs were rejected for.
#[derive(derive_more::From)]
#[cfg_attr(feature = "std", derive(Debug))]
enum AcceptanceCheckErr<BlockNumber> {
enum AcceptanceCheckErr {
HeadDataTooLarge,
/// Code upgrades are not permitted at the current time.
PrematureCodeUpgrade,
/// The new runtime blob is too large.
NewCodeTooLarge,
/// The candidate violated this DMP acceptance criteria.
ProcessedDownwardMessages(dmp::ProcessedDownwardMessagesAcceptanceErr),
ProcessedDownwardMessages,
/// The candidate violated this UMP acceptance criteria.
UpwardMessages(UmpAcceptanceCheckErr),
UpwardMessages,
/// The candidate violated this HRMP watermark acceptance criteria.
HrmpWatermark(hrmp::HrmpWatermarkAcceptanceErr<BlockNumber>),
HrmpWatermark,
/// The candidate violated this outbound HRMP acceptance criteria.
OutboundHrmp(hrmp::OutboundHrmpAcceptanceErr),
OutboundHrmp,
}

impl From<dmp::ProcessedDownwardMessagesAcceptanceErr> for AcceptanceCheckErr {
fn from(_: dmp::ProcessedDownwardMessagesAcceptanceErr) -> Self {
Self::ProcessedDownwardMessages
}
}

impl From<UmpAcceptanceCheckErr> for AcceptanceCheckErr {
fn from(_: UmpAcceptanceCheckErr) -> Self {
Self::UpwardMessages
}
}

impl<BlockNumber> From<hrmp::HrmpWatermarkAcceptanceErr<BlockNumber>> for AcceptanceCheckErr {
fn from(_: hrmp::HrmpWatermarkAcceptanceErr<BlockNumber>) -> Self {
Self::HrmpWatermark
}
}

impl From<hrmp::OutboundHrmpAcceptanceErr> for AcceptanceCheckErr {
fn from(_: hrmp::OutboundHrmpAcceptanceErr) -> Self {
Self::OutboundHrmp
}
}

/// An error returned by [`Pallet::check_upward_messages`] that indicates a violation of one of
Expand Down Expand Up @@ -1145,7 +1168,7 @@ const fn availability_threshold(n_validators: usize) -> usize {
supermajority_threshold(n_validators)
}

impl<BlockNumber> AcceptanceCheckErr<BlockNumber> {
impl AcceptanceCheckErr {
/// Returns the same error so that it can be threaded through a needle of `DispatchError` and
/// ultimately returned from a `Dispatchable`.
fn strip_into_dispatch_err<T: Config>(self) -> Error<T> {
Expand All @@ -1154,10 +1177,10 @@ impl<BlockNumber> AcceptanceCheckErr<BlockNumber> {
HeadDataTooLarge => Error::<T>::HeadDataTooLarge,
PrematureCodeUpgrade => Error::<T>::PrematureCodeUpgrade,
NewCodeTooLarge => Error::<T>::NewCodeTooLarge,
ProcessedDownwardMessages(_) => Error::<T>::IncorrectDownwardMessageHandling,
UpwardMessages(_) => Error::<T>::InvalidUpwardMessages,
HrmpWatermark(_) => Error::<T>::HrmpWatermarkMishandling,
OutboundHrmp(_) => Error::<T>::InvalidOutboundHrmp,
ProcessedDownwardMessages => Error::<T>::IncorrectDownwardMessageHandling,
UpwardMessages => Error::<T>::InvalidUpwardMessages,
HrmpWatermark => Error::<T>::HrmpWatermarkMishandling,
OutboundHrmp => Error::<T>::InvalidOutboundHrmp,
}
}
}
Expand Down Expand Up @@ -1300,7 +1323,7 @@ impl<T: Config> CandidateCheckContext<T> {
upward_messages: &[primitives::UpwardMessage],
hrmp_watermark: BlockNumberFor<T>,
horizontal_messages: &[primitives::OutboundHrmpMessage<ParaId>],
) -> Result<(), AcceptanceCheckErr<BlockNumberFor<T>>> {
) -> Result<(), AcceptanceCheckErr> {
ensure!(
head_data.0.len() <= self.config.max_head_data_size as _,
AcceptanceCheckErr::HeadDataTooLarge,
Expand Down
12 changes: 6 additions & 6 deletions substrate/client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,15 @@ mod tests {
type Error = sp_blockchain::Error;

struct DummyFactory(Arc<TestClient>);
struct DummyProposer(u64, Arc<TestClient>);
struct DummyProposer(Arc<TestClient>);

impl Environment<TestBlock> for DummyFactory {
type Proposer = DummyProposer;
type CreateProposer = futures::future::Ready<Result<DummyProposer, Error>>;
type Error = Error;

fn init(&mut self, parent_header: &<TestBlock as BlockT>::Header) -> Self::CreateProposer {
futures::future::ready(Ok(DummyProposer(parent_header.number + 1, self.0.clone())))
fn init(&mut self, _: &<TestBlock as BlockT>::Header) -> Self::CreateProposer {
futures::future::ready(Ok(DummyProposer(self.0.clone())))
}
}

Expand All @@ -604,9 +604,9 @@ mod tests {
_: Duration,
_: Option<usize>,
) -> Self::Proposal {
let r = BlockBuilderBuilder::new(&*self.1)
.on_parent_block(self.1.chain_info().best_hash)
.fetch_parent_block_number(&*self.1)
let r = BlockBuilderBuilder::new(&*self.0)
.on_parent_block(self.0.chain_info().best_hash)
.fetch_parent_block_number(&*self.0)
.unwrap()
.with_inherent_digests(digests)
.build()
Expand Down
10 changes: 3 additions & 7 deletions substrate/client/consensus/grandpa/src/communication/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ use std::{

#[derive(Debug)]
pub(crate) enum Event {
EventStream(TracingUnboundedSender<NetworkEvent>),
WriteNotification(PeerId, Vec<u8>),
Report(PeerId, ReputationChange),
Announce(Hash),
}

#[derive(Clone)]
Expand Down Expand Up @@ -146,15 +144,13 @@ impl NetworkEventStream for TestNetwork {
&self,
_name: &'static str,
) -> Pin<Box<dyn Stream<Item = NetworkEvent> + Send>> {
let (tx, rx) = tracing_unbounded("test", 100_000);
let _ = self.sender.unbounded_send(Event::EventStream(tx));
Box::pin(rx)
futures::stream::pending().boxed()
}
}

impl NetworkBlock<Hash, NumberFor<Block>> for TestNetwork {
fn announce_block(&self, hash: Hash, _data: Option<Vec<u8>>) {
let _ = self.sender.unbounded_send(Event::Announce(hash));
fn announce_block(&self, _: Hash, _data: Option<Vec<u8>>) {
unimplemented!();
}

fn new_best_block_imported(&self, _hash: Hash, _number: NumberFor<Block>) {
Expand Down
Loading