Update ed25519-dalek to v2 (#1446)

* Update to ed25519-dalek v2
* Update Cargo.lock
* Remove default features
* Update cumulus/bridges/primitives/test-utils/src/keyring.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Chevdor
2023-09-08 12:14:57 +02:00
committed by GitHub
parent bce7c2465c
commit 92d7751b4d
4 changed files with 13 additions and 50 deletions
Generated
+6 -29
View File
@@ -1778,7 +1778,7 @@ dependencies = [
"bp-parachains",
"bp-polkadot-core",
"bp-runtime",
"ed25519-dalek 1.0.1",
"ed25519-dalek",
"finality-grandpa",
"parity-scale-codec",
"sp-application-crypto",
@@ -4560,15 +4560,6 @@ dependencies = [
"spki 0.7.2",
]
[[package]]
name = "ed25519"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7"
dependencies = [
"signature 1.6.4",
]
[[package]]
name = "ed25519"
version = "2.2.2"
@@ -4579,20 +4570,6 @@ dependencies = [
"signature 2.1.0",
]
[[package]]
name = "ed25519-dalek"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
dependencies = [
"curve25519-dalek 3.2.0",
"ed25519 1.5.3",
"rand 0.7.3",
"serde",
"sha2 0.9.9",
"zeroize",
]
[[package]]
name = "ed25519-dalek"
version = "2.0.0"
@@ -4600,7 +4577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980"
dependencies = [
"curve25519-dalek 4.0.0",
"ed25519 2.2.2",
"ed25519",
"rand_core 0.6.4",
"serde",
"sha2 0.10.7",
@@ -4628,7 +4605,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e83e509bcd060ca4b54b72bde5bb306cb2088cb01e14797ebae90a24f70f5f7"
dependencies = [
"curve25519-dalek 4.0.0",
"ed25519 2.2.2",
"ed25519",
"hashbrown 0.14.0",
"hex",
"rand_core 0.6.4",
@@ -7123,7 +7100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "276bb57e7af15d8f100d3c11cbdd32c6752b7eef4ba7a18ecf464972c07abcce"
dependencies = [
"bs58 0.4.0",
"ed25519-dalek 2.0.0",
"ed25519-dalek",
"log",
"multiaddr",
"multihash",
@@ -17194,7 +17171,7 @@ name = "sp-io"
version = "23.0.0"
dependencies = [
"bytes",
"ed25519-dalek 2.0.0",
"ed25519-dalek",
"libsecp256k1",
"log",
"parity-scale-codec",
@@ -17481,7 +17458,7 @@ version = "4.0.0-dev"
dependencies = [
"aes-gcm 0.10.2",
"curve25519-dalek 4.0.0",
"ed25519-dalek 2.0.0",
"ed25519-dalek",
"hkdf",
"parity-scale-codec",
"rand 0.8.5",
@@ -12,7 +12,7 @@ bp-parachains = { path = "../parachains", default-features = false }
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
bp-runtime = { path = "../runtime", default-features = false }
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] }
ed25519-dalek = { version = "2.0", default-features = false }
finality-grandpa = { version = "0.16.2", default-features = false }
sp-application-crypto = { path = "../../../../substrate/primitives/application-crypto", default-features = false }
sp-consensus-grandpa = { path = "../../../../substrate/primitives/consensus/grandpa", default-features = false }
@@ -18,7 +18,7 @@
use bp_header_chain::{justification::JustificationVerificationContext, AuthoritySet};
use codec::Encode;
use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signature};
use ed25519_dalek::{Signature, SigningKey, VerifyingKey};
use finality_grandpa::voter_set::VoterSet;
use sp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId};
use sp_runtime::RuntimeDebug;
@@ -37,29 +37,15 @@ pub const FERDIE: Account = Account(5);
pub struct Account(pub u16);
impl Account {
pub fn public(&self) -> PublicKey {
(&self.secret()).into()
pub fn public(&self) -> VerifyingKey {
self.pair().verifying_key()
}
pub fn secret(&self) -> SecretKey {
pub fn pair(&self) -> SigningKey {
let data = self.0.encode();
let mut bytes = [0_u8; 32];
bytes[0..data.len()].copy_from_slice(&data);
SecretKey::from_bytes(&bytes)
.expect("A static array of the correct length is a known good.")
}
pub fn pair(&self) -> Keypair {
let mut pair: [u8; 64] = [0; 64];
let secret = self.secret();
pair[..32].copy_from_slice(&secret.to_bytes());
let public = self.public();
pair[32..].copy_from_slice(&public.to_bytes());
Keypair::from_bytes(&pair)
.expect("We expect the SecretKey to be good, so this must also be good.")
SigningKey::from_bytes(&bytes)
}
pub fn sign(&self, msg: &[u8]) -> Signature {
+1 -1
View File
@@ -33,7 +33,7 @@ tracing = { version = "0.1.29", default-features = false }
tracing-core = { version = "0.1.28", default-features = false}
# Required for backwards compatibility reason, but only used for verifying when `UseDalekExt` is set.
ed25519-dalek = { version = "2.0.0", default-features = false, optional = true }
ed25519-dalek = { version = "2.0", default-features = false, optional = true }
[build-dependencies]
rustversion = "1.0.6"