mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 21:58:06 +00:00
* Companion for #13683 * Wraps trait is not required * update lockfile for {"substrate"} --------- Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+183
-183
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@ use polkadot_primitives::{
|
||||
CandidateDescriptor, CollatorId, GroupRotationInfo, HeadData, PersistedValidationData,
|
||||
PvfExecTimeoutKind, ScheduledCore,
|
||||
};
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::Keystore;
|
||||
use sp_tracing as _;
|
||||
|
||||
@@ -45,7 +45,7 @@ use polkadot_node_subsystem::{
|
||||
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_core::{sr25519::Pair, testing::TaskExecutor, Pair as PairT};
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
@@ -562,18 +562,18 @@ impl TestState {
|
||||
let validator_id = self.validators[index.0 as usize].public();
|
||||
|
||||
let payload = ApprovalVote(candidate_hash).signing_payload(session);
|
||||
let signature =
|
||||
Keystore::sign_with(&*keystore, ValidatorId::ID, &validator_id.into(), &payload[..])
|
||||
.ok()
|
||||
.flatten()
|
||||
.unwrap();
|
||||
let signature = keystore
|
||||
.sr25519_sign(ValidatorId::ID, &validator_id, &payload)
|
||||
.ok()
|
||||
.flatten()
|
||||
.unwrap();
|
||||
|
||||
SignedDisputeStatement::new_unchecked_from_trusted_source(
|
||||
DisputeStatement::Valid(ValidDisputeStatementKind::ApprovalChecking),
|
||||
candidate_hash,
|
||||
session,
|
||||
validator_id.into(),
|
||||
signature.try_into().unwrap(),
|
||||
signature.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ pub fn scheduled_core(id: u32) -> ScheduledCore {
|
||||
mod select_availability_bitfields {
|
||||
use super::{super::*, default_bitvec, occupied_core};
|
||||
use polkadot_primitives::{ScheduledCore, SigningContext, ValidatorId, ValidatorIndex};
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_keystore::{testing::MemoryKeystore, Keystore, KeystorePtr};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ use polkadot_primitives::{
|
||||
BlockNumber, Hash, Header, PvfCheckStatement, SessionIndex, ValidationCode, ValidationCodeHash,
|
||||
ValidatorId,
|
||||
};
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_core::testing::TaskExecutor;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::Keystore;
|
||||
|
||||
@@ -33,7 +33,7 @@ use polkadot_node_subsystem_test_helpers::make_subsystem_context;
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::{AvailabilityBitfield, Signed, ValidatorIndex};
|
||||
use rand_chacha::ChaCha12Rng;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_authority_discovery::AuthorityPair as AuthorityDiscoveryPair;
|
||||
use sp_core::Pair as PairT;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
|
||||
@@ -28,7 +28,7 @@ use lazy_static::lazy_static;
|
||||
|
||||
use polkadot_node_network_protocol::{authority_discovery::AuthorityDiscovery, PeerId};
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ use rand::{seq::SliceRandom as _, SeedableRng};
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
|
||||
use sc_network::Multiaddr;
|
||||
use sp_application_crypto::{AppKey, ByteArray};
|
||||
use sp_application_crypto::{AppCrypto, ByteArray};
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
|
||||
use polkadot_node_network_protocol::{
|
||||
|
||||
@@ -42,7 +42,7 @@ use polkadot_primitives_test_helpers::{
|
||||
dummy_committed_candidate_receipt, dummy_hash, AlwaysZeroRng,
|
||||
};
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sp_application_crypto::{sr25519::Pair, AppKey, Pair as TraitPair};
|
||||
use sp_application_crypto::{sr25519::Pair, AppCrypto, Pair as TraitPair};
|
||||
use sp_authority_discovery::AuthorityPair;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
|
||||
@@ -21,8 +21,8 @@ use std::collections::{
|
||||
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_keystore::{Error as KeystoreError, Keystore, KeystorePtr};
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_keystore::{Error as KeystoreError, KeystorePtr};
|
||||
|
||||
use super::{Statement, UncheckedSignedFullStatement};
|
||||
use polkadot_primitives::{
|
||||
@@ -221,26 +221,16 @@ impl SignedDisputeStatement {
|
||||
};
|
||||
|
||||
let data = dispute_statement.payload_data(candidate_hash, session_index);
|
||||
let signature = Keystore::sign_with(
|
||||
&**keystore,
|
||||
ValidatorId::ID,
|
||||
&validator_public.clone().into(),
|
||||
&data,
|
||||
)?;
|
||||
|
||||
let signature = match signature {
|
||||
Some(sig) =>
|
||||
sig.try_into().map_err(|_| KeystoreError::KeyNotSupported(ValidatorId::ID))?,
|
||||
None => return Ok(None),
|
||||
};
|
||||
|
||||
Ok(Some(Self {
|
||||
dispute_statement,
|
||||
candidate_hash,
|
||||
validator_public,
|
||||
validator_signature: signature,
|
||||
session_index,
|
||||
}))
|
||||
let signature = keystore
|
||||
.sr25519_sign(ValidatorId::ID, validator_public.as_ref(), &data)?
|
||||
.map(|sig| Self {
|
||||
dispute_statement,
|
||||
candidate_hash,
|
||||
validator_public,
|
||||
validator_signature: sig.into(),
|
||||
session_index,
|
||||
});
|
||||
Ok(signature)
|
||||
}
|
||||
|
||||
/// Access the underlying dispute statement
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ use polkadot_primitives::{
|
||||
ValidatorSignature,
|
||||
};
|
||||
pub use rand;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_core::ByteArray;
|
||||
use sp_keystore::{Error as KeystoreError, Keystore, KeystorePtr};
|
||||
use sp_keystore::{Error as KeystoreError, KeystorePtr};
|
||||
use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -276,7 +276,7 @@ pub fn signing_key_and_index(
|
||||
keystore: &KeystorePtr,
|
||||
) -> Option<(ValidatorId, ValidatorIndex)> {
|
||||
for (i, v) in validators.iter().enumerate() {
|
||||
if Keystore::has_keys(&**keystore, &[(v.to_raw_vec(), ValidatorId::ID)]) {
|
||||
if keystore.has_keys(&[(v.to_raw_vec(), ValidatorId::ID)]) {
|
||||
return Some((v.clone(), ValidatorIndex(i as _)))
|
||||
}
|
||||
}
|
||||
@@ -292,13 +292,10 @@ pub fn sign(
|
||||
key: &ValidatorId,
|
||||
data: &[u8],
|
||||
) -> Result<Option<ValidatorSignature>, KeystoreError> {
|
||||
let signature = Keystore::sign_with(&**keystore, ValidatorId::ID, &key.into(), &data)?;
|
||||
|
||||
match signature {
|
||||
Some(sig) =>
|
||||
Ok(Some(sig.try_into().map_err(|_| KeystoreError::KeyNotSupported(ValidatorId::ID))?)),
|
||||
None => Ok(None),
|
||||
}
|
||||
let signature = keystore
|
||||
.sr25519_sign(ValidatorId::ID, key.as_ref(), data)?
|
||||
.map(|sig| sig.into());
|
||||
Ok(signature)
|
||||
}
|
||||
|
||||
/// Find the validator group the given validator index belongs to.
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::num::NonZeroUsize;
|
||||
use lru::LruCache;
|
||||
|
||||
use parity_scale_codec::Encode;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_core::crypto::ByteArray;
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ use parity_scale_codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use application_crypto::AppKey;
|
||||
use application_crypto::AppCrypto;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_keystore::{Error as KeystoreError, Keystore, KeystorePtr};
|
||||
use sp_keystore::{Error as KeystoreError, KeystorePtr};
|
||||
use sp_std::prelude::Vec;
|
||||
|
||||
use primitives::RuntimeDebug;
|
||||
@@ -252,20 +252,14 @@ impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> UncheckedSigned<Payloa
|
||||
key: &ValidatorId,
|
||||
) -> Result<Option<Self>, KeystoreError> {
|
||||
let data = Self::payload_data(&payload, context);
|
||||
let signature = Keystore::sign_with(&**keystore, ValidatorId::ID, &key.into(), &data)?;
|
||||
|
||||
let signature = match signature {
|
||||
Some(sig) =>
|
||||
sig.try_into().map_err(|_| KeystoreError::KeyNotSupported(ValidatorId::ID))?,
|
||||
None => return Ok(None),
|
||||
};
|
||||
|
||||
Ok(Some(Self {
|
||||
payload,
|
||||
validator_index,
|
||||
signature,
|
||||
real_payload: std::marker::PhantomData,
|
||||
}))
|
||||
let signature =
|
||||
keystore.sr25519_sign(ValidatorId::ID, key.as_ref(), &data)?.map(|sig| Self {
|
||||
payload,
|
||||
validator_index,
|
||||
signature: sig.into(),
|
||||
real_payload: std::marker::PhantomData,
|
||||
});
|
||||
Ok(signature)
|
||||
}
|
||||
|
||||
/// Validate the payload given the context and public key
|
||||
|
||||
Reference in New Issue
Block a user