mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 16:21:02 +00:00
Upgradeable validation functions (#918)
* upgrade primitives to allow changing validation function * set up storage schema for old parachains code * fix compilation errors * fix test compilation * add some tests for past code meta * most of the runtime logic for code upgrades * implement old-code pruning * add a couple tests * clean up remaining TODOs * add a whole bunch of tests for runtime functionality * remove unused function * fix runtime compilation * extract some primitives to parachain crate * add validation-code upgrades to validation params and result * extend validation params with code upgrade fields * provide maximums to validation params * port test-parachains * add a code-upgrader test-parachain and tests * fix collator tests * move test-parachains to own folder to work around compilation errors * fix test compilation * update the Cargo.lock * fix parachains tests * remove dbg! invocation * use new pool in code-upgrader * bump lockfile * link TODO to issue
This commit is contained in:
committed by
GitHub
parent
b31b52dddf
commit
10cec3b591
@@ -59,7 +59,7 @@ use polkadot_primitives::{
|
||||
BlockId, Hash, Block,
|
||||
parachain::{
|
||||
self, BlockData, DutyRoster, HeadData, Id as ParaId,
|
||||
PoVBlock, ValidatorId, CollatorPair, LocalValidationData
|
||||
PoVBlock, ValidatorId, CollatorPair, LocalValidationData, GlobalValidationSchedule,
|
||||
}
|
||||
};
|
||||
use polkadot_cli::{
|
||||
@@ -154,7 +154,8 @@ pub trait ParachainContext: Clone {
|
||||
fn produce_candidate(
|
||||
&mut self,
|
||||
relay_parent: Hash,
|
||||
status: LocalValidationData,
|
||||
global_validation: GlobalValidationSchedule,
|
||||
local_validation: LocalValidationData,
|
||||
) -> Self::ProduceCandidate;
|
||||
}
|
||||
|
||||
@@ -162,6 +163,7 @@ pub trait ParachainContext: Clone {
|
||||
pub async fn collate<P>(
|
||||
relay_parent: Hash,
|
||||
local_id: ParaId,
|
||||
global_validation: GlobalValidationSchedule,
|
||||
local_validation_data: LocalValidationData,
|
||||
mut para_context: P,
|
||||
key: Arc<CollatorPair>,
|
||||
@@ -173,6 +175,7 @@ pub async fn collate<P>(
|
||||
{
|
||||
let (block_data, head_data) = para_context.produce_candidate(
|
||||
relay_parent,
|
||||
global_validation,
|
||||
local_validation_data,
|
||||
).map_err(Error::Collator).await?;
|
||||
|
||||
@@ -281,6 +284,7 @@ fn build_collator_service<S, P, Extrinsic>(
|
||||
|
||||
let work = future::lazy(move |_| {
|
||||
let api = client.runtime_api();
|
||||
let global_validation = try_fr!(api.global_validation_schedule(&id));
|
||||
let local_validation = match try_fr!(api.local_validation_data(&id, para_id)) {
|
||||
Some(local_validation) => local_validation,
|
||||
None => return future::Either::Left(future::ok(())),
|
||||
@@ -297,6 +301,7 @@ fn build_collator_service<S, P, Extrinsic>(
|
||||
let collation_work = collate(
|
||||
relay_parent,
|
||||
para_id,
|
||||
global_validation,
|
||||
local_validation,
|
||||
parachain_context,
|
||||
key,
|
||||
@@ -427,6 +432,7 @@ mod tests {
|
||||
fn produce_candidate(
|
||||
&mut self,
|
||||
_relay_parent: Hash,
|
||||
_global: GlobalValidationSchedule,
|
||||
_local_validation: LocalValidationData,
|
||||
) -> Self::ProduceCandidate {
|
||||
// send messages right back.
|
||||
|
||||
Reference in New Issue
Block a user