Move vstaging to production (#7341)

* Move vstaging to production (and thus past session slashing).

WIP: test-runtime still needs to be fixed.

* Fix test-runtime.

---------

Co-authored-by: eskimor <eskimor@no-such-url.com>
This commit is contained in:
eskimor
2023-06-12 13:15:37 +02:00
committed by GitHub
parent d90173e438
commit 4527f24735
21 changed files with 236 additions and 122 deletions
@@ -37,10 +37,10 @@ use polkadot_node_subsystem::{
ApprovalVotingMessage, BlockDescription, ChainSelectionMessage, DisputeCoordinatorMessage,
DisputeDistributionMessage, ImportStatementsResult,
},
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, OverseerSignal,
overseer, ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, RuntimeApiError,
};
use polkadot_node_subsystem_util::runtime::{
key_ownership_proof, submit_report_dispute_lost, RuntimeInfo,
self, key_ownership_proof, submit_report_dispute_lost, RuntimeInfo,
};
use polkadot_primitives::{
vstaging, BlockNumber, CandidateHash, CandidateReceipt, CompactStatement, DisputeStatement,
@@ -424,8 +424,19 @@ impl Initialized {
dispute_proofs.push(dispute_proof);
},
Ok(None) => {},
Err(error) => {
Err(runtime::Error::RuntimeRequest(RuntimeApiError::NotSupported {
..
})) => {
gum::debug!(
target: LOG_TARGET,
?session_index,
?candidate_hash,
?validator_id,
"Key ownership proof not yet supported.",
);
},
Err(error) => {
gum::warn!(
target: LOG_TARGET,
?error,
?session_index,
@@ -480,6 +491,16 @@ impl Initialized {
.await;
match res {
Err(runtime::Error::RuntimeRequest(RuntimeApiError::NotSupported {
..
})) => {
gum::debug!(
target: LOG_TARGET,
?session_index,
?candidate_hash,
"Reporting pending slash not yet supported",
);
},
Err(error) => {
gum::warn!(
target: LOG_TARGET,
@@ -25,13 +25,13 @@ use lru::LruCache;
use polkadot_node_primitives::{DISPUTE_CANDIDATE_LIFETIME_AFTER_FINALIZATION, MAX_FINALITY_LAG};
use polkadot_node_subsystem::{
messages::ChainApiMessage, overseer, ActivatedLeaf, ActiveLeavesUpdate, ChainApiError,
SubsystemSender,
RuntimeApiError, SubsystemSender,
};
use polkadot_node_subsystem_util::runtime::{
get_candidate_events, get_on_chain_votes, get_unapplied_slashes,
self, get_candidate_events, get_on_chain_votes, get_unapplied_slashes,
};
use polkadot_primitives::{
vstaging, BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash,
slashing::PendingSlashes, BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash,
ScrapedOnChainVotes, SessionIndex,
};
@@ -67,7 +67,7 @@ const LRU_OBSERVED_BLOCKS_CAPACITY: NonZeroUsize = match NonZeroUsize::new(20) {
pub struct ScrapedUpdates {
pub on_chain_votes: Vec<ScrapedOnChainVotes>,
pub included_receipts: Vec<CandidateReceipt>,
pub unapplied_slashes: Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>,
pub unapplied_slashes: Vec<(SessionIndex, CandidateHash, PendingSlashes)>,
}
impl ScrapedUpdates {
@@ -270,8 +270,15 @@ impl ChainScraper {
Ok(unapplied_slashes) => {
scraped_updates.unapplied_slashes = unapplied_slashes;
},
Err(error) => {
Err(runtime::Error::RuntimeRequest(RuntimeApiError::NotSupported { .. })) => {
gum::debug!(
target: LOG_TARGET,
block_hash = ?activated.hash,
"Fetching unapplied slashes not yet supported.",
);
},
Err(error) => {
gum::warn!(
target: LOG_TARGET,
block_hash = ?activated.hash,
?error,