mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Update schnorrkel to 0.11.4 (#2524)
This commit is contained in:
Generated
+89
-882
File diff suppressed because it is too large
Load Diff
@@ -16,8 +16,8 @@ parity-scale-codec = { version = "3.6.1", default-features = false, features = [
|
||||
gum = { package = "tracing-gum", path = "../../gum" }
|
||||
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
|
||||
schnellru = "0.2.1"
|
||||
merlin = "2.0"
|
||||
schnorrkel = "0.9.1"
|
||||
merlin = "3.0"
|
||||
schnorrkel = "0.11.4"
|
||||
kvdb = "0.13.0"
|
||||
derive_more = "0.99.17"
|
||||
thiserror = "1.0.48"
|
||||
@@ -35,15 +35,14 @@ sp-consensus = { path = "../../../../substrate/primitives/consensus/common", def
|
||||
sp-consensus-slots = { path = "../../../../substrate/primitives/consensus/slots", default-features = false }
|
||||
sp-application-crypto = { path = "../../../../substrate/primitives/application-crypto", default-features = false, features = ["full_crypto"] }
|
||||
sp-runtime = { path = "../../../../substrate/primitives/runtime", default-features = false }
|
||||
rand_core = "0.5.1"
|
||||
# should match schnorrkel
|
||||
rand_core = "0.6.2"
|
||||
rand_chacha = { version = "0.3.1" }
|
||||
rand = "0.8.5"
|
||||
|
||||
[dev-dependencies]
|
||||
async-trait = "0.1.74"
|
||||
parking_lot = "0.12.0"
|
||||
# rand_core should match schnorrkel
|
||||
rand_core = "0.5.1"
|
||||
sp-keyring = { path = "../../../../substrate/primitives/keyring" }
|
||||
sp-keystore = { path = "../../../../substrate/primitives/keystore" }
|
||||
sp-core = { path = "../../../../substrate/primitives/core" }
|
||||
|
||||
@@ -20,6 +20,7 @@ use polkadot_node_primitives::approval::{
|
||||
v1::{AssignmentCert, AssignmentCertKind, VrfProof, VrfSignature, RELAY_VRF_MODULO_CONTEXT},
|
||||
v2::VrfPreOutput,
|
||||
};
|
||||
|
||||
pub fn make_bitvec(len: usize) -> BitVec<u8, BitOrderLsb0> {
|
||||
bitvec::bitvec![u8, BitOrderLsb0; 0; len]
|
||||
}
|
||||
@@ -30,10 +31,10 @@ pub fn dummy_assignment_cert(kind: AssignmentCertKind) -> AssignmentCert {
|
||||
let mut prng = rand_core::OsRng;
|
||||
let keypair = schnorrkel::Keypair::generate_with(&mut prng);
|
||||
let (inout, proof, _) = keypair.vrf_sign(ctx.bytes(msg));
|
||||
let out = inout.to_output();
|
||||
let preout = inout.to_preout();
|
||||
|
||||
AssignmentCert {
|
||||
kind,
|
||||
vrf: VrfSignature { pre_output: VrfPreOutput(out), proof: VrfProof(proof) },
|
||||
vrf: VrfSignature { pre_output: VrfPreOutput(preout), proof: VrfProof(proof) },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ fn compute_relay_vrf_modulo_assignments_v1(
|
||||
let cert = AssignmentCert {
|
||||
kind: AssignmentCertKind::RelayVRFModulo { sample: rvm_sample },
|
||||
vrf: VrfSignature {
|
||||
pre_output: VrfPreOutput(vrf_in_out.to_output()),
|
||||
pre_output: VrfPreOutput(vrf_in_out.to_preout()),
|
||||
proof: VrfProof(vrf_proof),
|
||||
},
|
||||
};
|
||||
@@ -543,7 +543,7 @@ fn compute_relay_vrf_modulo_assignments_v2(
|
||||
core_bitfield: assignment_bitfield.clone(),
|
||||
},
|
||||
vrf: VrfSignature {
|
||||
pre_output: VrfPreOutput(vrf_in_out.to_output()),
|
||||
pre_output: VrfPreOutput(vrf_in_out.to_preout()),
|
||||
proof: VrfProof(vrf_proof),
|
||||
},
|
||||
};
|
||||
@@ -578,7 +578,7 @@ fn compute_relay_vrf_delay_assignments(
|
||||
let cert = AssignmentCertV2 {
|
||||
kind: AssignmentCertKindV2::RelayVRFDelay { core_index: core },
|
||||
vrf: VrfSignature {
|
||||
pre_output: VrfPreOutput(vrf_in_out.to_output()),
|
||||
pre_output: VrfPreOutput(vrf_in_out.to_preout()),
|
||||
proof: VrfProof(vrf_proof),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -418,7 +418,7 @@ fn garbage_assignment_cert(kind: AssignmentCertKind) -> AssignmentCert {
|
||||
let mut prng = rand_core::OsRng;
|
||||
let keypair = schnorrkel::Keypair::generate_with(&mut prng);
|
||||
let (inout, proof, _) = keypair.vrf_sign(ctx.bytes(msg));
|
||||
let preout = inout.to_output();
|
||||
let preout = inout.to_preout();
|
||||
|
||||
AssignmentCert {
|
||||
kind,
|
||||
@@ -432,7 +432,7 @@ fn garbage_assignment_cert_v2(kind: AssignmentCertKindV2) -> AssignmentCertV2 {
|
||||
let mut prng = rand_core::OsRng;
|
||||
let keypair = schnorrkel::Keypair::generate_with(&mut prng);
|
||||
let (inout, proof, _) = keypair.vrf_sign(ctx.bytes(msg));
|
||||
let preout = inout.to_output();
|
||||
let preout = inout.to_preout();
|
||||
|
||||
AssignmentCertV2 {
|
||||
kind,
|
||||
|
||||
@@ -33,9 +33,9 @@ polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
|
||||
polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" }
|
||||
|
||||
assert_matches = "1.4.0"
|
||||
schnorrkel = { version = "0.9.1", default-features = false }
|
||||
schnorrkel = { version = "0.11.4", default-features = false }
|
||||
# rand_core should match schnorrkel
|
||||
rand_core = "0.5.1"
|
||||
rand_core = "0.6.2"
|
||||
rand_chacha = "0.3.1"
|
||||
env_logger = "0.9.0"
|
||||
log = "0.4.17"
|
||||
|
||||
@@ -297,7 +297,7 @@ fn fake_assignment_cert(block_hash: Hash, validator: ValidatorIndex) -> Indirect
|
||||
let mut prng = rand_core::OsRng;
|
||||
let keypair = schnorrkel::Keypair::generate_with(&mut prng);
|
||||
let (inout, proof, _) = keypair.vrf_sign(ctx.bytes(msg));
|
||||
let preout = inout.to_output();
|
||||
let preout = inout.to_preout();
|
||||
|
||||
IndirectAssignmentCert {
|
||||
block_hash,
|
||||
@@ -319,7 +319,7 @@ fn fake_assignment_cert_v2(
|
||||
let mut prng = rand_core::OsRng;
|
||||
let keypair = schnorrkel::Keypair::generate_with(&mut prng);
|
||||
let (inout, proof, _) = keypair.vrf_sign(ctx.bytes(msg));
|
||||
let preout = inout.to_output();
|
||||
let preout = inout.to_preout();
|
||||
|
||||
IndirectAssignmentCertV2 {
|
||||
block_hash,
|
||||
|
||||
@@ -21,7 +21,7 @@ sp-keystore = { path = "../../../substrate/primitives/keystore" }
|
||||
sp-maybe-compressed-blob = { path = "../../../substrate/primitives/maybe-compressed-blob" }
|
||||
sp-runtime = { path = "../../../substrate/primitives/runtime" }
|
||||
polkadot-parachain-primitives = { path = "../../parachain", default-features = false }
|
||||
schnorrkel = "0.9.1"
|
||||
schnorrkel = "0.11.4"
|
||||
thiserror = "1.0.48"
|
||||
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
|
||||
@@ -24,7 +24,7 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features =
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.1"
|
||||
ip_network = "0.4.1"
|
||||
libp2p = { version = "0.51.3", features = ["ed25519", "kad"] }
|
||||
libp2p = { version = "0.51.4", features = ["ed25519", "kad"] }
|
||||
multihash = { version = "0.18.1", default-features = false, features = [
|
||||
"sha2",
|
||||
"std",
|
||||
|
||||
@@ -20,7 +20,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
ahash = "0.8.2"
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.1"
|
||||
libp2p = "0.51.3"
|
||||
libp2p = "0.51.4"
|
||||
log = "0.4.17"
|
||||
schnellru = "0.2.1"
|
||||
tracing = "0.1.29"
|
||||
|
||||
@@ -28,7 +28,7 @@ fnv = "1.0.6"
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.2"
|
||||
ip_network = "0.4.1"
|
||||
libp2p = { version = "0.51.3", features = ["dns", "identify", "kad", "macros", "mdns", "noise", "ping", "request-response", "tcp", "tokio", "websocket", "yamux"] }
|
||||
libp2p = { version = "0.51.4", features = ["dns", "identify", "kad", "macros", "mdns", "noise", "ping", "request-response", "tcp", "tokio", "websocket", "yamux"] }
|
||||
linked_hash_set = "0.1.3"
|
||||
log = "0.4.17"
|
||||
mockall = "0.11.3"
|
||||
|
||||
@@ -20,7 +20,7 @@ array-bytes = "6.1"
|
||||
async-channel = "1.8.0"
|
||||
codec = { package = "parity-scale-codec", version = "3.6.1", features = ["derive"] }
|
||||
futures = "0.3.21"
|
||||
libp2p = "0.51.3"
|
||||
libp2p = "0.51.4"
|
||||
log = "0.4.17"
|
||||
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus" }
|
||||
sc-network-common = { path = "../common" }
|
||||
|
||||
@@ -25,7 +25,7 @@ async-trait = "0.1.74"
|
||||
codec = { package = "parity-scale-codec", version = "3.6.1", features = ["derive"] }
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.2"
|
||||
libp2p = "0.51.3"
|
||||
libp2p = "0.51.4"
|
||||
log = "0.4.17"
|
||||
mockall = "0.11.3"
|
||||
prost = "0.11"
|
||||
|
||||
@@ -20,7 +20,7 @@ tokio = "1.22.0"
|
||||
async-trait = "0.1.74"
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.1"
|
||||
libp2p = "0.51.3"
|
||||
libp2p = "0.51.4"
|
||||
log = "0.4.17"
|
||||
parking_lot = "0.12.1"
|
||||
rand = "0.8.5"
|
||||
|
||||
@@ -19,7 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
array-bytes = "6.1"
|
||||
codec = { package = "parity-scale-codec", version = "3.6.1", features = ["derive"] }
|
||||
futures = "0.3.21"
|
||||
libp2p = "0.51.3"
|
||||
libp2p = "0.51.4"
|
||||
log = "0.4.17"
|
||||
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus" }
|
||||
sc-network = { path = ".." }
|
||||
|
||||
@@ -24,7 +24,7 @@ futures = "0.3.21"
|
||||
futures-timer = "3.0.2"
|
||||
hyper = { version = "0.14.16", features = ["http2", "stream"] }
|
||||
hyper-rustls = { version = "0.24.0", features = ["http2"] }
|
||||
libp2p = "0.51.3"
|
||||
libp2p = "0.51.4"
|
||||
num_cpus = "1.13"
|
||||
once_cell = "1.8"
|
||||
parking_lot = "0.12.1"
|
||||
|
||||
@@ -19,7 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
chrono = "0.4.27"
|
||||
futures = "0.3.21"
|
||||
libp2p = { version = "0.51.3", features = ["dns", "tcp", "tokio", "wasm-ext", "websocket"] }
|
||||
libp2p = { version = "0.51.4", features = ["dns", "tcp", "tokio", "wasm-ext", "websocket"] }
|
||||
log = "0.4.17"
|
||||
parking_lot = "0.12.1"
|
||||
pin-project = "1.0.12"
|
||||
|
||||
@@ -50,8 +50,8 @@ array-bytes = { version = "6.1", optional = true }
|
||||
ed25519-zebra = { version = "3.1.0", default-features = false, optional = true }
|
||||
blake2 = { version = "0.10.4", default-features = false, optional = true }
|
||||
libsecp256k1 = { version = "0.7", default-features = false, features = ["static-context"], optional = true }
|
||||
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false }
|
||||
merlin = { version = "2.0", default-features = false }
|
||||
schnorrkel = { version = "0.11.4", features = ["preaudit_deprecated"], default-features = false }
|
||||
merlin = { version = "3.0", default-features = false }
|
||||
secp256k1 = { version = "0.28.0", default-features = false, features = ["alloc", "recovery"], optional = true }
|
||||
sp-core-hashing = { path = "hashing", default-features = false, optional = true }
|
||||
sp-runtime-interface = { path = "../runtime-interface", default-features = false }
|
||||
|
||||
@@ -555,7 +555,7 @@ pub mod vrf {
|
||||
use crate::crypto::{VrfCrypto, VrfPublic};
|
||||
use schnorrkel::{
|
||||
errors::MultiSignatureStage,
|
||||
vrf::{VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH},
|
||||
vrf::{VRF_PREOUT_LENGTH, VRF_PROOF_LENGTH},
|
||||
SignatureError,
|
||||
};
|
||||
|
||||
@@ -636,7 +636,7 @@ pub mod vrf {
|
||||
|
||||
/// VRF pre-output type suitable for schnorrkel operations.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct VrfPreOutput(pub schnorrkel::vrf::VRFOutput);
|
||||
pub struct VrfPreOutput(pub schnorrkel::vrf::VRFPreOut);
|
||||
|
||||
impl Encode for VrfPreOutput {
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
@@ -646,19 +646,19 @@ pub mod vrf {
|
||||
|
||||
impl Decode for VrfPreOutput {
|
||||
fn decode<R: codec::Input>(i: &mut R) -> Result<Self, codec::Error> {
|
||||
let decoded = <[u8; VRF_OUTPUT_LENGTH]>::decode(i)?;
|
||||
Ok(Self(schnorrkel::vrf::VRFOutput::from_bytes(&decoded).map_err(convert_error)?))
|
||||
let decoded = <[u8; VRF_PREOUT_LENGTH]>::decode(i)?;
|
||||
Ok(Self(schnorrkel::vrf::VRFPreOut::from_bytes(&decoded).map_err(convert_error)?))
|
||||
}
|
||||
}
|
||||
|
||||
impl MaxEncodedLen for VrfPreOutput {
|
||||
fn max_encoded_len() -> usize {
|
||||
<[u8; VRF_OUTPUT_LENGTH]>::max_encoded_len()
|
||||
<[u8; VRF_PREOUT_LENGTH]>::max_encoded_len()
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeInfo for VrfPreOutput {
|
||||
type Identity = [u8; VRF_OUTPUT_LENGTH];
|
||||
type Identity = [u8; VRF_PREOUT_LENGTH];
|
||||
|
||||
fn type_info() -> scale_info::Type {
|
||||
Self::Identity::type_info()
|
||||
@@ -717,11 +717,11 @@ pub mod vrf {
|
||||
|
||||
let proof = self.0.dleq_proove(extra, &inout, true).0;
|
||||
|
||||
VrfSignature { pre_output: VrfPreOutput(inout.to_output()), proof: VrfProof(proof) }
|
||||
VrfSignature { pre_output: VrfPreOutput(inout.to_preout()), proof: VrfProof(proof) }
|
||||
}
|
||||
|
||||
fn vrf_pre_output(&self, input: &Self::VrfInput) -> Self::VrfPreOutput {
|
||||
let pre_output = self.0.vrf_create_hash(input.0.clone()).to_output();
|
||||
let pre_output = self.0.vrf_create_hash(input.0.clone()).to_preout();
|
||||
VrfPreOutput(pre_output)
|
||||
}
|
||||
}
|
||||
@@ -762,6 +762,7 @@ pub mod vrf {
|
||||
ScalarFormatError => "Signature error: `ScalarFormatError`".into(),
|
||||
NotMarkedSchnorrkel => "Signature error: `NotMarkedSchnorrkel`".into(),
|
||||
BytesLengthError { .. } => "Signature error: `BytesLengthError`".into(),
|
||||
InvalidKey => "Signature error: `InvalidKey`".into(),
|
||||
MuSigAbsent { musig_stage: Commitment } =>
|
||||
"Signature error: `MuSigAbsent` at stage `Commitment`".into(),
|
||||
MuSigAbsent { musig_stage: Reveal } =>
|
||||
@@ -1141,7 +1142,7 @@ mod tests {
|
||||
})
|
||||
.unwrap();
|
||||
let signature2 =
|
||||
VrfSignature { pre_output: VrfPreOutput(inout.to_output()), proof: VrfProof(proof) };
|
||||
VrfSignature { pre_output: VrfPreOutput(inout.to_preout()), proof: VrfProof(proof) };
|
||||
|
||||
assert!(public.vrf_verify(&data, &signature2));
|
||||
assert_eq!(signature.pre_output, signature2.pre_output);
|
||||
|
||||
@@ -36,7 +36,7 @@ tracing = { version = "0.1.29", default-features = false }
|
||||
tracing-core = { version = "0.1.32", default-features = false }
|
||||
|
||||
# Required for backwards compatibility reason, but only used for verifying when `UseDalekExt` is set.
|
||||
ed25519-dalek = { version = "2.0", default-features = false, optional = true }
|
||||
ed25519-dalek = { version = "2.1", default-features = false, optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
rustversion = "1.0.6"
|
||||
|
||||
@@ -28,9 +28,9 @@ sp-externalities = { path = "../externalities", default-features = false }
|
||||
thiserror = { version = "1.0", optional = true }
|
||||
|
||||
# ECIES dependencies
|
||||
ed25519-dalek = { version = "2.0.0", optional = true }
|
||||
x25519-dalek = { version = "2.0.0", optional = true, features = ["static_secrets"] }
|
||||
curve25519-dalek = { version = "4.0.0", optional = true }
|
||||
ed25519-dalek = { version = "2.1", optional = true }
|
||||
x25519-dalek = { version = "2.0", optional = true, features = ["static_secrets"] }
|
||||
curve25519-dalek = { version = "4.1.1", optional = true }
|
||||
aes-gcm = { version = "0.10", optional = true }
|
||||
hkdf = { version = "0.12.0", optional = true }
|
||||
sha2 = { version = "0.10.7", optional = true }
|
||||
|
||||
Reference in New Issue
Block a user