mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 09:51:02 +00:00
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:
@@ -26,5 +26,5 @@
|
||||
//! 2. Move methods from `vstaging` to `v3`. The new stable version should include
|
||||
//! all methods from `vstaging` tagged with the new version number (e.g. all
|
||||
//! `v3` methods).
|
||||
pub mod v4;
|
||||
pub mod v5;
|
||||
pub mod vstaging;
|
||||
|
||||
+26
-7
@@ -11,7 +11,7 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
//! A module exporting runtime API implementation functions for all runtime APIs using v2
|
||||
//! A module exporting runtime API implementation functions for all runtime APIs using v5
|
||||
//! primitives.
|
||||
//!
|
||||
//! Runtimes implementing the v2 runtime API are recommended to forward directly to these
|
||||
@@ -22,12 +22,12 @@ use crate::{
|
||||
session_info, shared,
|
||||
};
|
||||
use primitives::{
|
||||
AuthorityDiscoveryId, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreIndex,
|
||||
CoreOccupied, CoreState, DisputeState, ExecutorParams, GroupIndex, GroupRotationInfo, Hash,
|
||||
Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, OccupiedCore, OccupiedCoreAssumption,
|
||||
PersistedValidationData, PvfCheckStatement, ScheduledCore, ScrapedOnChainVotes, SessionIndex,
|
||||
SessionInfo, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
|
||||
ValidatorSignature,
|
||||
slashing, AuthorityDiscoveryId, CandidateEvent, CandidateHash, CommittedCandidateReceipt,
|
||||
CoreIndex, CoreOccupied, CoreState, DisputeState, ExecutorParams, GroupIndex,
|
||||
GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
|
||||
OccupiedCore, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
|
||||
ScheduledCore, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode,
|
||||
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
use sp_runtime::traits::One;
|
||||
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
||||
@@ -425,3 +425,22 @@ pub fn session_executor_params<T: session_info::Config>(
|
||||
None => Some(ExecutorParams::default()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of `unapplied_slashes` runtime API
|
||||
pub fn unapplied_slashes<T: disputes::slashing::Config>(
|
||||
) -> Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)> {
|
||||
<disputes::slashing::Pallet<T>>::unapplied_slashes()
|
||||
}
|
||||
|
||||
/// Implementation of `submit_report_dispute_lost` runtime API
|
||||
pub fn submit_unsigned_slashing_report<T: disputes::slashing::Config>(
|
||||
dispute_proof: slashing::DisputeProof,
|
||||
key_ownership_proof: slashing::OpaqueKeyOwnershipProof,
|
||||
) -> Option<()> {
|
||||
let key_ownership_proof = key_ownership_proof.decode()?;
|
||||
|
||||
<disputes::slashing::Pallet<T>>::submit_unsigned_slashing_report(
|
||||
dispute_proof,
|
||||
key_ownership_proof,
|
||||
)
|
||||
}
|
||||
@@ -15,32 +15,3 @@
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Put implementations of functions from staging APIs here.
|
||||
|
||||
use crate::disputes;
|
||||
use primitives::{vstaging, CandidateHash, DisputeState, SessionIndex};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Implementation for `get_session_disputes` function from the runtime API
|
||||
pub fn get_session_disputes<T: disputes::Config>(
|
||||
) -> Vec<(SessionIndex, CandidateHash, DisputeState<T::BlockNumber>)> {
|
||||
<disputes::Pallet<T>>::disputes()
|
||||
}
|
||||
|
||||
/// Implementation of `unapplied_slashes` runtime API
|
||||
pub fn unapplied_slashes<T: disputes::slashing::Config>(
|
||||
) -> Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)> {
|
||||
<disputes::slashing::Pallet<T>>::unapplied_slashes()
|
||||
}
|
||||
|
||||
/// Implementation of `submit_report_dispute_lost` runtime API
|
||||
pub fn submit_unsigned_slashing_report<T: disputes::slashing::Config>(
|
||||
dispute_proof: vstaging::slashing::DisputeProof,
|
||||
key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof,
|
||||
) -> Option<()> {
|
||||
let key_ownership_proof = key_ownership_proof.decode()?;
|
||||
|
||||
<disputes::slashing::Pallet<T>>::submit_unsigned_slashing_report(
|
||||
dispute_proof,
|
||||
key_ownership_proof,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user