session-info: add new fields + migration (#4545)

* session_info: v2 + migration

* use primitives::v2

* use polkadot_primitives::v2

* impl primitives::v2

* fix approval-voting tests

* fix other tests

* hook storage migration up

* backwards compat (1)

* backwards compat (2)

* fmt

* fix tests

* FMT

* do not reexport v1 in v2

* fmt

* set storage version to 1

Co-authored-by: Javier Viola <javier@parity.io>
This commit is contained in:
Andronik Ordian
2021-12-27 09:01:30 +01:00
committed by GitHub
parent 2e360f0aac
commit b342ae11d3
38 changed files with 542 additions and 299 deletions
+8 -5
View File
@@ -49,11 +49,14 @@ use futures::{
use parity_scale_codec::Encode;
use pin_project::pin_project;
use polkadot_primitives::v1::{
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState, EncodeAs,
GroupIndex, GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
PersistedValidationData, SessionIndex, SessionInfo, Signed, SigningContext, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
use polkadot_primitives::{
v1::{
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState, EncodeAs,
GroupIndex, GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
PersistedValidationData, SessionIndex, Signed, SigningContext, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
},
v2::SessionInfo,
};
use sp_application_crypto::AppKey;
use sp_core::{traits::SpawnNamed, ByteArray};
@@ -20,7 +20,10 @@
//! care about the state of particular blocks.
pub use polkadot_node_primitives::{new_session_window_size, SessionWindowSize};
use polkadot_primitives::v1::{Hash, SessionIndex, SessionInfo};
use polkadot_primitives::{
v1::{Hash, SessionIndex},
v2::SessionInfo,
};
use futures::channel::oneshot;
use polkadot_node_subsystem::{
@@ -288,6 +291,7 @@ mod tests {
n_delay_tranches: index as _,
no_show_slots: index as _,
needed_approvals: index as _,
active_validator_indices: Vec::new(),
}
}
@@ -26,10 +26,13 @@ use sp_core::crypto::ByteArray;
use sp_keystore::{CryptoStore, SyncCryptoStorePtr};
use polkadot_node_subsystem::{SubsystemContext, SubsystemSender};
use polkadot_primitives::v1::{
CandidateEvent, CoreState, EncodeAs, GroupIndex, GroupRotationInfo, Hash, OccupiedCore,
SessionIndex, SessionInfo, Signed, SigningContext, UncheckedSigned, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex,
use polkadot_primitives::{
v1::{
CandidateEvent, CoreState, EncodeAs, GroupIndex, GroupRotationInfo, Hash, OccupiedCore,
SessionIndex, Signed, SigningContext, UncheckedSigned, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex,
},
v2::SessionInfo,
};
use crate::{