diff --git a/Cargo.lock b/Cargo.lock index ee6194be9..dcec5ea04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1402,17 +1402,32 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rustc_version 0.4.0", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.28", +] + [[package]] name = "curve25519-dalek-ng" version = "4.1.1" @@ -1534,6 +1549,7 @@ dependencies = [ "borsh", "clap", "const-rollup-config", + "demo-stf", "hex", "jsonrpsee", "rand 0.8.5", @@ -1740,19 +1756,10 @@ dependencies = [ "digest 0.10.7", "elliptic-curve", "rfc6979", - "signature 2.1.0", + "signature", "spki", ] -[[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.1" @@ -1760,7 +1767,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" dependencies = [ "pkcs8", - "signature 2.1.0", + "serde", + "signature", ] [[package]] @@ -1778,15 +1786,15 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ "curve25519-dalek", - "ed25519 1.5.3", - "rand 0.7.3", + "ed25519", + "rand_core 0.6.4", "serde", - "sha2 0.9.9", + "sha2 0.10.7", "zeroize", ] @@ -2329,6 +2337,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "fiat-crypto" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -3443,7 +3457,7 @@ dependencies = [ "elliptic-curve", "once_cell", "sha2 0.10.7", - "signature 2.1.0", + "signature", ] [[package]] @@ -4393,6 +4407,12 @@ dependencies = [ "crunchy", ] +[[package]] +name = "platforms" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" + [[package]] name = "plotters" version = "0.3.5" @@ -6387,12 +6407,6 @@ dependencies = [ "libc", ] -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - [[package]] name = "signature" version = "2.1.0" @@ -6528,6 +6542,7 @@ dependencies = [ "jmt", "serde", "serde_json", + "sov-attester-incentives", "sov-bank", "sov-chain-state", "sov-modules-api", @@ -6685,6 +6700,7 @@ dependencies = [ "serde_json", "sha2 0.10.7", "sov-bank", + "sov-cli", "sov-db", "sov-demo-rollup", "sov-ethereum", @@ -6793,13 +6809,14 @@ dependencies = [ "ed25519-dalek", "hex", "jsonrpsee", - "rand 0.7.3", + "rand 0.8.5", "risc0-zkvm", "risc0-zkvm-platform", "schemars", "serde", "serde_json", "sha2 0.10.7", + "sov-modules-api", "sov-modules-macros", "sov-rollup-interface", "sov-sequencer", @@ -7257,7 +7274,7 @@ checksum = "3f0a7d05cf78524782337f8edd55cbc578d159a16ad4affe2135c92f7dbac7f0" dependencies = [ "bytes", "digest 0.10.7", - "ed25519 2.2.1", + "ed25519", "ed25519-consensus", "flex-error", "futures", @@ -7270,7 +7287,7 @@ dependencies = [ "serde_json", "serde_repr", "sha2 0.10.7", - "signature 2.1.0", + "signature", "subtle", "subtle-encoding", "tendermint-proto", diff --git a/examples/demo-rollup/src/lib.rs b/examples/demo-rollup/src/lib.rs index 4f70b549f..e9f9f377b 100644 --- a/examples/demo-rollup/src/lib.rs +++ b/examples/demo-rollup/src/lib.rs @@ -43,7 +43,10 @@ pub fn get_genesis_config( let key_and_address: PrivateKeyAndAddress = hex_key .try_into() .expect("Failed to parse sequencer private key and address"); - assert!(key_and_address.is_matching(), "Inconsistent key data"); + assert!( + key_and_address.is_matching_to_default(), + "Inconsistent key data" + ); create_demo_genesis_config( 100000000, diff --git a/module-system/sov-cli/src/wallet_state.rs b/module-system/sov-cli/src/wallet_state.rs index 0851d1a56..08b8691ef 100644 --- a/module-system/sov-cli/src/wallet_state.rs +++ b/module-system/sov-cli/src/wallet_state.rs @@ -63,15 +63,9 @@ pub struct PrivateKeyAndAddress { pub address: Ctx::Address, } -impl PartialEq for PrivateKeyAndAddress { - fn eq(&self, other: &Self) -> bool { - self.private_key.pub_key() == other.private_key.pub_key() && self.address == other.address - } -} - impl PrivateKeyAndAddress { - /// Returns boolean if address actually matches the private key - pub fn is_matching(&self) -> bool { + /// Returns boolean if the private key matches default address + pub fn is_matching_to_default(&self) -> bool { self.private_key.to_address::() == self.address } @@ -96,7 +90,8 @@ impl PrivateKeyAndAddress { } /// A simplified struct representing private key and associated address -/// where the private key is represented as a hex string +/// where the private key is represented as a hex string and address as canonical string +/// TODO: Remove it https://github.com/Sovereign-Labs/sovereign-sdk/issues/766 #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct HexPrivateAndAddress { /// Private key is hex encoded bytes, without leading 0x @@ -310,7 +305,11 @@ mod tests { let decoded: PrivateKeyAndAddress = serde_json::from_str(&json).unwrap(); - assert_eq!(private_key_and_address, decoded); + assert_eq!( + private_key_and_address.private_key.pub_key(), + decoded.private_key.pub_key() + ); + assert_eq!(private_key_and_address.address, decoded.address); } #[test] @@ -327,6 +326,10 @@ mod tests { let converted = PrivateKeyAndAddress::::try_from(hex_private_key_and_address).unwrap(); - assert_eq!(private_key_and_address, converted) + assert_eq!( + private_key_and_address.private_key.pub_key(), + converted.private_key.pub_key() + ); + assert_eq!(private_key_and_address.address, converted.address); } } diff --git a/module-system/sov-modules-api/src/default_signature.rs b/module-system/sov-modules-api/src/default_signature.rs index 302e092c3..ab7be5a2b 100644 --- a/module-system/sov-modules-api/src/default_signature.rs +++ b/module-system/sov-modules-api/src/default_signature.rs @@ -40,6 +40,7 @@ pub mod private_key { } impl DefaultPrivateKey { + // This is private method and panics if input slice has incorrect length fn try_from_keypair(value: &[u8]) -> Result { let value: [u8; KEYPAIR_LENGTH] = value .try_into() @@ -48,6 +49,7 @@ pub mod private_key { Ok(Self { key_pair }) } + // This is private method and panics if input slice has incorrect length fn try_from_private_key(value: &[u8]) -> Self { let value: [u8; SECRET_KEY_LENGTH] = value .try_into()