diff --git a/.changelog/unreleased/improvements/2115-rm-dkg.md b/.changelog/unreleased/improvements/2115-rm-dkg.md new file mode 100644 index 0000000000..2ef6a0207b --- /dev/null +++ b/.changelog/unreleased/improvements/2115-rm-dkg.md @@ -0,0 +1,2 @@ +- Removed the DKG implementation with its ferveo dependency. + ([\#2115](https://github.com/anoma/namada/pull/2115)) \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index fb694231ae..12333386b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if 1.0.0", - "cipher 0.4.4", + "cipher", "cpufeatures", ] @@ -163,18 +163,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ark-ed-on-bls12-381" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b7ada17db3854f5994e74e60b18e10e818594935ee7e1d329800c117b32970" -dependencies = [ - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-std", -] - [[package]] name = "ark-ff" version = "0.3.0" @@ -215,41 +203,16 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ark-poly" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0f78f47537c2f15706db7e98fe64cc1711dbf9def81218194e17239e53e5aa" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.11.2", -] - [[package]] name = "ark-serialize" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" dependencies = [ - "ark-serialize-derive", "ark-std", "digest 0.9.0", ] -[[package]] -name = "ark-serialize-derive" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd4e5f0bf8285d5ed538d27fab7411f3e297908fd93c62195de8bee3f199e82" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "ark-std" version = "0.3.0" @@ -591,15 +554,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.6", -] - [[package]] name = "blake2b-rs" version = "0.2.0" @@ -698,39 +652,16 @@ dependencies = [ "subtle 2.4.1", ] -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", -] - [[package]] name = "borsh" version = "1.0.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41898277107b0d3f027593697912977397eba6ac39a55bdd2eb02c1d5d5013b5" dependencies = [ - "borsh-derive 1.0.0-alpha.4", + "borsh-derive", "cfg_aliases", ] -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "borsh-derive" version = "1.0.0-alpha.4" @@ -738,41 +669,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413cb435569fe499e89235f758304e0e7198016baa351d8f5827ea0f40526ce0" dependencies = [ "once_cell", - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", "syn_derive", ] -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "borsh-ext" version = "1.0.0-alpha.4" source = "git+https://github.com/heliaxdev/borsh-ext?tag=v1.0.0-alpha.4#6bebf357002f96574ac37a28f547b6c88e91b799" dependencies = [ - "borsh 1.0.0-alpha.4", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "borsh", ] [[package]] @@ -915,7 +824,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -955,17 +864,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if 1.0.0", - "cipher 0.3.0", - "cpufeatures", -] - [[package]] name = "chacha20" version = "0.9.1" @@ -973,7 +871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if 1.0.0", - "cipher 0.4.4", + "cipher", "cpufeatures", ] @@ -984,8 +882,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ "aead", - "chacha20 0.9.1", - "cipher 0.4.4", + "chacha20", + "cipher", "poly1305", "zeroize", ] @@ -1029,15 +927,6 @@ dependencies = [ "half", ] -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.7", -] - [[package]] name = "cipher" version = "0.4.4" @@ -1524,7 +1413,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -1533,19 +1422,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle 2.4.1", - "zeroize", -] - [[package]] name = "curve25519-dalek-ng" version = "4.1.1" @@ -1766,20 +1642,10 @@ dependencies = [ "elliptic-curve", "rfc6979", "serdect", - "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 = [ - "serde 1.0.190", - "signature 1.6.4", -] - [[package]] name = "ed25519" version = "2.2.2" @@ -1787,7 +1653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" dependencies = [ "pkcs8", - "signature 2.1.0", + "signature", ] [[package]] @@ -1818,22 +1684,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek", - "ed25519 1.5.3", - "merlin", - "rand 0.7.3", - "serde 1.0.190", - "serde_bytes", - "sha2 0.9.9", - "zeroize", -] - [[package]] name = "either" version = "1.8.1" @@ -2342,56 +2192,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "ferveo" -version = "0.1.1" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-bls12-381", - "ark-ec", - "ark-ed-on-bls12-381", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "bincode", - "blake2", - "blake2b_simd", - "borsh 0.9.3", - "digest 0.10.6", - "ed25519-dalek", - "either", - "ferveo-common", - "group-threshold-cryptography", - "hex", - "itertools 0.10.5", - "measure_time", - "miracl_core", - "num 0.4.0", - "rand 0.7.3", - "rand 0.8.5", - "serde 1.0.190", - "serde_bytes", - "serde_json", - "subproductdomain", - "subtle 2.4.1", - "zeroize", -] - -[[package]] -name = "ferveo-common" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-ec", - "ark-serialize", - "ark-std", - "serde 1.0.190", - "serde_bytes", -] - [[package]] name = "ff" version = "0.13.0" @@ -2490,7 +2290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26c4b37de5ae15812a764c958297cfc50f5c010438f60c6ce75d11b802abd404" dependencies = [ "cbc", - "cipher 0.4.4", + "cipher", "libm", "num-bigint 0.4.3", "num-integer", @@ -2735,30 +2535,6 @@ dependencies = [ "subtle 2.4.1", ] -[[package]] -name = "group-threshold-cryptography" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "blake2b_simd", - "chacha20 0.8.2", - "hex", - "itertools 0.10.5", - "miracl_core", - "rand 0.8.5", - "rand_core 0.6.4", - "rayon", - "subproductdomain", - "thiserror", -] - [[package]] name = "gumdrop" version = "0.8.1" @@ -3226,7 +3002,7 @@ name = "index-set" version = "0.8.0" source = "git+https://github.com/heliaxdev/index-set?tag=v0.8.0#0c218cc300c1bb7a1acf34f21b6e9d489df5fda8" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "serde 1.0.190", ] @@ -3277,9 +3053,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -3388,7 +3161,7 @@ dependencies = [ "once_cell", "serdect", "sha2 0.10.6", - "signature 2.1.0", + "signature", ] [[package]] @@ -3611,10 +3384,10 @@ name = "masp_note_encryption" version = "0.2.0" source = "git+https://github.com/anoma/masp?rev=77e009626f3f52fe83c81ec6ee38fc2547d38da3#77e009626f3f52fe83c81ec6ee38fc2547d38da3" dependencies = [ - "borsh 1.0.0-alpha.4", - "chacha20 0.9.1", + "borsh", + "chacha20", "chacha20poly1305", - "cipher 0.4.4", + "cipher", "rand_core 0.6.4", "subtle 2.4.1", ] @@ -3630,7 +3403,7 @@ dependencies = [ "blake2b_simd", "blake2s_simd", "bls12_381", - "borsh 1.0.0-alpha.4", + "borsh", "byteorder", "ff", "fpe", @@ -3692,16 +3465,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -[[package]] -name = "measure_time" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" -dependencies = [ - "instant", - "log", -] - [[package]] name = "memchr" version = "2.5.0" @@ -3756,18 +3519,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93c0d11ac30a033511ae414355d80f70d9f29a44a49140face477117a1ee90db" -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - [[package]] name = "mime" version = "0.3.17" @@ -3833,12 +3584,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "miracl_core" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c7128ba23c81f6471141b90f17654f89ef44a56e14b8a4dd0fddfccd655277" - [[package]] name = "more-asserts" version = "0.2.2" @@ -3877,7 +3622,7 @@ dependencies = [ "async-trait", "base58 0.2.0", "bimap", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "byte-unit", "circular-queue", @@ -3952,7 +3697,7 @@ dependencies = [ "bimap", "bit-set", "blake2b-rs", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "byte-unit", "byteorder", @@ -3969,8 +3714,6 @@ dependencies = [ "ethbridge-events", "eyre", "fd-lock", - "ferveo", - "ferveo-common", "flate2", "futures", "git2", @@ -4034,10 +3777,9 @@ dependencies = [ name = "namada_benchmarks" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "criterion", - "ferveo-common", "namada", "namada_apps", "rand 0.8.5", @@ -4051,11 +3793,10 @@ name = "namada_core" version = "0.25.0" dependencies = [ "ark-bls12-381", - "ark-ec", "ark-serialize", "assert_matches", "bech32 0.8.1", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "chrono", "data-encoding", @@ -4064,9 +3805,6 @@ dependencies = [ "ethabi", "ethbridge-structs", "eyre", - "ferveo", - "ferveo-common", - "group-threshold-cryptography", "ibc", "ibc-derive", "ibc-proto", @@ -4111,7 +3849,7 @@ dependencies = [ name = "namada_encoding_spec" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "itertools 0.10.5", "lazy_static", "madato", @@ -4123,7 +3861,7 @@ name = "namada_ethereum_bridge" version = "0.25.0" dependencies = [ "assert_matches", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "data-encoding", "ethabi", @@ -4157,7 +3895,7 @@ name = "namada_proof_of_stake" version = "0.25.0" dependencies = [ "assert_matches", - "borsh 1.0.0-alpha.4", + "borsh", "data-encoding", "derivative", "itertools 0.10.5", @@ -4181,7 +3919,7 @@ dependencies = [ "async-trait", "base58 0.2.0", "bimap", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "circular-queue", "data-encoding", @@ -4226,7 +3964,7 @@ dependencies = [ name = "namada_test_utils" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "namada_core", "strum", ] @@ -4237,7 +3975,7 @@ version = "0.25.0" dependencies = [ "assert_cmd", "async-trait", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "chrono", "clap", @@ -4284,7 +4022,7 @@ dependencies = [ name = "namada_tx_prelude" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "masp_primitives", "namada_core", @@ -4299,7 +4037,7 @@ dependencies = [ name = "namada_vm_env" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "masp_primitives", "namada_core", ] @@ -4308,7 +4046,7 @@ dependencies = [ name = "namada_vp_prelude" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "namada_core", "namada_macros", @@ -4588,7 +4326,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", @@ -4600,7 +4338,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", @@ -4773,7 +4511,7 @@ version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -5120,15 +4858,6 @@ dependencies = [ "uint", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml 0.5.9", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -5895,7 +5624,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -5925,7 +5654,7 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -6279,12 +6008,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" @@ -6347,7 +6070,7 @@ version = "0.3.1-pre" source = "git+https://github.com/heliaxdev/sparse-merkle-tree?rev=aed81070ce2c83a41e1c6bada757347f33ef8eb6#aed81070ce2c83a41e1c6bada757347f33ef8eb6" dependencies = [ "blake2b-rs", - "borsh 1.0.0-alpha.4", + "borsh", "cfg-if 1.0.0", "ics23", "sha2 0.9.9", @@ -6415,19 +6138,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "subproductdomain" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", -] - [[package]] name = "subtle" version = "1.0.0" @@ -6574,7 +6284,7 @@ checksum = "bc2294fa667c8b548ee27a9ba59115472d0a09c2ba255771092a7f1dcf03a789" dependencies = [ "bytes", "digest 0.10.6", - "ed25519 2.2.2", + "ed25519", "ed25519-consensus 2.1.0", "flex-error", "futures", @@ -6587,7 +6297,7 @@ dependencies = [ "serde_json", "serde_repr", "sha2 0.10.6", - "signature 2.1.0", + "signature", "subtle 2.4.1", "subtle-encoding", "tendermint-proto", diff --git a/Cargo.toml b/Cargo.toml index 9d3d7f2a27..b9bf45dd6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,8 +77,6 @@ ethers = "2.0.0" expectrl = "0.7.0" eyre = "0.6.5" fd-lock = "3.0.12" -ferveo = {git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"} -ferveo-common = {git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"} flate2 = "1.0.22" fs_extra = "1.2.0" futures = "0.3" diff --git a/apps/Cargo.toml b/apps/Cargo.toml index 7b2b641cdd..9910adf96b 100644 --- a/apps/Cargo.toml +++ b/apps/Cargo.toml @@ -62,7 +62,7 @@ integration = [] [dependencies] -namada = {path = "../shared", features = ["ferveo-tpke", "masp-tx-gen", "multicore", "http-client", "tendermint-rpc"]} +namada = {path = "../shared", features = ["masp-tx-gen", "multicore", "http-client", "tendermint-rpc"]} namada_sdk = {path = "../sdk", default-features = false, features = ["wasm-runtime", "masp-tx-gen"]} namada_test_utils = {path = "../test_utils", optional = true} ark-serialize.workspace = true @@ -90,8 +90,6 @@ ethbridge-bridge-events.workspace = true ethbridge-events.workspace = true eyre.workspace = true fd-lock.workspace = true -ferveo-common.workspace = true -ferveo.workspace = true flate2.workspace = true futures.workspace = true itertools.workspace = true diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index d03d6713e1..1ee8be9082 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -338,11 +338,6 @@ pub async fn submit_init_validator<'a>( ) .unwrap(); let protocol_key = validator_keys.get_protocol_keypair().ref_to(); - let dkg_key = validator_keys - .dkg_keypair - .as_ref() - .expect("DKG sessions keys should have been created") - .public(); let validator_vp_code_hash = query_wasm_code_hash(namada, validator_vp_code_path.to_str().unwrap()) @@ -402,7 +397,6 @@ pub async fn submit_init_validator<'a>( eth_hot_key: key::secp256k1::PublicKey::try_from_pk(ð_hot_pk) .unwrap(), protocol_key, - dkg_key, commission_rate, max_commission_rate_change, email, diff --git a/apps/src/lib/config/genesis.rs b/apps/src/lib/config/genesis.rs index f9c54c9c79..7e6998eea5 100644 --- a/apps/src/lib/config/genesis.rs +++ b/apps/src/lib/config/genesis.rs @@ -19,7 +19,6 @@ use namada::ledger::parameters::EpochDuration; use namada::ledger::pos::{Dec, GenesisValidator, OwnedPosParams}; use namada::types::address::Address; use namada::types::chain::ProposalBytes; -use namada::types::key::dkg_session_keys::DkgPublicKey; use namada::types::key::*; use namada::types::time::{DateTimeUtc, DurationSecs}; use namada::types::token::Denomination; @@ -75,8 +74,6 @@ pub struct Validator { /// this key on a transaction signature. /// Note that this is distinct from consensus key used in the PoS system. pub account_key: common::PublicKey, - /// The public DKG session key used during the DKG protocol - pub dkg_public_key: DkgPublicKey, /// These tokens are not staked and hence do not contribute to the /// validator's voting power pub non_staked_balance: token::Amount, @@ -374,8 +371,7 @@ pub fn make_dev_genesis( ); let eth_cold_keypair = common::SecretKey::try_from_sk(&secp_eth_cold_keypair).unwrap(); - let (protocol_keypair, eth_bridge_keypair, dkg_keypair) = - defaults::validator_keys(); + let (protocol_keypair, eth_bridge_keypair) = defaults::validator_keys(); let alias = Alias::from_str(&format!("validator-{}", val + 1)) .expect("infallible"); // add the validator @@ -384,9 +380,6 @@ pub fn make_dev_genesis( address, tx: transactions::ValidatorAccountTx { alias: alias.clone(), - dkg_key: StringEncoded { - raw: dkg_keypair.public(), - }, vp: "vp_validator".to_string(), commission_rate: Dec::new(5, 2).expect("This can't fail"), max_commission_rate_change: Dec::new(1, 2) @@ -481,7 +474,7 @@ pub mod tests { let keypair: common::SecretKey = ed25519::SigScheme::generate(&mut rng).try_to_sk().unwrap(); let kp_arr = keypair.serialize_to_vec(); - let (protocol_keypair, _eth_hot_bridge_keypair, dkg_keypair) = + let (protocol_keypair, _eth_hot_bridge_keypair) = wallet::defaults::validator_keys(); // TODO: derive validator eth address from an eth keypair @@ -497,7 +490,6 @@ pub mod tests { println!("address: {}", address); println!("keypair: {:?}", kp_arr); println!("protocol_keypair: {:?}", protocol_keypair); - println!("dkg_keypair: {:?}", dkg_keypair.serialize_to_vec()); println!( "eth_cold_gov_keypair: {:?}", eth_cold_gov_keypair.serialize_to_vec() diff --git a/apps/src/lib/config/genesis/transactions.rs b/apps/src/lib/config/genesis/transactions.rs index 7232ccc801..47e1cf4343 100644 --- a/apps/src/lib/config/genesis/transactions.rs +++ b/apps/src/lib/config/genesis/transactions.rs @@ -13,7 +13,6 @@ use namada::proto::{ standalone_signature, verify_standalone_sig, SerializeWithBorsh, }; use namada::types::dec::Dec; -use namada::types::key::dkg_session_keys::DkgPublicKey; use namada::types::key::{common, RefTo, VerifySigError}; use namada::types::time::{DateTimeUtc, MIN_UTC}; use namada::types::token; @@ -145,15 +144,6 @@ pub fn init_validator( .protocol_keypair .ref_to(), ), - dkg_key: StringEncoded::new( - validator_wallet - .store - .validator_keys - .dkg_keypair - .as_ref() - .expect("Missing validator DKG key") - .public(), - ), tendermint_node_key: StringEncoded::new( validator_wallet.tendermint_node_key.ref_to(), ), @@ -263,7 +253,6 @@ pub fn sign_validator_account_tx( account_key, consensus_key, protocol_key, - dkg_key, tendermint_node_key, vp, commission_rate, @@ -309,7 +298,6 @@ pub fn sign_validator_account_tx( account_key, consensus_key, protocol_key, - dkg_key, tendermint_node_key, vp, commission_rate, @@ -567,7 +555,6 @@ pub type SignedValidatorAccountTx = ValidatorAccountTx; )] pub struct ValidatorAccountTx { pub alias: Alias, - pub dkg_key: StringEncoded, pub vp: String, /// Commission rate charged on rewards for delegators (bounded inside /// 0-1) @@ -1464,7 +1451,6 @@ impl From<&SignedValidatorAccountTx> for UnsignedValidatorAccountTx { fn from(tx: &SignedValidatorAccountTx) -> Self { let SignedValidatorAccountTx { alias, - dkg_key, vp, commission_rate, max_commission_rate_change, @@ -1483,7 +1469,6 @@ impl From<&SignedValidatorAccountTx> for UnsignedValidatorAccountTx { Self { alias: alias.clone(), - dkg_key: dkg_key.clone(), vp: vp.clone(), commission_rate: *commission_rate, max_commission_rate_change: *max_commission_rate_change, diff --git a/apps/src/lib/node/ledger/mod.rs b/apps/src/lib/node/ledger/mod.rs index c3b8309188..bfbef35041 100644 --- a/apps/src/lib/node/ledger/mod.rs +++ b/apps/src/lib/node/ledger/mod.rs @@ -118,17 +118,6 @@ impl Shell { Request::RevertProposal(_req) => { Ok(Response::RevertProposal(self.revert_proposal(_req))) } - #[cfg(feature = "abcipp")] - Request::ExtendVote(_req) => { - Ok(Response::ExtendVote(self.extend_vote(_req))) - } - #[cfg(feature = "abcipp")] - Request::VerifyVoteExtension(_req) => { - tracing::debug!("Request VerifyVoteExtension"); - Ok(Response::VerifyVoteExtension( - self.verify_vote_extension(_req), - )) - } Request::FinalizeBlock(finalize) => { tracing::debug!("Request FinalizeBlock"); self.load_proposals(); diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 332fedba15..389d543b30 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -339,16 +339,6 @@ where None, ) } - ref protocol_tx_type => { - tracing::error!( - ?protocol_tx_type, - "Internal logic error: FinalizeBlock received \ - an unsupported TxType::Protocol transaction: \ - {:?}", - protocol_tx - ); - continue; - } }, }; @@ -1031,8 +1021,6 @@ mod test_finalize_block { .unwrap(); shell.enqueue_tx(outer_tx.clone(), gas_limit); outer_tx.update_header(TxType::Decrypted(DecryptedTx::Decrypted)); - outer_tx.decrypt(::G2Affine::prime_subgroup_generator()) - .expect("Test failed"); ProcessedTx { tx: outer_tx.to_bytes().into(), result: TxResult { @@ -1617,8 +1605,7 @@ mod test_finalize_block { transfers: vec![transfer], relayer: bertha, }; - let (protocol_key, _, _) = - crate::wallet::defaults::validator_keys(); + let (protocol_key, _) = crate::wallet::defaults::validator_keys(); let validator_addr = crate::wallet::defaults::validator_address(); let ext = { let ext = ethereum_events::Vext { diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index 437205ca28..cda19fd502 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -414,7 +414,6 @@ where ValidatorAccountTx { alias, vp, - dkg_key, commission_rate, max_commission_rate_change, email, @@ -453,12 +452,6 @@ where .write(&protocol_pk_key(address), &protocol_key.pk.raw) .expect("Unable to set genesis user protocol public key"); - self.wl_storage - .write(&dkg_session_keys::dkg_pk_key(address), &dkg_key.raw) - .expect( - "Unable to set genesis user public DKG session key", - ); - // TODO: replace pos::init_genesis validators arg with // init_genesis_validator from here if let Err(err) = pos::namada_proof_of_stake::become_validator( diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index 769fb38155..18aaff3ade 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -60,10 +60,7 @@ use namada::types::key::*; use namada::types::storage::{BlockHeight, Key, TxIndex}; use namada::types::time::DateTimeUtc; use namada::types::transaction::protocol::EthereumTxData; -use namada::types::transaction::{ - hash_tx, verify_decrypted_correctly, AffineCurve, DecryptedTx, - EllipticCurve, PairingEngine, TxType, WrapperTx, -}; +use namada::types::transaction::{DecryptedTx, TxType, WrapperTx}; use namada::types::{address, token}; use namada::vm::wasm::{TxCache, VpCache}; use namada::vm::{WasmCacheAccess, WasmCacheRwAccess}; @@ -518,7 +515,7 @@ where } #[cfg(test)] { - let (protocol_keypair, eth_bridge_keypair, dkg_keypair) = + let (protocol_keypair, eth_bridge_keypair) = crate::wallet::defaults::validator_keys(); ShellMode::Validator { data: ValidatorData { @@ -527,7 +524,6 @@ where keys: ValidatorKeys { protocol_keypair, eth_bridge_keypair, - dkg_keypair: Some(dkg_keypair), }, }, broadcast_sender, @@ -2386,7 +2382,7 @@ mod shell_tests { let (shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT); - let (protocol_key, _, _) = wallet::defaults::validator_keys(); + let (protocol_key, _) = wallet::defaults::validator_keys(); let validator_addr = wallet::defaults::validator_address(); let ethereum_event = EthereumEvent::TransfersToNamada { @@ -2419,7 +2415,7 @@ mod shell_tests { let (shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT); - let (protocol_key, _, _) = wallet::defaults::validator_keys(); + let (protocol_key, _) = wallet::defaults::validator_keys(); let validator_addr = wallet::defaults::validator_address(); let ethereum_event = EthereumEvent::TransfersToNamada { diff --git a/apps/src/lib/node/ledger/shell/prepare_proposal.rs b/apps/src/lib/node/ledger/shell/prepare_proposal.rs index 753240fdfd..57c00ff867 100644 --- a/apps/src/lib/node/ledger/shell/prepare_proposal.rs +++ b/apps/src/lib/node/ledger/shell/prepare_proposal.rs @@ -11,10 +11,7 @@ use namada::types::address::Address; use namada::types::internal::TxInQueue; use namada::types::key::tm_raw_hash_to_string; use namada::types::time::DateTimeUtc; -use namada::types::transaction::wrapper::wrapper_tx::PairingEngine; -use namada::types::transaction::{ - AffineCurve, DecryptedTx, EllipticCurve, TxType, -}; +use namada::types::transaction::{DecryptedTx, TxType}; use namada::vm::wasm::{TxCache, VpCache}; use namada::vm::WasmCacheAccess; @@ -262,9 +259,6 @@ where &self, mut alloc: BlockAllocator, ) -> (Vec, BlockAllocator) { - // TODO: This should not be hardcoded - let privkey = - ::G2Affine::prime_subgroup_generator(); let pos_queries = self.wl_storage.pos_queries(); let txs = self .wl_storage @@ -277,21 +271,8 @@ where gas: _, }| { let mut tx = tx.clone(); - match tx.decrypt(privkey).ok() - { - Some(_) => { - tx.update_header(TxType::Decrypted(DecryptedTx::Decrypted)); - tx - }, - // An absent or undecryptable inner_tx are both - // treated as undecryptable - None => { - tx.update_header(TxType::Decrypted( - DecryptedTx::Undecryptable - )); - tx - }, - }.to_bytes().into() + tx.update_header(TxType::Decrypted(DecryptedTx::Decrypted)); + tx.to_bytes().into() }, ) // TODO: make sure all decrypted txs are accepted @@ -497,7 +478,7 @@ mod test_prepare_proposal { let (shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT); let signed_vote_extension = { - let (protocol_key, _, _) = wallet::defaults::validator_keys(); + let (protocol_key, _) = wallet::defaults::validator_keys(); let validator_addr = wallet::defaults::validator_address(); // generate a valid signature @@ -529,7 +510,7 @@ mod test_prepare_proposal { const LAST_HEIGHT: BlockHeight = BlockHeight(3); fn check_invalid(shell: &TestShell, height: BlockHeight) { - let (protocol_key, _, _) = wallet::defaults::validator_keys(); + let (protocol_key, _) = wallet::defaults::validator_keys(); let validator_addr = wallet::defaults::validator_address(); let signed_vote_extension = { @@ -702,7 +683,7 @@ mod test_prepare_proposal { ); // test prepare proposal - let (protocol_key, _, _) = wallet::defaults::validator_keys(); + let (protocol_key, _) = wallet::defaults::validator_keys(); let validator_addr = wallet::defaults::validator_address(); let ethereum_event = EthereumEvent::TransfersToNamada { diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index 58c7e15eac..bfb8ac26a5 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -319,9 +319,6 @@ where Err(tx_result) => return tx_result, }; - // TODO: This should not be hardcoded - let privkey = ::G2Affine::prime_subgroup_generator(); - if let Err(err) = tx.validate_tx() { return TxResult { code: ErrorCodes::InvalidSig.into(), @@ -512,10 +509,6 @@ where self.validate_vexts_in_proposal(valid_extensions) } - _ => TxResult { - code: ErrorCodes::InvalidTx.into(), - info: "Unsupported protocol transaction type".into(), - }, } } TxType::Decrypted(tx_header) => { @@ -531,22 +524,22 @@ where determined in the previous block" .into(), } - } else if verify_decrypted_correctly( - &tx_header, - wrapper.tx.clone(), - privkey, + } else if matches!( + tx_header, + DecryptedTx::Undecryptable ) { + // DKG is disabled, txs are not actually encrypted TxResult { - code: ErrorCodes::Ok.into(), - info: "Process Proposal accepted this \ - tranasction" + code: ErrorCodes::InvalidTx.into(), + info: "The encrypted payload of tx was \ + incorrectly marked as un-decryptable" .into(), } } else { TxResult { - code: ErrorCodes::InvalidTx.into(), - info: "The encrypted payload of tx was \ - incorrectly marked as un-decryptable" + code: ErrorCodes::Ok.into(), + info: "Process Proposal accepted this \ + tranasction" .into(), } } @@ -632,46 +625,35 @@ where } } - // validate the ciphertext via Ferveo - if !tx.validate_ciphertext() { - TxResult { - code: ErrorCodes::InvalidTx.into(), - info: format!( - "The ciphertext of the wrapped tx {} is invalid", - hash_tx(tx_bytes) - ), - } - } else { - // Replay protection checks - if let Err(e) = - self.replay_protection_checks(&tx, temp_wl_storage) - { - return TxResult { - code: ErrorCodes::ReplayTx.into(), - info: e.to_string(), - }; - } + // Replay protection checks + if let Err(e) = + self.replay_protection_checks(&tx, temp_wl_storage) + { + return TxResult { + code: ErrorCodes::ReplayTx.into(), + info: e.to_string(), + }; + } - // Check that the fee payer has sufficient balance. - match self.wrapper_fee_check( - &wrapper, - get_fee_unshielding_transaction(&tx, &wrapper), - temp_wl_storage, - vp_wasm_cache, - tx_wasm_cache, - Some(block_proposer), - false, - ) { - Ok(()) => TxResult { - code: ErrorCodes::Ok.into(), - info: "Process proposal accepted this transaction" - .into(), - }, - Err(e) => TxResult { - code: ErrorCodes::FeeError.into(), - info: e.to_string(), - }, - } + // Check that the fee payer has sufficient balance. + match self.wrapper_fee_check( + &wrapper, + get_fee_unshielding_transaction(&tx, &wrapper), + temp_wl_storage, + vp_wasm_cache, + tx_wasm_cache, + Some(block_proposer), + false, + ) { + Ok(()) => TxResult { + code: ErrorCodes::Ok.into(), + info: "Process proposal accepted this transaction" + .into(), + }, + Err(e) => TxResult { + code: ErrorCodes::FeeError.into(), + info: e.to_string(), + }, } } } @@ -704,7 +686,6 @@ mod test_process_proposal { Code, Data, Section, SignableEthMessage, Signature, Signed, }; use namada::types::ethereum_events::EthereumEvent; - use namada::types::hash::Hash; use namada::types::key::*; use namada::types::storage::Epoch; use namada::types::time::DateTimeUtc; @@ -854,7 +835,7 @@ mod test_process_proposal { fn test_drop_vext_with_invalid_sigs() { const LAST_HEIGHT: BlockHeight = BlockHeight(2); let (mut shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT); - let (protocol_key, _, _) = wallet::defaults::validator_keys(); + let (protocol_key, _) = wallet::defaults::validator_keys(); let addr = wallet::defaults::validator_address(); let event = EthereumEvent::TransfersToNamada { nonce: 0u64.into(), @@ -885,7 +866,7 @@ mod test_process_proposal { const LAST_HEIGHT: BlockHeight = BlockHeight(3); const INVALID_HEIGHT: BlockHeight = BlockHeight(LAST_HEIGHT.0 + 1); let (mut shell, _recv, _, _) = test_utils::setup_at_height(LAST_HEIGHT); - let (protocol_key, _, _) = wallet::defaults::validator_keys(); + let (protocol_key, _) = wallet::defaults::validator_keys(); let addr = wallet::defaults::validator_address(); let event = EthereumEvent::TransfersToNamada { nonce: 0u64.into(), @@ -1291,57 +1272,8 @@ mod test_process_proposal { ) } - /// Test that a wrapper tx whose inner_tx does not have - /// the same hash as the wrappers tx_hash field is marked - /// undecryptable but still accepted - #[test] - fn test_invalid_hash_commitment() { - let (mut shell, _recv, _, _) = test_utils::setup_at_height(3u64); - let keypair = crate::wallet::defaults::daewon_keypair(); - - let mut tx = Tx::from_type(TxType::Wrapper(Box::new(WrapperTx::new( - Fee { - amount_per_gas_unit: Default::default(), - token: shell.wl_storage.storage.native_token.clone(), - }, - keypair.ref_to(), - Epoch(0), - GAS_LIMIT_MULTIPLIER.into(), - None, - )))); - tx.header.chain_id = shell.chain_id.clone(); - tx.set_code(Code::new("wasm_code".as_bytes().to_owned())); - tx.set_data(Data::new("transaction data".as_bytes().to_owned())); - tx.set_code_sechash(Hash([0u8; 32])); - tx.set_data_sechash(Hash([0u8; 32])); - - let gas_limit = Gas::from(tx.header().wrapper().unwrap().gas_limit) - .checked_sub(Gas::from(tx.to_bytes().len() as u64)) - .unwrap(); - shell.enqueue_tx(tx.clone(), gas_limit); - - tx.header.tx_type = TxType::Decrypted(DecryptedTx::Undecryptable); - - let response = { - let request = ProcessProposal { - txs: vec![tx.to_bytes()], - }; - if let [resp] = shell - .process_proposal(request) - .expect("Test failed") - .as_slice() - { - resp.clone() - } else { - panic!("Test failed") - } - }; - assert_eq!(response.result.code, u32::from(ErrorCodes::Ok)); - } - - /// Test that if a wrapper tx contains garbage bytes - /// as its encrypted inner tx, it is correctly - /// marked undecryptable and the errors handled correctly + /// Test that if a wrapper tx contains marked undecryptable the proposal is + /// rejected #[test] fn test_undecryptable() { let (mut shell, _recv, _, _) = test_utils::setup_at_height(3u64); @@ -1368,21 +1300,10 @@ mod test_process_proposal { .unwrap(); shell.enqueue_tx(tx, gas_limit); - let response = { - let request = ProcessProposal { - txs: vec![decrypted.to_bytes()], - }; - if let [resp] = shell - .process_proposal(request) - .expect("Test failed") - .as_slice() - { - resp.clone() - } else { - panic!("Test failed") - } + let request = ProcessProposal { + txs: vec![decrypted.to_bytes()], }; - assert_eq!(response.result.code, u32::from(ErrorCodes::Ok)); + shell.process_proposal(request).expect_err("Test failed"); } /// Test that if more decrypted txs are submitted to diff --git a/apps/src/lib/node/ledger/shell/queries.rs b/apps/src/lib/node/ledger/shell/queries.rs index db971cc0cb..e7e3c7e703 100644 --- a/apps/src/lib/node/ledger/shell/queries.rs +++ b/apps/src/lib/node/ledger/shell/queries.rs @@ -1,17 +1,9 @@ //! Shell methods for querying state -use borsh_ext::BorshSerializeExt; -use ferveo_common::TendermintValidator; use namada::ledger::dry_run_tx; -use namada::ledger::pos::into_tm_voting_power; use namada::ledger::queries::{RequestCtx, ResponseQuery}; use namada::ledger::storage_api::token; -use namada::proof_of_stake::{ - read_consensus_validator_set_addresses_with_stake, read_pos_params, -}; use namada::types::address::Address; -use namada::types::key; -use namada::types::key::dkg_session_keys::DkgPublicKey; use super::*; use crate::node::ledger::response; @@ -82,55 +74,6 @@ where token::read_balance(&self.wl_storage, token, owner) .expect("Token balance read in the protocol must not fail") } - - /// Lookup data about a validator from their protocol signing key - #[allow(dead_code)] - pub fn get_validator_from_protocol_pk( - &self, - pk: &common::PublicKey, - ) -> Option> { - let pk_bytes = pk.serialize_to_vec(); - // get the current epoch - let (current_epoch, _) = self.wl_storage.storage.get_current_epoch(); - - // TODO: resolve both unwrap() instances better below - - // get the PoS params - let pos_params = read_pos_params(&self.wl_storage).unwrap(); - // get the consensus validator set - let consensus_vals = read_consensus_validator_set_addresses_with_stake( - &self.wl_storage, - current_epoch, - ) - .unwrap(); - - consensus_vals - .iter() - .find(|validator| { - let pk_key = key::protocol_pk_key(&validator.address); - match self.wl_storage.read_bytes(&pk_key) { - Ok(Some(bytes)) => bytes == pk_bytes, - _ => false, - } - }) - .map(|validator| { - let dkg_key = - key::dkg_session_keys::dkg_pk_key(&validator.address); - let dkg_publickey: DkgPublicKey = self - .wl_storage - .read(&dkg_key) - .expect("Validator should have public dkg key") - .expect("Validator should have public dkg key"); - TendermintValidator { - power: into_tm_voting_power( - pos_params.tm_votes_per_token, - validator.bonded_stake, - ) as u64, - address: validator.address.to_string(), - public_key: (&dkg_publickey).into(), - } - }) - } } // NOTE: we are testing `namada::ledger::queries_ext`, @@ -140,6 +83,7 @@ where mod test_queries { use namada::core::ledger::storage::EPOCH_SWITCH_BLOCKS_DELAY; use namada::ledger::pos::PosQueries; + use namada::proof_of_stake::read_consensus_validator_set_addresses_with_stake; use namada::proof_of_stake::types::WeightedValidator; use namada::types::storage::Epoch; use namada_sdk::eth_bridge::{EthBridgeQueries, SendValsetUpd}; diff --git a/apps/src/lib/node/ledger/storage/rocksdb.rs b/apps/src/lib/node/ledger/storage/rocksdb.rs index bdebad857c..e3f2bc0fc4 100644 --- a/apps/src/lib/node/ledger/storage/rocksdb.rs +++ b/apps/src/lib/node/ledger/storage/rocksdb.rs @@ -38,12 +38,11 @@ //! - `last`: the hashes included in the last block use std::fs::File; -use std::io::BufWriter; +use std::io::{BufWriter, Write}; use std::path::Path; use std::str::FromStr; use std::sync::Mutex; -use ark_serialize::Write; use borsh::BorshDeserialize; use borsh_ext::BorshSerializeExt; use data_encoding::HEXLOWER; diff --git a/apps/src/lib/proto/generated/google.protobuf.rs b/apps/src/lib/proto/generated/google.protobuf.rs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/src/lib/proto/generated/services.rs b/apps/src/lib/proto/generated/services.rs deleted file mode 100644 index 76196146dd..0000000000 --- a/apps/src/lib/proto/generated/services.rs +++ /dev/null @@ -1,35 +0,0 @@ -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct IntentMessage { - #[prost(message, optional, tag="1")] - pub intent: ::core::option::Option<::namada::proto::generated::types::Intent>, - #[prost(string, tag="2")] - pub topic: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SubscribeTopicMessage { - #[prost(string, tag="2")] - pub topic: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RpcMessage { - #[prost(oneof="rpc_message::Message", tags="1, 2, 3")] - pub message: ::core::option::Option, -} -/// Nested message and enum types in `RpcMessage`. -pub mod rpc_message { - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Message { - #[prost(message, tag="1")] - Intent(super::IntentMessage), - #[prost(message, tag="2")] - Topic(super::SubscribeTopicMessage), - #[prost(message, tag="3")] - Dkg(::namada::proto::generated::types::Dkg), - } -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RpcResponse { - #[prost(string, tag="1")] - pub result: ::prost::alloc::string::String, -} -# [doc = r" Generated client implementations."] pub mod rpc_service_client { # ! [allow (unused_variables , dead_code , missing_docs , clippy :: let_unit_value ,)] use tonic :: codegen :: * ; # [derive (Debug , Clone)] pub struct RpcServiceClient < T > { inner : tonic :: client :: Grpc < T > , } impl RpcServiceClient < tonic :: transport :: Channel > { # [doc = r" Attempt to create a new client by connecting to a given endpoint."] pub async fn connect < D > (dst : D) -> Result < Self , tonic :: transport :: Error > where D : std :: convert :: TryInto < tonic :: transport :: Endpoint > , D :: Error : Into < StdError > , { let conn = tonic :: transport :: Endpoint :: new (dst) ? . connect () . await ? ; Ok (Self :: new (conn)) } } impl < T > RpcServiceClient < T > where T : tonic :: client :: GrpcService < tonic :: body :: BoxBody > , T :: ResponseBody : Body + Send + 'static , T :: Error : Into < StdError > , < T :: ResponseBody as Body > :: Error : Into < StdError > + Send , { pub fn new (inner : T) -> Self { let inner = tonic :: client :: Grpc :: new (inner) ; Self { inner } } pub fn with_interceptor < F > (inner : T , interceptor : F) -> RpcServiceClient < InterceptedService < T , F >> where F : tonic :: service :: Interceptor , T : tonic :: codegen :: Service < http :: Request < tonic :: body :: BoxBody > , Response = http :: Response << T as tonic :: client :: GrpcService < tonic :: body :: BoxBody >> :: ResponseBody > > , < T as tonic :: codegen :: Service < http :: Request < tonic :: body :: BoxBody >> > :: Error : Into < StdError > + Send + Sync , { RpcServiceClient :: new (InterceptedService :: new (inner , interceptor)) } # [doc = r" Compress requests with `gzip`."] # [doc = r""] # [doc = r" This requires the server to support it otherwise it might respond with an"] # [doc = r" error."] pub fn send_gzip (mut self) -> Self { self . inner = self . inner . send_gzip () ; self } # [doc = r" Enable decompressing responses with `gzip`."] pub fn accept_gzip (mut self) -> Self { self . inner = self . inner . accept_gzip () ; self } pub async fn send_message (& mut self , request : impl tonic :: IntoRequest < super :: RpcMessage > ,) -> Result < tonic :: Response < super :: RpcResponse > , tonic :: Status > { self . inner . ready () . await . map_err (| e | { tonic :: Status :: new (tonic :: Code :: Unknown , format ! ("Service was not ready: {}" , e . into ())) }) ? ; let codec = tonic :: codec :: ProstCodec :: default () ; let path = http :: uri :: PathAndQuery :: from_static ("/services.RPCService/SendMessage") ; self . inner . unary (request . into_request () , path , codec) . await } } }# [doc = r" Generated server implementations."] # [allow (clippy :: unit_arg)] pub mod rpc_service_server { # ! [allow (unused_variables , dead_code , missing_docs , clippy :: let_unit_value ,)] use tonic :: codegen :: * ; # [doc = "Generated trait containing gRPC methods that should be implemented for use with RpcServiceServer."] # [async_trait] pub trait RpcService : Send + Sync + 'static { async fn send_message (& self , request : tonic :: Request < super :: RpcMessage >) -> Result < tonic :: Response < super :: RpcResponse > , tonic :: Status > ; } # [derive (Debug)] pub struct RpcServiceServer < T : RpcService > { inner : _Inner < T > , accept_compression_encodings : () , send_compression_encodings : () , } struct _Inner < T > (Arc < T >) ; impl < T : RpcService > RpcServiceServer < T > { pub fn new (inner : T) -> Self { let inner = Arc :: new (inner) ; let inner = _Inner (inner) ; Self { inner , accept_compression_encodings : Default :: default () , send_compression_encodings : Default :: default () , } } pub fn with_interceptor < F > (inner : T , interceptor : F) -> InterceptedService < Self , F > where F : tonic :: service :: Interceptor , { InterceptedService :: new (Self :: new (inner) , interceptor) } } impl < T , B > tonic :: codegen :: Service < http :: Request < B >> for RpcServiceServer < T > where T : RpcService , B : Body + Send + 'static , B :: Error : Into < StdError > + Send + 'static , { type Response = http :: Response < tonic :: body :: BoxBody > ; type Error = Never ; type Future = BoxFuture < Self :: Response , Self :: Error > ; fn poll_ready (& mut self , _cx : & mut Context < '_ >) -> Poll < Result < () , Self :: Error >> { Poll :: Ready (Ok (())) } fn call (& mut self , req : http :: Request < B >) -> Self :: Future { let inner = self . inner . clone () ; match req . uri () . path () { "/services.RPCService/SendMessage" => { # [allow (non_camel_case_types)] struct SendMessageSvc < T : RpcService > (pub Arc < T >) ; impl < T : RpcService > tonic :: server :: UnaryService < super :: RpcMessage > for SendMessageSvc < T > { type Response = super :: RpcResponse ; type Future = BoxFuture < tonic :: Response < Self :: Response > , tonic :: Status > ; fn call (& mut self , request : tonic :: Request < super :: RpcMessage >) -> Self :: Future { let inner = self . 0 . clone () ; let fut = async move { (* inner) . send_message (request) . await } ; Box :: pin (fut) } } let accept_compression_encodings = self . accept_compression_encodings ; let send_compression_encodings = self . send_compression_encodings ; let inner = self . inner . clone () ; let fut = async move { let inner = inner . 0 ; let method = SendMessageSvc (inner) ; let codec = tonic :: codec :: ProstCodec :: default () ; let mut grpc = tonic :: server :: Grpc :: new (codec) . apply_compression_config (accept_compression_encodings , send_compression_encodings) ; let res = grpc . unary (method , req) . await ; Ok (res) } ; Box :: pin (fut) } _ => Box :: pin (async move { Ok (http :: Response :: builder () . status (200) . header ("grpc-status" , "12") . header ("content-type" , "application/grpc") . body (empty_body ()) . unwrap ()) }) , } } } impl < T : RpcService > Clone for RpcServiceServer < T > { fn clone (& self) -> Self { let inner = self . inner . clone () ; Self { inner , accept_compression_encodings : self . accept_compression_encodings , send_compression_encodings : self . send_compression_encodings , } } } impl < T : RpcService > Clone for _Inner < T > { fn clone (& self) -> Self { Self (self . 0 . clone ()) } } impl < T : std :: fmt :: Debug > std :: fmt :: Debug for _Inner < T > { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { write ! (f , "{:?}" , self . 0) } } impl < T : RpcService > tonic :: transport :: NamedService for RpcServiceServer < T > { const NAME : & 'static str = "services.RPCService" ; } } \ No newline at end of file diff --git a/apps/src/lib/proto/generated/types.rs b/apps/src/lib/proto/generated/types.rs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/src/lib/wallet/defaults.rs b/apps/src/lib/wallet/defaults.rs index f417c95219..ff80ce2887 100644 --- a/apps/src/lib/wallet/defaults.rs +++ b/apps/src/lib/wallet/defaults.rs @@ -16,27 +16,19 @@ mod dev { use namada::types::address::{ apfel, btc, dot, eth, kartoffel, nam, schnitzel, Address, }; - use namada::types::key::dkg_session_keys::DkgKeypair; use namada::types::key::*; use namada_sdk::wallet::alias::Alias; use namada_sdk::wallet::pre_genesis::ValidatorWallet; /// Get protocol, eth_bridge, and dkg keys from the validator pre-genesis /// wallet - pub fn validator_keys() -> (common::SecretKey, common::SecretKey, DkgKeypair) - { + pub fn validator_keys() -> (common::SecretKey, common::SecretKey) { let protocol_key = get_validator_pre_genesis_wallet() .store .validator_keys .protocol_keypair; let eth_bridge_key = get_validator_pre_genesis_wallet().eth_hot_key; - let dkg_key = get_validator_pre_genesis_wallet() - .store - .validator_keys - .dkg_keypair - .unwrap(); - - (protocol_key, eth_bridge_key, dkg_key) + (protocol_key, eth_bridge_key) } /// The default keys with their aliases. diff --git a/apps/src/lib/wallet/pre_genesis.rs b/apps/src/lib/wallet/pre_genesis.rs index 6144c857af..9b4f5510c6 100644 --- a/apps/src/lib/wallet/pre_genesis.rs +++ b/apps/src/lib/wallet/pre_genesis.rs @@ -1,7 +1,7 @@ use std::fs; +use std::io::{Read, Write}; use std::path::{Path, PathBuf}; -use ark_serialize::{Read, Write}; use fd_lock::RwLock; use namada::types::key::SchemeType; use namada_sdk::wallet::pre_genesis::{ diff --git a/apps/src/lib/wallet/store.rs b/apps/src/lib/wallet/store.rs index da14746049..18fc721d63 100644 --- a/apps/src/lib/wallet/store.rs +++ b/apps/src/lib/wallet/store.rs @@ -1,9 +1,6 @@ use std::path::{Path, PathBuf}; -use ark_std::rand::prelude::*; -use ark_std::rand::SeedableRng; use namada::types::key::*; -use namada::types::transaction::EllipticCurve; use namada_sdk::wallet::{gen_sk_rng, LoadStoreError, Store, ValidatorKeys}; use crate::wallet::CliWalletUtils; @@ -51,13 +48,9 @@ pub fn gen_validator_keys( .unwrap_or_else(|| gen_sk_rng(SchemeType::Secp256k1)); let protocol_keypair = protocol_keypair.unwrap_or_else(|| gen_sk_rng(protocol_keypair_scheme)); - let dkg_keypair = ferveo_common::Keypair::::new( - &mut StdRng::from_entropy(), - ); ValidatorKeys { protocol_keypair, eth_bridge_keypair, - dkg_keypair: Some(dkg_keypair.into()), } } diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 1816da11da..57de47dba4 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -45,7 +45,6 @@ namada_apps = { path = "../apps", features = ["benches"] } borsh.workspace = true borsh-ext.workspace = true criterion = { version = "0.5", features = ["html_reports"] } -ferveo-common.workspace = true rand_core.workspace = true rand.workspace = true tempfile.workspace = true diff --git a/benches/txs.rs b/benches/txs.rs index 85c8df1cdb..4c48d4343d 100644 --- a/benches/txs.rs +++ b/benches/txs.rs @@ -41,7 +41,6 @@ use namada::types::transaction::governance::{ use namada::types::transaction::pos::{ Bond, CommissionChange, Redelegation, Withdraw, }; -use namada::types::transaction::EllipticCurve; use namada_apps::bench_utils::{ BenchShell, BenchShieldedCtx, ALBERT_PAYMENT_ADDRESS, ALBERT_SPENDING_KEY, BERTHA_PAYMENT_ADDRESS, TX_BOND_WASM, TX_BRIDGE_POOL_WASM, @@ -54,8 +53,6 @@ use namada_apps::bench_utils::{ VP_VALIDATOR_WASM, }; use namada_apps::wallet::defaults; -use rand::rngs::StdRng; -use rand::SeedableRng; use sha2::Digest; const TX_INIT_VALIDATOR_WASM: &str = "tx_init_validator.wasm"; @@ -612,12 +609,6 @@ fn init_validator(c: &mut Criterion) { .unwrap() .to_public(); - let dkg_key = ferveo_common::Keypair::::new( - &mut StdRng::from_entropy(), - ) - .public() - .into(); - let shell = BenchShell::default(); let validator_vp_code_hash: Hash = shell .read_storage_key(&Key::wasm_hash(VP_VALIDATOR_WASM)) @@ -637,7 +628,6 @@ fn init_validator(c: &mut Criterion) { eth_cold_key, eth_hot_key, protocol_key, - dkg_key, commission_rate: namada::types::dec::Dec::default(), max_commission_rate_change: namada::types::dec::Dec::default(), email: "null@null.net".to_string(), diff --git a/core/Cargo.toml b/core/Cargo.toml index 7b4497e920..53ee824077 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -13,38 +13,23 @@ repository.workspace = true version.workspace = true [features] -default = ["ferveo-tpke"] +default = ["rand"] mainnet = [] -ferveo-tpke = [ - "ferveo", - "tpke", - "ark-ec", - "rand_core", - "rand", -] -wasm-runtime = [ - "rayon", -] - -ibc-mocks = [ - "ibc/mocks", -] - +wasm-runtime = ["rayon"] +rand = ["dep:rand", "rand_core"] +ibc-mocks = ["ibc/mocks" ] ethers-derive = [ "ethbridge-structs/ethers-derive" ] - # for integration tests and test utilies testing = [ "rand", - "rand_core", "proptest", ] [dependencies] namada_macros = {path = "../macros"} ark-bls12-381.workspace = true -ark-ec = {version = "0.3", optional = true} ark-serialize.workspace = true arse-merkle-tree.workspace = true bech32.workspace = true @@ -57,9 +42,6 @@ ed25519-consensus.workspace = true ethabi.workspace = true ethbridge-structs.workspace = true eyre.workspace = true -ferveo = {optional = true, git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"} -ferveo-common = {git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"} -tpke = {package = "group-threshold-cryptography", optional = true, git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"} ibc = { version = "0.47.0", default-features = false, features = ["serde"]} ibc-derive = { version = "0.3.0"} ibc-proto = {version = "0.37.1", default-features = false} diff --git a/core/src/ledger/storage/mockdb.rs b/core/src/ledger/storage/mockdb.rs index d9f292d4ef..7c5667da68 100644 --- a/core/src/ledger/storage/mockdb.rs +++ b/core/src/ledger/storage/mockdb.rs @@ -19,7 +19,6 @@ use super::{ use crate::ledger::storage::types::{self, KVBytes, PrefixIterator}; use crate::types::ethereum_structs; use crate::types::hash::Hash; -#[cfg(feature = "ferveo-tpke")] use crate::types::internal::TxQueue; use crate::types::storage::{ BlockHeight, BlockResults, Epoch, EthEventsQueue, Header, Key, KeySeg, @@ -96,7 +95,6 @@ impl DB for MockDB { } None => return Ok(None), }; - #[cfg(feature = "ferveo-tpke")] let tx_queue: TxQueue = match self.0.borrow().get("tx_queue") { Some(bytes) => types::decode(bytes).map_err(Error::CodingError)?, None => return Ok(None), @@ -224,7 +222,6 @@ impl DB for MockDB { update_epoch_blocks_delay, address_gen, results, - #[cfg(feature = "ferveo-tpke")] tx_queue, ethereum_height, eth_events_queue, @@ -257,7 +254,6 @@ impl DB for MockDB { results, ethereum_height, eth_events_queue, - #[cfg(feature = "ferveo-tpke")] tx_queue, }: BlockStateWrite = state; @@ -281,12 +277,9 @@ impl DB for MockDB { "eth_events_queue".into(), types::encode(ð_events_queue), ); - #[cfg(feature = "ferveo-tpke")] - { - self.0 - .borrow_mut() - .insert("tx_queue".into(), types::encode(&tx_queue)); - } + self.0 + .borrow_mut() + .insert("tx_queue".into(), types::encode(&tx_queue)); let prefix_key = Key::from(height.to_db_key()); // Merkle tree diff --git a/core/src/ledger/storage/mod.rs b/core/src/ledger/storage/mod.rs index 5740a6e303..99a1e40d5e 100644 --- a/core/src/ledger/storage/mod.rs +++ b/core/src/ledger/storage/mod.rs @@ -45,10 +45,7 @@ use crate::types::address::{ }; use crate::types::chain::{ChainId, CHAIN_ID_LENGTH}; use crate::types::hash::{Error as HashError, Hash}; -use crate::types::internal::ExpiredTxsQueue; -// TODO -#[cfg(feature = "ferveo-tpke")] -use crate::types::internal::TxQueue; +use crate::types::internal::{ExpiredTxsQueue, TxQueue}; use crate::types::storage::{ BlockHash, BlockHeight, BlockResults, Epoch, Epochs, EthEventsQueue, Header, Key, KeySeg, MembershipProof, TxIndex, BLOCK_HASH_LENGTH, @@ -106,7 +103,6 @@ where /// The currently saved conversion state pub conversion_state: ConversionState, /// Wrapper txs to be decrypted in the next block proposal - #[cfg(feature = "ferveo-tpke")] pub tx_queue: TxQueue, /// Queue of expired transactions that need to be retransmitted. /// @@ -207,7 +203,6 @@ pub struct BlockStateRead { /// Results of applying transactions pub results: BlockResults, /// Wrapper txs to be decrypted in the next block proposal - #[cfg(feature = "ferveo-tpke")] pub tx_queue: TxQueue, /// The latest block height on Ethereum processed, if /// the bridge is enabled. @@ -243,7 +238,6 @@ pub struct BlockStateWrite<'a> { /// Results of applying transactions pub results: &'a BlockResults, /// Wrapper txs to be decrypted in the next block proposal - #[cfg(feature = "ferveo-tpke")] pub tx_queue: &'a TxQueue, /// The latest block height on Ethereum processed, if /// the bridge is enabled. @@ -452,7 +446,6 @@ where update_epoch_blocks_delay: None, tx_index: TxIndex::default(), conversion_state: ConversionState::default(), - #[cfg(feature = "ferveo-tpke")] tx_queue: TxQueue::default(), expired_txs_queue: ExpiredTxsQueue::default(), native_token, @@ -477,7 +470,6 @@ where update_epoch_blocks_delay, results, address_gen, - #[cfg(feature = "ferveo-tpke")] tx_queue, ethereum_height, eth_events_queue, @@ -525,10 +517,7 @@ where self.conversion_state.assets = assets; } } - #[cfg(feature = "ferveo-tpke")] - { - self.tx_queue = tx_queue; - } + self.tx_queue = tx_queue; self.ethereum_height = ethereum_height; self.eth_events_queue = eth_events_queue; tracing::debug!("Loaded storage from DB"); @@ -584,7 +573,6 @@ where next_epoch_min_start_time: self.next_epoch_min_start_time, update_epoch_blocks_delay: self.update_epoch_blocks_delay, address_gen: &self.address_gen, - #[cfg(feature = "ferveo-tpke")] tx_queue: &self.tx_queue, ethereum_height: self.ethereum_height.as_ref(), eth_events_queue: &self.eth_events_queue, @@ -1286,7 +1274,6 @@ pub mod testing { update_epoch_blocks_delay: None, tx_index: TxIndex::default(), conversion_state: ConversionState::default(), - #[cfg(feature = "ferveo-tpke")] tx_queue: TxQueue::default(), expired_txs_queue: ExpiredTxsQueue::default(), native_token: address::nam(), diff --git a/core/src/lib.rs b/core/src/lib.rs index 39afd22aaf..a4db54712b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -12,7 +12,7 @@ pub mod ledger; pub mod proto; pub mod types; -pub use {ferveo_common, ibc, ibc_proto, tendermint, tendermint_proto}; +pub use {ibc, ibc_proto, tendermint, tendermint_proto}; // A handy macro for tests #[cfg(test)] diff --git a/core/src/proto/mod.rs b/core/src/proto/mod.rs index ecf8606008..356b797709 100644 --- a/core/src/proto/mod.rs +++ b/core/src/proto/mod.rs @@ -5,7 +5,7 @@ mod types; pub use types::{ standalone_signature, verify_standalone_sig, Code, Commitment, - CompressedSignature, Data, Dkg, Error, Header, MaspBuilder, Section, + CompressedSignature, Data, Error, Header, MaspBuilder, Section, SerializeWithBorsh, Signable, SignableEthMessage, Signature, SignatureIndex, Signed, Signer, Tx, TxError, }; diff --git a/core/src/proto/types.rs b/core/src/proto/types.rs index 45efed6b27..a317e93cdc 100644 --- a/core/src/proto/types.rs +++ b/core/src/proto/types.rs @@ -3,14 +3,8 @@ use std::cmp::Ordering; use std::collections::{BTreeMap, HashMap, HashSet}; use std::convert::TryFrom; use std::hash::{Hash, Hasher}; -#[cfg(feature = "ferveo-tpke")] -use std::io::Read; use std::marker::PhantomData; -#[cfg(feature = "ferveo-tpke")] -use ark_ec::AffineCurve; -#[cfg(feature = "ferveo-tpke")] -use ark_ec::PairingEngine; use borsh::schema::{add_definition, Declaration, Definition}; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; use borsh_ext::BorshSerializeExt; @@ -37,16 +31,7 @@ use crate::types::key::{self, *}; use crate::types::storage::Epoch; use crate::types::time::DateTimeUtc; use crate::types::token::MaspDenom; -#[cfg(feature = "ferveo-tpke")] -use crate::types::token::Transfer; -#[cfg(feature = "ferveo-tpke")] use crate::types::transaction::protocol::ProtocolTx; -#[cfg(feature = "ferveo-tpke")] -use crate::types::transaction::EllipticCurve; -#[cfg(feature = "ferveo-tpke")] -use crate::types::transaction::EncryptionKey; -#[cfg(feature = "ferveo-tpke")] -use crate::types::transaction::WrapperTxErr; use crate::types::transaction::{ hash_tx, DecryptedTx, Fee, GasLimit, TxType, WrapperTx, }; @@ -59,10 +44,6 @@ pub enum Error { TxDeserializingError(std::io::Error), #[error("Error deserializing transaction")] OfflineTxDeserializationError, - #[error("Error decoding an DkgGossipMessage from bytes: {0}")] - DkgDecodingError(prost::DecodeError), - #[error("Dkg is empty")] - NoDkgError, #[error("Timestamp is empty")] NoTimestampError, #[error("Timestamp is invalid: {0}")] @@ -679,44 +660,21 @@ impl CompressedSignature { } /// Represents a section obtained by encrypting another section -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "ferveo-tpke", serde(from = "SerializedCiphertext"))] -#[cfg_attr(feature = "ferveo-tpke", serde(into = "SerializedCiphertext"))] -#[cfg_attr( - not(feature = "ferveo-tpke"), - derive(BorshSerialize, BorshDeserialize, BorshSchema) +#[derive( + Clone, + Debug, + Serialize, + Deserialize, + BorshSerialize, + BorshDeserialize, + BorshSchema, )] pub struct Ciphertext { - /// The ciphertext corresponding to the original section serialization - #[cfg(feature = "ferveo-tpke")] - pub ciphertext: tpke::Ciphertext, /// Ciphertext representation when ferveo not available - #[cfg(not(feature = "ferveo-tpke"))] pub opaque: Vec, } impl Ciphertext { - /// Make a ciphertext section based on the given sections. Note that this - /// encryption is not idempotent - #[cfg(feature = "ferveo-tpke")] - pub fn new(sections: Vec
, pubkey: &EncryptionKey) -> Self { - let mut rng = rand::thread_rng(); - let bytes = sections.serialize_to_vec(); - Self { - ciphertext: tpke::encrypt(&bytes, pubkey.0, &mut rng), - } - } - - /// Decrypt this ciphertext back to the original plaintext sections. - #[cfg(feature = "ferveo-tpke")] - pub fn decrypt( - &self, - privkey: ::G2Affine, - ) -> std::io::Result> { - let bytes = tpke::decrypt(&self.ciphertext, privkey); - Vec::
::try_from_slice(&bytes) - } - /// Get the hash of this ciphertext section. This operation is done in such /// a way it matches the hash of the type pun pub fn hash<'a>(&self, hasher: &'a mut Sha256) -> &'a mut Sha256 { @@ -725,122 +683,6 @@ impl Ciphertext { } } -#[cfg(feature = "ferveo-tpke")] -impl borsh::ser::BorshSerialize for Ciphertext { - fn serialize( - &self, - writer: &mut W, - ) -> std::io::Result<()> { - use ark_serialize::CanonicalSerialize; - let tpke::Ciphertext { - nonce, - ciphertext, - auth_tag, - } = &self.ciphertext; - // Serialize the nonce into bytes - let mut nonce_buffer = Vec::::new(); - nonce.serialize(&mut nonce_buffer).map_err(|err| { - std::io::Error::new(std::io::ErrorKind::InvalidData, err) - })?; - // serialize the auth_tag to bytes - let mut tag_buffer = Vec::::new(); - auth_tag.serialize(&mut tag_buffer).map_err(|err| { - std::io::Error::new(std::io::ErrorKind::InvalidData, err) - })?; - let mut payload = Vec::new(); - // serialize the three byte arrays - BorshSerialize::serialize( - &(nonce_buffer, ciphertext, tag_buffer), - &mut payload, - )?; - // now serialize the ciphertext payload with length - BorshSerialize::serialize(&payload, writer) - } -} - -#[cfg(feature = "ferveo-tpke")] -impl borsh::BorshDeserialize for Ciphertext { - fn deserialize_reader(reader: &mut R) -> std::io::Result { - { - type VecTuple = (u32, Vec, Vec, Vec); - let (_length, nonce, ciphertext, auth_tag): VecTuple = - BorshDeserialize::deserialize_reader(reader)?; - Ok(Self { - ciphertext: tpke::Ciphertext { - nonce: ark_serialize::CanonicalDeserialize::deserialize( - &*nonce, - ) - .map_err(|err| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - err, - ) - })?, - ciphertext, - auth_tag: ark_serialize::CanonicalDeserialize::deserialize( - &*auth_tag, - ) - .map_err(|err| { - std::io::Error::new( - std::io::ErrorKind::InvalidData, - err, - ) - })?, - }, - }) - } - } -} - -#[cfg(feature = "ferveo-tpke")] -impl borsh::BorshSchema for Ciphertext { - fn add_definitions_recursively( - definitions: &mut BTreeMap< - borsh::schema::Declaration, - borsh::schema::Definition, - >, - ) { - // Encoded as `(Vec, Vec, Vec)` - let elements = "u8".into(); - let definition = borsh::schema::Definition::Sequence { elements }; - definitions.insert("Vec".into(), definition); - let elements = - vec!["Vec".into(), "Vec".into(), "Vec".into()]; - let definition = borsh::schema::Definition::Tuple { elements }; - definitions.insert(Self::declaration(), definition); - } - - fn declaration() -> borsh::schema::Declaration { - "Ciphertext".into() - } -} - -/// A helper struct for serializing EncryptedTx structs -/// as an opaque blob -#[cfg(feature = "ferveo-tpke")] -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(transparent)] -struct SerializedCiphertext { - payload: Vec, -} - -#[cfg(feature = "ferveo-tpke")] -impl From for SerializedCiphertext { - fn from(tx: Ciphertext) -> Self { - SerializedCiphertext { - payload: tx.serialize_to_vec(), - } - } -} - -#[cfg(feature = "ferveo-tpke")] -impl From for Ciphertext { - fn from(ser: SerializedCiphertext) -> Self { - BorshDeserialize::deserialize(&mut ser.payload.as_ref()) - .expect("Unable to deserialize encrypted transactions") - } -} - #[derive(serde::Serialize, serde::Deserialize)] struct TransactionSerde(Vec); @@ -1171,7 +1013,6 @@ impl Header { } } - #[cfg(feature = "ferveo-tpke")] /// Get the protocol header if it is present pub fn protocol(&self) -> Option { if let TxType::Protocol(protocol) = &self.tx_type { @@ -1491,22 +1332,6 @@ impl Tx { .map_err(|_| Error::InvalidWrapperSignature) } - /// Validate any and all ciphertexts stored in this transaction - #[cfg(feature = "ferveo-tpke")] - pub fn validate_ciphertext(&self) -> bool { - let mut valid = true; - for section in &self.sections { - if let Section::Ciphertext(ct) = section { - valid = valid && ct.ciphertext.check( - &::G1Prepared::from( - -::G1Affine::prime_subgroup_generator(), - ) - ); - } - } - valid - } - pub fn compute_section_signature( &self, secret_keys: &[common::SecretKey], @@ -1545,66 +1370,6 @@ impl Tx { signatures } - /// Decrypt any and all ciphertexts stored in this transaction use the - /// given decryption key - #[cfg(feature = "ferveo-tpke")] - pub fn decrypt( - &mut self, - privkey: ::G2Affine, - ) -> std::result::Result<(), WrapperTxErr> { - // Iterate backwrds to sidestep the effects of deletion on indexing - for i in (0..self.sections.len()).rev() { - if let Section::Ciphertext(ct) = &self.sections[i] { - // Add all the deecrypted sections - self.sections.extend( - ct.decrypt(privkey).map_err(|_| WrapperTxErr::InvalidTx)?, - ); - // Remove the original ciphertext - self.sections.remove(i); - } - } - self.data().ok_or(WrapperTxErr::DecryptedHash)?; - self.get_section(self.code_sechash()) - .ok_or(WrapperTxErr::DecryptedHash)?; - Ok(()) - } - - /// Encrypt all sections in this transaction other than the header and - /// signatures over it - #[cfg(feature = "ferveo-tpke")] - pub fn encrypt(&mut self, pubkey: &EncryptionKey) -> &mut Self { - let header_hash = self.header_hash(); - let mut plaintexts = vec![]; - // Iterate backwrds to sidestep the effects of deletion on indexing - for i in (0..self.sections.len()).rev() { - match &self.sections[i] { - Section::Signature(sig) - if sig.targets.contains(&header_hash) => {} - masp_section @ Section::MaspTx(_) => { - // Do NOT encrypt the fee unshielding transaction - if let Some(unshield_section_hash) = self - .header() - .wrapper() - .expect("Tried to encrypt a non-wrapper tx") - .unshield_section_hash - { - if unshield_section_hash == masp_section.get_hash() { - continue; - } - } - - plaintexts.push(self.sections.remove(i)) - } - // Add eligible section to the list of sections to encrypt - _ => plaintexts.push(self.sections.remove(i)), - } - } - // Encrypt all eligible sections in one go - self.sections - .push(Section::Ciphertext(Ciphertext::new(plaintexts, pubkey))); - self - } - /// Determines the type of the input Tx /// /// If it is a raw Tx, signed or not, the Tx is @@ -1634,7 +1399,6 @@ impl Tx { )) }), // verify signature and extract signed data - #[cfg(feature = "ferveo-tpke")] TxType::Protocol(protocol) => self .verify_signature(&protocol.pk, &self.sechashes()) .map(Option::Some) @@ -1843,238 +1607,7 @@ impl Tx { } impl From for ResponseDeliverTx { - #[cfg(not(feature = "ferveo-tpke"))] fn from(_tx: Tx) -> ResponseDeliverTx { Default::default() } - - /// Annotate the Tx with meta-data based on its contents - #[cfg(feature = "ferveo-tpke")] - fn from(tx: Tx) -> ResponseDeliverTx { - use crate::tendermint_proto::v0_37::abci::{Event, EventAttribute}; - - // If data cannot be extracteed, then attach no events - let tx_data = if let Some(data) = tx.data() { - data - } else { - return Default::default(); - }; - // If the data is not a Transfer, then attach no events - let transfer = if let Ok(transfer) = Transfer::try_from_slice(&tx_data) - { - transfer - } else { - return Default::default(); - }; - // Otherwise attach all Transfer events - let events = vec![Event { - r#type: "transfer".to_string(), - attributes: vec![ - EventAttribute { - key: "source".to_string(), - value: transfer.source.encode(), - index: true, - }, - EventAttribute { - key: "target".to_string(), - value: transfer.target.encode(), - index: true, - }, - EventAttribute { - key: "token".to_string(), - value: transfer.token.encode(), - index: true, - }, - EventAttribute { - key: "amount".to_string(), - value: transfer.amount.to_string(), - index: true, - }, - ], - }]; - ResponseDeliverTx { - events, - info: "Transfer tx".to_string(), - ..Default::default() - } - } -} - -#[allow(dead_code)] -#[derive(Clone, Debug, PartialEq)] -pub struct DkgGossipMessage { - pub dkg: Dkg, -} - -impl TryFrom<&[u8]> for DkgGossipMessage { - type Error = Error; - - fn try_from(dkg_bytes: &[u8]) -> Result { - let message = types::DkgGossipMessage::decode(dkg_bytes) - .map_err(Error::DkgDecodingError)?; - match &message.dkg_message { - Some(types::dkg_gossip_message::DkgMessage::Dkg(dkg)) => { - Ok(DkgGossipMessage { - dkg: dkg.clone().into(), - }) - } - None => Err(Error::NoDkgError), - } - } -} - -impl From for types::DkgGossipMessage { - fn from(message: DkgGossipMessage) -> Self { - types::DkgGossipMessage { - dkg_message: Some(types::dkg_gossip_message::DkgMessage::Dkg( - message.dkg.into(), - )), - } - } -} - -#[allow(dead_code)] -impl DkgGossipMessage { - pub fn new(dkg: Dkg) -> Self { - DkgGossipMessage { dkg } - } - - pub fn to_bytes(&self) -> Vec { - let mut bytes = vec![]; - let message: types::DkgGossipMessage = self.clone().into(); - message - .encode(&mut bytes) - .expect("encoding a DKG gossip message failed"); - bytes - } -} - -#[allow(dead_code)] -#[derive(Clone, Debug, PartialEq)] -pub struct Dkg { - pub data: String, -} - -impl From for Dkg { - fn from(dkg: types::Dkg) -> Self { - Dkg { data: dkg.data } - } -} - -impl From for types::Dkg { - fn from(dkg: Dkg) -> Self { - types::Dkg { data: dkg.data } - } -} - -#[allow(dead_code)] -impl Dkg { - pub fn new(data: String) -> Self { - Dkg { data } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_dkg_gossip_message() { - let data = "arbitrary string".to_owned(); - let dkg = Dkg::new(data); - let message = DkgGossipMessage::new(dkg); - - let bytes = message.to_bytes(); - let message_from_bytes = DkgGossipMessage::try_from(bytes.as_ref()) - .expect("decoding failed"); - assert_eq!(message_from_bytes, message); - } - - #[test] - fn test_dkg() { - let data = "arbitrary string".to_owned(); - let dkg = Dkg::new(data); - - let types_dkg: types::Dkg = dkg.clone().into(); - let dkg_from_types = Dkg::from(types_dkg); - assert_eq!(dkg_from_types, dkg); - } - - /// Test that encryption and decryption are inverses. - #[cfg(feature = "ferveo-tpke")] - #[test] - fn test_encrypt_decrypt() { - // The trivial public - private keypair - let pubkey = EncryptionKey(::G1Affine::prime_subgroup_generator()); - let privkey = ::G2Affine::prime_subgroup_generator(); - // generate encrypted payload - let plaintext = vec![Section::Data(Data::new( - "Super secret stuff".as_bytes().to_vec(), - ))]; - let encrypted = Ciphertext::new(plaintext.clone(), &pubkey); - // check that encryption doesn't do trivial things - assert_ne!( - encrypted.ciphertext.ciphertext, - plaintext.serialize_to_vec() - ); - // decrypt the payload and check we got original data back - let decrypted = encrypted.decrypt(privkey); - assert_eq!( - decrypted.expect("Test failed").serialize_to_vec(), - plaintext.serialize_to_vec(), - ); - } - - /// Test that serializing and deserializing again via Borsh produces - /// original payload - #[cfg(feature = "ferveo-tpke")] - #[test] - fn test_encrypted_tx_round_trip_borsh() { - // The trivial public - private keypair - let pubkey = EncryptionKey(::G1Affine::prime_subgroup_generator()); - let privkey = ::G2Affine::prime_subgroup_generator(); - // generate encrypted payload - let plaintext = vec![Section::Data(Data::new( - "Super secret stuff".as_bytes().to_vec(), - ))]; - let encrypted = Ciphertext::new(plaintext.clone(), &pubkey); - // serialize via Borsh - let borsh = encrypted.serialize_to_vec(); - // deserialize again - let new_encrypted: Ciphertext = - BorshDeserialize::deserialize(&mut borsh.as_ref()) - .expect("Test failed"); - // check that decryption works as expected - let decrypted = new_encrypted.decrypt(privkey); - assert_eq!( - decrypted.expect("Test failed").serialize_to_vec(), - plaintext.serialize_to_vec(), - ); - } - - /// Test that serializing and deserializing again via Serde produces - /// original payload - #[cfg(feature = "ferveo-tpke")] - #[test] - fn test_encrypted_tx_round_trip_serde() { - // The trivial public - private keypair - let pubkey = EncryptionKey(::G1Affine::prime_subgroup_generator()); - let privkey = ::G2Affine::prime_subgroup_generator(); - // generate encrypted payload - let plaintext = vec![Section::Data(Data::new( - "Super secret stuff".as_bytes().to_vec(), - ))]; - let encrypted = Ciphertext::new(plaintext.clone(), &pubkey); - // serialize via Serde - let js = serde_json::to_string(&encrypted).expect("Test failed"); - // deserialize it again - let new_encrypted: Ciphertext = - serde_json::from_str(&js).expect("Test failed"); - let decrypted = new_encrypted.decrypt(privkey); - // check that decryption works as expected - assert_eq!( - decrypted.expect("Test failed").serialize_to_vec(), - plaintext.serialize_to_vec(), - ); - } } diff --git a/core/src/types/internal.rs b/core/src/types/internal.rs index bcb4c20817..f2f69c1482 100644 --- a/core/src/types/internal.rs +++ b/core/src/types/internal.rs @@ -46,7 +46,6 @@ impl From for HostEnvResult { } } -#[cfg(feature = "ferveo-tpke")] mod tx_queue { use borsh::{BorshDeserialize, BorshSerialize}; @@ -99,7 +98,6 @@ mod tx_queue { } } -#[cfg(feature = "ferveo-tpke")] pub use tx_queue::{TxInQueue, TxQueue}; /// Expired transaction kinds. diff --git a/core/src/types/key/dkg_session_keys.rs b/core/src/types/key/dkg_session_keys.rs deleted file mode 100644 index 936e760d47..0000000000 --- a/core/src/types/key/dkg_session_keys.rs +++ /dev/null @@ -1,180 +0,0 @@ -//! Utilities around the DKG session keys - -use std::cmp::Ordering; -use std::collections::BTreeMap; -use std::io::{Error, ErrorKind, Read}; - -use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; -use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; -use borsh_ext::BorshSerializeExt; -use serde::{Deserialize, Serialize}; - -use crate::impl_display_and_from_str_via_format; -use crate::types::address::Address; -use crate::types::storage::{DbKeySeg, Key, KeySeg}; -use crate::types::string_encoding; -use crate::types::transaction::EllipticCurve; - -/// A keypair used in the DKG protocol -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -pub struct DkgKeypair(ferveo_common::Keypair); - -impl DkgKeypair { - /// Get the public key of the keypair - pub fn public(&self) -> DkgPublicKey { - self.0.public().into() - } -} - -impl From> for DkgKeypair { - fn from(kp: ferveo_common::Keypair) -> Self { - Self(kp) - } -} - -impl From<&DkgKeypair> for ferveo_common::Keypair { - fn from(kp: &DkgKeypair) -> Self { - kp.0 - } -} - -impl BorshSerialize for DkgKeypair { - fn serialize( - &self, - writer: &mut W, - ) -> std::io::Result<()> { - let mut kp_buf = Vec::::new(); - CanonicalSerialize::serialize(&self.0, &mut kp_buf) - .map_err(|err| Error::new(ErrorKind::InvalidData, err))?; - BorshSerialize::serialize(&kp_buf, writer) - } -} - -impl BorshDeserialize for DkgKeypair { - fn deserialize_reader(reader: &mut R) -> std::io::Result { - let kp_bytes: Vec = BorshDeserialize::deserialize_reader(reader)?; - let kp: ferveo_common::Keypair = - CanonicalDeserialize::deserialize(kp_bytes.as_slice()) - .map_err(|err| Error::new(ErrorKind::InvalidInput, err))?; - Ok(kp.into()) - } -} - -/// A public keypair used in the DKG protocol -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -pub struct DkgPublicKey(ferveo_common::PublicKey); - -impl From> for DkgPublicKey { - fn from(pk: ferveo_common::PublicKey) -> Self { - Self(pk) - } -} - -impl From<&DkgPublicKey> for ferveo_common::PublicKey { - fn from(pk: &DkgPublicKey) -> Self { - pk.0 - } -} - -impl Eq for DkgPublicKey {} - -impl PartialOrd for DkgPublicKey { - fn partial_cmp(&self, other: &Self) -> Option { - Some( - self.0 - .encryption_key - .to_string() - .cmp(&other.0.encryption_key.to_string()), - ) - } -} - -impl Ord for DkgPublicKey { - fn cmp(&self, other: &Self) -> Ordering { - self.0 - .encryption_key - .to_string() - .cmp(&other.0.encryption_key.to_string()) - } -} - -impl BorshSerialize for DkgPublicKey { - fn serialize( - &self, - writer: &mut W, - ) -> std::io::Result<()> { - let mut pk_buf = Vec::::new(); - CanonicalSerialize::serialize(&self.0, &mut pk_buf) - .map_err(|err| Error::new(ErrorKind::InvalidData, err))?; - BorshSerialize::serialize(&pk_buf, writer) - } -} - -impl BorshDeserialize for DkgPublicKey { - fn deserialize_reader(reader: &mut R) -> std::io::Result { - let pk_bytes: Vec = BorshDeserialize::deserialize_reader(reader)?; - let pk: ferveo_common::PublicKey = - CanonicalDeserialize::deserialize(pk_bytes.as_slice()) - .map_err(|err| Error::new(ErrorKind::InvalidInput, err))?; - Ok(pk.into()) - } -} - -impl BorshSchema for DkgPublicKey { - fn add_definitions_recursively( - definitions: &mut BTreeMap< - borsh::schema::Declaration, - borsh::schema::Definition, - >, - ) { - // Encoded as `Vec`; - let elements = "u8".into(); - let definition = borsh::schema::Definition::Sequence { elements }; - definitions.insert(Self::declaration(), definition); - } - - fn declaration() -> borsh::schema::Declaration { - "DkgPublicKey".into() - } -} - -impl string_encoding::Format for DkgPublicKey { - type EncodedBytes<'a> = Vec; - - const HRP: &'static str = string_encoding::DKG_PK_HRP; - - fn to_bytes(&self) -> Vec { - self.serialize_to_vec() - } - - fn decode_bytes( - bytes: &[u8], - ) -> Result { - BorshDeserialize::try_from_slice(bytes) - .map_err(string_encoding::DecodeError::InvalidBytes) - } -} - -impl_display_and_from_str_via_format!(DkgPublicKey); - -/// Obtain a storage key for user's public dkg session key. -pub fn dkg_pk_key(owner: &Address) -> Key { - Key::from(owner.to_db_key()) - .push(&DKG_PK_STORAGE_KEY.to_owned()) - .expect("Cannot obtain a storage key") -} - -/// Check if the given storage key is a public dkg session key. If it is, -/// returns the owner. -pub fn is_dkg_pk_key(key: &Key) -> Option<&Address> { - match &key.segments[..] { - [DbKeySeg::AddressSeg(owner), DbKeySeg::StringSeg(key)] - if key == DKG_PK_STORAGE_KEY => - { - Some(owner) - } - _ => None, - } -} - -const DKG_PK_STORAGE_KEY: &str = "dkg_pk_key"; diff --git a/core/src/types/key/mod.rs b/core/src/types/key/mod.rs index d05030ea5b..6f1a0eca68 100644 --- a/core/src/types/key/mod.rs +++ b/core/src/types/key/mod.rs @@ -1,8 +1,6 @@ //! Cryptographic keys pub mod common; -/// Elliptic curve keys for the DKG -pub mod dkg_session_keys; pub mod ed25519; pub mod secp256k1; diff --git a/core/src/types/string_encoding.rs b/core/src/types/string_encoding.rs index c453483254..47db158d85 100644 --- a/core/src/types/string_encoding.rs +++ b/core/src/types/string_encoding.rs @@ -33,8 +33,6 @@ pub const MASP_PAYMENT_ADDRESS_HRP: &str = "znam"; pub const MASP_EXT_SPENDING_KEY_HRP: &str = "zsknam"; /// `common::PublicKey` human-readable part pub const COMMON_PK_HRP: &str = "tpknam"; -/// `DkgPublicKey` human-readable part -pub const DKG_PK_HRP: &str = "dpknam"; /// `common::Signature` human-readable part pub const COMMON_SIG_HRP: &str = "signam"; diff --git a/core/src/types/transaction/decrypted.rs b/core/src/types/transaction/decrypted.rs index 3a7ba2f335..55bf01d9dc 100644 --- a/core/src/types/transaction/decrypted.rs +++ b/core/src/types/transaction/decrypted.rs @@ -1,11 +1,8 @@ pub use ark_bls12_381::Bls12_381 as EllipticCurve; -/// Integration of Ferveo cryptographic primitives -/// to enable decrypting txs. +/// Integration of Ferveo cryptographic primitives to enable decrypting txs. /// *Not wasm compatible* pub mod decrypted_tx { - #[cfg(feature = "ferveo-tpke")] - use ark_ec::PairingEngine; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; use borsh_ext::BorshSerializeExt; use sha2::{Digest, Sha256}; @@ -37,21 +34,6 @@ pub mod decrypted_tx { hasher } } - - /// Verify that if the encrypted payload was marked - /// "undecryptable", we should not be able to decrypt - /// it - #[cfg(feature = "ferveo-tpke")] - pub fn verify_decrypted_correctly( - decrypted: &DecryptedTx, - mut otx: crate::proto::Tx, - privkey: ::G2Affine, - ) -> bool { - match decrypted { - DecryptedTx::Decrypted { .. } => true, - DecryptedTx::Undecryptable => otx.decrypt(privkey).is_err(), - } - } } pub use decrypted_tx::*; diff --git a/core/src/types/transaction/encrypted.rs b/core/src/types/transaction/encrypted.rs deleted file mode 100644 index 8b547fea88..0000000000 --- a/core/src/types/transaction/encrypted.rs +++ /dev/null @@ -1,48 +0,0 @@ -/// Integration of Ferveo cryptographic primitives -/// to enable encrypted txs. -/// *Not wasm compatible* -#[cfg(feature = "ferveo-tpke")] -pub mod encrypted_tx { - use std::io::{Error, ErrorKind, Read, Write}; - - use ark_ec::PairingEngine; - use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; - use borsh::{BorshDeserialize, BorshSerialize}; - - use crate::types::transaction::{AffineCurve, EllipticCurve}; - /// The first group in our elliptic curve bilinear pairing - pub type G1 = ::G1Affine; - /// An encryption key for txs - #[derive(Debug, Clone, PartialEq)] - pub struct EncryptionKey(pub G1); - - impl Default for EncryptionKey { - fn default() -> Self { - Self(G1::prime_subgroup_generator()) - } - } - - impl borsh::ser::BorshSerialize for EncryptionKey { - fn serialize(&self, writer: &mut W) -> std::io::Result<()> { - let mut buf = Vec::::new(); - CanonicalSerialize::serialize(&self.0, &mut buf) - .map_err(|err| Error::new(ErrorKind::InvalidData, err))?; - BorshSerialize::serialize(&buf, writer) - } - } - - impl borsh::de::BorshDeserialize for EncryptionKey { - fn deserialize_reader( - reader: &mut R, - ) -> std::io::Result { - let key: Vec = BorshDeserialize::deserialize_reader(reader)?; - Ok(EncryptionKey( - CanonicalDeserialize::deserialize(&*key) - .map_err(|err| Error::new(ErrorKind::InvalidData, err))?, - )) - } - } -} - -#[cfg(feature = "ferveo-tpke")] -pub use encrypted_tx::*; diff --git a/core/src/types/transaction/mod.rs b/core/src/types/transaction/mod.rs index b6cdb0cd07..12e2e94d3b 100644 --- a/core/src/types/transaction/mod.rs +++ b/core/src/types/transaction/mod.rs @@ -5,8 +5,6 @@ pub mod account; /// txs that contain decrypted payloads or assertions of /// non-decryptability pub mod decrypted; -/// tools for encrypted data -pub mod encrypted; /// txs to manage governance pub mod governance; /// txs to manage pgf @@ -24,9 +22,6 @@ use std::fmt; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; use borsh_ext::BorshSerializeExt; pub use decrypted::*; -#[cfg(feature = "ferveo-tpke")] -pub use encrypted::EncryptionKey; -pub use protocol::UpdateDkgSessionKey; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; pub use wrapper::*; @@ -36,7 +31,6 @@ use crate::types::address::Address; use crate::types::hash::Hash; use crate::types::ibc::IbcEvent; use crate::types::storage; -#[cfg(feature = "ferveo-tpke")] use crate::types::transaction::protocol::ProtocolTx; /// Get the hash of a transaction @@ -156,7 +150,6 @@ pub enum TxType { /// An attempted decryption of a wrapper tx Decrypted(DecryptedTx), /// Txs issued by validators as part of internal protocols - #[cfg(feature = "ferveo-tpke")] Protocol(Box), } @@ -303,14 +296,6 @@ mod test_process_tx { ))); tx.validate_tx().expect("Test failed"); - match tx.header().tx_type { - TxType::Wrapper(_) => { - tx.decrypt(::G2Affine::prime_subgroup_generator()) - .expect("Test failed"); - // assert_eq!(tx, decrypted); - } - _ => panic!("Test failed: Expected Wrapper Tx"), - } } /// Test that process_tx correctly returns an error on a wrapper tx diff --git a/core/src/types/transaction/pos.rs b/core/src/types/transaction/pos.rs index 8554c98f55..50c0a7eb48 100644 --- a/core/src/types/transaction/pos.rs +++ b/core/src/types/transaction/pos.rs @@ -36,8 +36,6 @@ pub struct InitValidator { pub eth_hot_key: secp256k1::PublicKey, /// Public key used to sign protocol transactions pub protocol_key: common::PublicKey, - /// Serialization of the public session key used in the DKG - pub dkg_key: crate::types::key::dkg_session_keys::DkgPublicKey, /// The initial commission rate charged for delegation rewards pub commission_rate: Dec, /// The maximum change allowed per epoch to the commission rate. This is diff --git a/core/src/types/transaction/protocol.rs b/core/src/types/transaction/protocol.rs index db5d8f9a23..11940f8617 100644 --- a/core/src/types/transaction/protocol.rs +++ b/core/src/types/transaction/protocol.rs @@ -1,109 +1,77 @@ -/// Types for sending and verifying txs -/// used in Namada protocols -use borsh::{BorshDeserialize, BorshSerialize}; +//! Types for sending and verifying txs +//! used in Namada protocols + +use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; +use borsh_ext::BorshSerializeExt; use serde::{Deserialize, Serialize}; -use crate::types::address::Address; +use crate::proto::{Data, Section, Signature, Tx, TxError}; +use crate::types::chain::ChainId; +use crate::types::key::*; +use crate::types::transaction::{Digest, Sha256, TxType}; +use crate::types::vote_extensions::{ + bridge_pool_roots, ethereum_events, validator_set_update, +}; -/// A data type containing information used to update the DKG session key #[derive( - Debug, Clone, - PartialEq, + Debug, BorshSerialize, BorshDeserialize, + BorshSchema, Serialize, Deserialize, )] -pub struct UpdateDkgSessionKey { - /// The storage key of the validators public DKG session key - pub address: Address, - /// The serialization of the new public key associated with the validator - pub dkg_public_key: Vec, +/// Txs sent by validators as part of internal protocols +pub struct ProtocolTx { + /// we require ProtocolTxs be signed + pub pk: common::PublicKey, + /// The type of protocol message being sent + pub tx: ProtocolTxType, } -#[cfg(feature = "ferveo-tpke")] -mod protocol_txs { - use std::collections::BTreeMap; - use std::io::{ErrorKind, Read, Write}; - use std::path::Path; - - use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; - use borsh_ext::BorshSerializeExt; - use ferveo::dkg::pv::Message; - use serde_json; - - use super::*; - use crate::proto::{Code, Data, Section, Signature, Tx, TxError}; - use crate::types::chain::ChainId; - use crate::types::key::*; - use crate::types::transaction::{Digest, EllipticCurve, Sha256, TxType}; - use crate::types::vote_extensions::{ - bridge_pool_roots, ethereum_events, validator_set_update, - }; - - const TX_NEW_DKG_KP_WASM: &str = "tx_update_dkg_session_keypair.wasm"; - - #[derive( - Clone, - Debug, - BorshSerialize, - BorshDeserialize, - BorshSchema, - Serialize, - Deserialize, - )] - /// Txs sent by validators as part of internal protocols - pub struct ProtocolTx { - /// we require ProtocolTxs be signed - pub pk: common::PublicKey, - /// The type of protocol message being sent - pub tx: ProtocolTxType, +impl ProtocolTx { + /// Validate the signature of a protocol tx + pub fn validate_sig( + &self, + signed_hash: [u8; 32], + sig: &common::Signature, + ) -> Result<(), TxError> { + common::SigScheme::verify_signature(&self.pk, &signed_hash, sig) + .map_err(|err| { + TxError::SigError(format!( + "ProtocolTx signature verification failed: {}", + err + )) + }) } - impl ProtocolTx { - /// Validate the signature of a protocol tx - pub fn validate_sig( - &self, - signed_hash: [u8; 32], - sig: &common::Signature, - ) -> Result<(), TxError> { - common::SigScheme::verify_signature(&self.pk, &signed_hash, sig) - .map_err(|err| { - TxError::SigError(format!( - "ProtocolTx signature verification failed: {}", - err - )) - }) - } - - /// Produce a SHA-256 hash of this section - pub fn hash<'a>(&self, hasher: &'a mut Sha256) -> &'a mut Sha256 { - hasher.update(self.serialize_to_vec()); - hasher - } + /// Produce a SHA-256 hash of this section + pub fn hash<'a>(&self, hasher: &'a mut Sha256) -> &'a mut Sha256 { + hasher.update(self.serialize_to_vec()); + hasher } +} - macro_rules! ethereum_tx_data_deserialize_inner { - ($variant:ty) => { - impl TryFrom<&Tx> for $variant { - type Error = TxError; - - fn try_from(tx: &Tx) -> Result { - let tx_data = tx.data().ok_or_else(|| { - TxError::Deserialization( - "Expected protocol tx type associated data".into(), - ) - })?; - Self::try_from_slice(&tx_data).map_err(|err| { - TxError::Deserialization(err.to_string()) - }) - } +macro_rules! ethereum_tx_data_deserialize_inner { + ($variant:ty) => { + impl TryFrom<&Tx> for $variant { + type Error = TxError; + + fn try_from(tx: &Tx) -> Result { + let tx_data = tx.data().ok_or_else(|| { + TxError::Deserialization( + "Expected protocol tx type associated data".into(), + ) + })?; + Self::try_from_slice(&tx_data) + .map_err(|err| TxError::Deserialization(err.to_string())) } - }; - } + } + }; +} - macro_rules! ethereum_tx_data_declare { +macro_rules! ethereum_tx_data_declare { ( $( #[$outer_attrs:meta] )* { @@ -145,71 +113,71 @@ mod protocol_txs { }; } - ethereum_tx_data_declare! { - /// Data associated with Ethereum protocol transactions. - #[derive(Clone, Debug, BorshSerialize, BorshDeserialize, BorshSchema)] - { - /// Ethereum events contained in vote extensions that - /// are compressed before being included on chain - EthereumEvents(ethereum_events::VextDigest), - /// Collection of signatures over the Ethereum bridge - /// pool merkle root and nonce. - BridgePool(bridge_pool_roots::MultiSignedVext), - /// Validator set updates contained in vote extensions - ValidatorSetUpdate(validator_set_update::VextDigest), - /// Ethereum events seen by some validator - EthEventsVext(ethereum_events::SignedVext), - /// Signature over the Ethereum bridge pool merkle root and nonce. - BridgePoolVext(bridge_pool_roots::SignedVext), - /// Validator set update signed by some validator - ValSetUpdateVext(validator_set_update::SignedVext), - } +ethereum_tx_data_declare! { + /// Data associated with Ethereum protocol transactions. + #[derive(Clone, Debug, BorshSerialize, BorshDeserialize, BorshSchema)] + { + /// Ethereum events contained in vote extensions that + /// are compressed before being included on chain + EthereumEvents(ethereum_events::VextDigest), + /// Collection of signatures over the Ethereum bridge + /// pool merkle root and nonce. + BridgePool(bridge_pool_roots::MultiSignedVext), + /// Validator set updates contained in vote extensions + ValidatorSetUpdate(validator_set_update::VextDigest), + /// Ethereum events seen by some validator + EthEventsVext(ethereum_events::SignedVext), + /// Signature over the Ethereum bridge pool merkle root and nonce. + BridgePoolVext(bridge_pool_roots::SignedVext), + /// Validator set update signed by some validator + ValSetUpdateVext(validator_set_update::SignedVext), } +} - impl TryFrom<&Tx> for EthereumTxData { - type Error = TxError; +impl TryFrom<&Tx> for EthereumTxData { + type Error = TxError; - fn try_from(tx: &Tx) -> Result { - let TxType::Protocol(protocol_tx) = tx.header().tx_type else { + fn try_from(tx: &Tx) -> Result { + let TxType::Protocol(protocol_tx) = tx.header().tx_type else { return Err(TxError::Deserialization( "Expected protocol tx type".into(), )); }; - let Some(tx_data) = tx.data() else { + let Some(tx_data) = tx.data() else { return Err(TxError::Deserialization( "Expected protocol tx type associated data".into(), )); }; - Self::deserialize(&protocol_tx.tx, &tx_data) - } + Self::deserialize(&protocol_tx.tx, &tx_data) } +} - impl EthereumTxData { - /// Sign transaction Ethereum data and wrap it in a [`Tx`]. - pub fn sign( - &self, - signing_key: &common::SecretKey, - chain_id: ChainId, - ) -> Tx { - let (tx_data, tx_type) = self.serialize(); - let mut outer_tx = - Tx::from_type(TxType::Protocol(Box::new(ProtocolTx { - pk: signing_key.ref_to(), - tx: tx_type, - }))); - outer_tx.header.chain_id = chain_id; - outer_tx.set_data(Data::new(tx_data)); - outer_tx.add_section(Section::Signature(Signature::new( - outer_tx.sechashes(), - [(0, signing_key.clone())].into_iter().collect(), - None, - ))); - outer_tx - } +impl EthereumTxData { + /// Sign transaction Ethereum data and wrap it in a [`Tx`]. + pub fn sign( + &self, + signing_key: &common::SecretKey, + chain_id: ChainId, + ) -> Tx { + let (tx_data, tx_type) = self.serialize(); + let mut outer_tx = + Tx::from_type(TxType::Protocol(Box::new(ProtocolTx { + pk: signing_key.ref_to(), + tx: tx_type, + }))); + outer_tx.header.chain_id = chain_id; + outer_tx.set_data(Data::new(tx_data)); + outer_tx.add_section(Section::Signature(Signature::new( + outer_tx.sechashes(), + [(0, signing_key.clone())].into_iter().collect(), + None, + ))); + outer_tx + } - /// Serialize Ethereum protocol transaction data. - pub fn serialize(&self) -> (Vec, ProtocolTxType) { - macro_rules! match_of_type { + /// Serialize Ethereum protocol transaction data. + pub fn serialize(&self) -> (Vec, ProtocolTxType) { + macro_rules! match_of_type { ( $( $type:ident ),* $(,)?) => { match self { $( EthereumTxData::$type(x) => @@ -217,194 +185,93 @@ mod protocol_txs { } } } - match_of_type! { - EthereumEvents, - BridgePool, - ValidatorSetUpdate, - EthEventsVext, - BridgePoolVext, - ValSetUpdateVext, - } - } - - /// Deserialize Ethereum protocol transaction data. - pub fn deserialize( - tx_type: &ProtocolTxType, - data: &[u8], - ) -> Result { - let deserialize: fn(&[u8]) -> _ = match tx_type { - ProtocolTxType::EthereumEvents => |data| { - BorshDeserialize::try_from_slice(data) - .map(EthereumTxData::EthereumEvents) - }, - ProtocolTxType::BridgePool => |data| { - BorshDeserialize::try_from_slice(data) - .map(EthereumTxData::BridgePool) - }, - ProtocolTxType::ValidatorSetUpdate => |data| { - BorshDeserialize::try_from_slice(data) - .map(EthereumTxData::ValidatorSetUpdate) - }, - ProtocolTxType::EthEventsVext => |data| { - BorshDeserialize::try_from_slice(data) - .map(EthereumTxData::EthEventsVext) - }, - ProtocolTxType::BridgePoolVext => |data| { - BorshDeserialize::try_from_slice(data) - .map(EthereumTxData::BridgePoolVext) - }, - ProtocolTxType::ValSetUpdateVext => |data| { - BorshDeserialize::try_from_slice(data) - .map(EthereumTxData::ValSetUpdateVext) - }, - tx => { - return Err(TxError::Deserialization(format!( - "Not an Ethereum protocol tx: {tx:?}" - ))); - } - }; - deserialize(data) - .map_err(|err| TxError::Deserialization(err.to_string())) + match_of_type! { + EthereumEvents, + BridgePool, + ValidatorSetUpdate, + EthEventsVext, + BridgePoolVext, + ValSetUpdateVext, } } - /// DKG message wrapper type that adds Borsh encoding. - #[derive(Clone, Debug, Serialize, Deserialize)] - pub struct DkgMessage(pub Message); - - #[derive( - Clone, - Debug, - BorshSerialize, - BorshDeserialize, - BorshSchema, - Serialize, - Deserialize, - )] - #[allow(clippy::large_enum_variant)] - /// Types of protocol messages to be sent - pub enum ProtocolTxType { - /// Messages to be given to the DKG state machine - DKG(DkgMessage), - /// Tx requesting a new DKG session keypair - NewDkgKeypair, - /// Ethereum events contained in vote extensions that - /// are compressed before being included on chain - EthereumEvents, - /// Collection of signatures over the Ethereum bridge - /// pool merkle root and nonce. - BridgePool, - /// Validator set updates contained in vote extensions - ValidatorSetUpdate, - /// Ethereum events seen by some validator - EthEventsVext, - /// Signature over the Ethereum bridge pool merkle root and nonce. - BridgePoolVext, - /// Validator set update signed by some validator - ValSetUpdateVext, - } - - impl ProtocolTxType { - /// Create a new tx requesting a new DKG session keypair - pub fn request_new_dkg_keypair<'a, F>( - data: UpdateDkgSessionKey, - signing_key: &common::SecretKey, - wasm_dir: &'a Path, - wasm_loader: F, - chain_id: ChainId, - ) -> Tx - where - F: FnOnce(&'a str, &'static str) -> Vec, - { - let code = wasm_loader( - wasm_dir - .to_str() - .expect("Converting path to string should not fail"), - TX_NEW_DKG_KP_WASM, - ); - let mut outer_tx = - Tx::from_type(TxType::Protocol(Box::new(ProtocolTx { - pk: signing_key.ref_to(), - tx: Self::NewDkgKeypair, - }))); - outer_tx.header.chain_id = chain_id; - outer_tx.set_code(Code::new(code)); - outer_tx.set_data(Data::new(data.serialize_to_vec())); - outer_tx.add_section(Section::Signature(Signature::new( - vec![outer_tx.header_hash()], - [(0, signing_key.clone())].into_iter().collect(), - None, - ))); - outer_tx - } - - /// Determine if this [`ProtocolTxType`] is an Ethereum - /// protocol tx. - #[inline] - pub fn is_ethereum(&self) -> bool { - matches!( - self, - Self::EthereumEvents - | Self::BridgePool - | Self::ValidatorSetUpdate - | Self::EthEventsVext - | Self::BridgePoolVext - | Self::ValSetUpdateVext - ) - } - } - - impl BorshSerialize for DkgMessage { - fn serialize(&self, writer: &mut W) -> std::io::Result<()> { - let blob = serde_json::to_string(&self.0) - .map_err(|err| { - std::io::Error::new(ErrorKind::InvalidData, err) - })? - .as_bytes() - .to_owned(); - BorshSerialize::serialize(&blob, writer) - } - } - - impl BorshDeserialize for DkgMessage { - fn deserialize_reader( - reader: &mut R, - ) -> std::io::Result { - let blob: Vec = BorshDeserialize::deserialize_reader(reader)?; - let json = String::from_utf8(blob).map_err(|err| { - std::io::Error::new(ErrorKind::InvalidData, err) - })?; - let msg = serde_json::from_str(&json).map_err(|err| { - std::io::Error::new(ErrorKind::InvalidData, err) - })?; - Ok(Self(msg)) - } + /// Deserialize Ethereum protocol transaction data. + pub fn deserialize( + tx_type: &ProtocolTxType, + data: &[u8], + ) -> Result { + let deserialize: fn(&[u8]) -> _ = match tx_type { + ProtocolTxType::EthereumEvents => |data| { + BorshDeserialize::try_from_slice(data) + .map(EthereumTxData::EthereumEvents) + }, + ProtocolTxType::BridgePool => |data| { + BorshDeserialize::try_from_slice(data) + .map(EthereumTxData::BridgePool) + }, + ProtocolTxType::ValidatorSetUpdate => |data| { + BorshDeserialize::try_from_slice(data) + .map(EthereumTxData::ValidatorSetUpdate) + }, + ProtocolTxType::EthEventsVext => |data| { + BorshDeserialize::try_from_slice(data) + .map(EthereumTxData::EthEventsVext) + }, + ProtocolTxType::BridgePoolVext => |data| { + BorshDeserialize::try_from_slice(data) + .map(EthereumTxData::BridgePoolVext) + }, + ProtocolTxType::ValSetUpdateVext => |data| { + BorshDeserialize::try_from_slice(data) + .map(EthereumTxData::ValSetUpdateVext) + }, + }; + deserialize(data) + .map_err(|err| TxError::Deserialization(err.to_string())) } +} - impl BorshSchema for DkgMessage { - fn add_definitions_recursively( - definitions: &mut BTreeMap< - borsh::schema::Declaration, - borsh::schema::Definition, - >, - ) { - // Encoded as `Vec`; - let elements = "u8".into(); - let definition = borsh::schema::Definition::Sequence { elements }; - definitions.insert(Self::declaration(), definition); - } - - fn declaration() -> borsh::schema::Declaration { - "DkgMessage".into() - } - } +#[derive( + Clone, + Debug, + BorshSerialize, + BorshDeserialize, + BorshSchema, + Serialize, + Deserialize, +)] +#[allow(clippy::large_enum_variant)] +/// Types of protocol messages to be sent +pub enum ProtocolTxType { + /// Ethereum events contained in vote extensions that + /// are compressed before being included on chain + EthereumEvents, + /// Collection of signatures over the Ethereum bridge + /// pool merkle root and nonce. + BridgePool, + /// Validator set updates contained in vote extensions + ValidatorSetUpdate, + /// Ethereum events seen by some validator + EthEventsVext, + /// Signature over the Ethereum bridge pool merkle root and nonce. + BridgePoolVext, + /// Validator set update signed by some validator + ValSetUpdateVext, +} - impl From> for ProtocolTxType { - fn from(msg: Message) -> ProtocolTxType { - ProtocolTxType::DKG(DkgMessage(msg)) - } +impl ProtocolTxType { + /// Determine if this [`ProtocolTxType`] is an Ethereum + /// protocol tx. + #[inline] + pub fn is_ethereum(&self) -> bool { + matches!( + self, + Self::EthereumEvents + | Self::BridgePool + | Self::ValidatorSetUpdate + | Self::EthEventsVext + | Self::BridgePoolVext + | Self::ValSetUpdateVext + ) } } - -#[cfg(feature = "ferveo-tpke")] -pub use protocol_txs::*; diff --git a/core/src/types/transaction/wrapper.rs b/core/src/types/transaction/wrapper.rs index 4603081d3f..8c4f1fb4a9 100644 --- a/core/src/types/transaction/wrapper.rs +++ b/core/src/types/transaction/wrapper.rs @@ -7,8 +7,6 @@ pub mod wrapper_tx { use std::str::FromStr; pub use ark_bls12_381::Bls12_381 as EllipticCurve; - #[cfg(feature = "ferveo-tpke")] - pub use ark_ec::{AffineCurve, PairingEngine}; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; use borsh_ext::BorshSerializeExt; use masp_primitives::transaction::Transaction; @@ -410,143 +408,6 @@ pub mod wrapper_tx { assert_eq!(refund, Amount::default()); } } - - #[cfg(test)] - mod test_wrapper_tx { - use super::*; - use crate::proto::{Code, Data, Section, Signature, Tx, TxError}; - use crate::types::address::nam; - use crate::types::transaction::{Hash, TxType}; - - fn gen_keypair() -> common::SecretKey { - use rand::prelude::ThreadRng; - use rand::thread_rng; - - let mut rng: ThreadRng = thread_rng(); - ed25519::SigScheme::generate(&mut rng).try_to_sk().unwrap() - } - - /// We test that when we feed in a Tx and then decrypt it again - /// that we get what we started with. - #[test] - fn test_encryption_round_trip() { - let keypair = gen_keypair(); - let mut wrapper = - Tx::from_type(TxType::Wrapper(Box::new(WrapperTx::new( - Fee { - amount_per_gas_unit: Amount::from_uint(10, 0) - .expect("Test failed"), - token: nam(), - }, - keypair.ref_to(), - Epoch(0), - Default::default(), - None, - )))); - wrapper.set_code(Code::new("wasm code".as_bytes().to_owned())); - wrapper - .set_data(Data::new("transaction data".as_bytes().to_owned())); - let mut encrypted_tx = wrapper.clone(); - encrypted_tx.encrypt(&Default::default()); - wrapper.add_section(Section::Signature(Signature::new( - vec![wrapper.header_hash(), wrapper.sections[0].get_hash()], - [(0, keypair)].into_iter().collect(), - None, - ))); - assert!(encrypted_tx.validate_ciphertext()); - let privkey = ::G2Affine::prime_subgroup_generator(); - encrypted_tx.decrypt(privkey).expect("Test failed"); - assert_eq!(wrapper.data(), encrypted_tx.data()); - assert_eq!(wrapper.code(), encrypted_tx.code()); - } - - /// We test that when we try to decrypt a tx and it - /// does not match the commitment, an error is returned - #[test] - fn test_decryption_invalid_hash() { - let keypair = gen_keypair(); - let mut wrapper = - Tx::from_type(TxType::Wrapper(Box::new(WrapperTx::new( - Fee { - amount_per_gas_unit: Amount::from_uint(10, 0) - .expect("Test failed"), - token: nam(), - }, - keypair.ref_to(), - Epoch(0), - Default::default(), - None, - )))); - wrapper.set_code(Code::new("wasm code".as_bytes().to_owned())); - wrapper - .set_data(Data::new("transaction data".as_bytes().to_owned())); - // give a incorrect commitment to the decrypted contents of the tx - wrapper.set_code_sechash(Hash([0u8; 32])); - wrapper.set_data_sechash(Hash([0u8; 32])); - wrapper.encrypt(&Default::default()); - wrapper.add_section(Section::Signature(Signature::new( - vec![wrapper.header_hash(), wrapper.sections[0].get_hash()], - [(0, keypair)].into_iter().collect(), - None, - ))); - assert!(wrapper.validate_ciphertext()); - let privkey = ::G2Affine::prime_subgroup_generator(); - let err = wrapper.decrypt(privkey).expect_err("Test failed"); - assert_matches!(err, WrapperTxErr::DecryptedHash); - } - - /// We check that even if the encrypted payload and hash of its - /// contents are correctly changed, we detect fraudulent activity - /// via the signature. - #[test] - fn test_malleability_attack_detection() { - let keypair = gen_keypair(); - // the signed tx - let mut tx = - Tx::from_type(TxType::Wrapper(Box::new(WrapperTx::new( - Fee { - amount_per_gas_unit: Amount::from_uint(10, 0) - .expect("Test failed"), - token: nam(), - }, - keypair.ref_to(), - Epoch(0), - Default::default(), - None, - )))); - - tx.set_code(Code::new("wasm code".as_bytes().to_owned())); - tx.set_data(Data::new("transaction data".as_bytes().to_owned())); - tx.add_section(Section::Signature(Signature::new( - tx.sechashes(), - [(0, keypair.clone())].into_iter().collect(), - None, - ))); - - // we now try to alter the inner tx maliciously - // malicious transaction - // We replace the inner tx with a malicious one - // We change the commitment appropriately - let malicious = "Give me all the money".as_bytes().to_owned(); - tx.set_data(Data::new(malicious.clone())); - - // we check ciphertext validity still passes - assert!(tx.validate_ciphertext()); - // we check that decryption still succeeds - tx.decrypt( - ::G2Affine::prime_subgroup_generator(), - ) - .expect("Test failed"); - assert_eq!(tx.data(), Some(malicious)); - - // check that the signature is not valid - tx.verify_signature(&keypair.ref_to(), &tx.sechashes()) - .expect_err("Test failed"); - // check that the try from method also fails - let err = tx.validate_tx().expect_err("Test failed"); - assert_matches!(err, TxError::SigError(_)); - } - } } pub use wrapper_tx::*; diff --git a/core/src/types/voting_power.rs b/core/src/types/voting_power.rs index 292fadb6f9..014e0bade9 100644 --- a/core/src/types/voting_power.rs +++ b/core/src/types/voting_power.rs @@ -239,7 +239,7 @@ impl Display for FractionalVotingPower { } impl BorshSerialize for FractionalVotingPower { - fn serialize( + fn serialize( &self, writer: &mut W, ) -> std::io::Result<()> { diff --git a/ethereum_bridge/Cargo.toml b/ethereum_bridge/Cargo.toml index 3adb7b9cd5..7114cec224 100644 --- a/ethereum_bridge/Cargo.toml +++ b/ethereum_bridge/Cargo.toml @@ -19,7 +19,7 @@ testing = [ ] [dependencies] -namada_core = {path = "../core", default-features = false, features = ["ferveo-tpke", "ethers-derive"]} +namada_core = {path = "../core", default-features = false, features = ["ethers-derive"]} namada_macros = {path = "../macros"} namada_proof_of_stake = {path = "../proof_of_stake", default-features = false} borsh.workspace = true @@ -37,7 +37,7 @@ tracing = "0.1.30" [dev-dependencies] # Added "testing" feature. -namada_core = {path = "../core", default-features = false, features = ["ferveo-tpke", "ethers-derive", "testing"]} +namada_core = {path = "../core", default-features = false, features = ["ethers-derive", "testing"]} namada_proof_of_stake = {path = "../proof_of_stake", default-features = false, features = ["testing"]} assert_matches.workspace = true data-encoding.workspace = true diff --git a/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs b/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs index 137fdddf28..e4b562e0ac 100644 --- a/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs +++ b/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs @@ -7,8 +7,6 @@ use namada_core::ledger::storage::{DBIter, StorageHasher, WlStorage, DB}; use namada_core::types::address::Address; use namada_core::types::storage::{BlockHeight, Epoch}; use namada_core::types::token::Amount; -#[allow(unused_imports)] -use namada_core::types::transaction::protocol::ProtocolTxType; use namada_core::types::transaction::TxResult; use namada_core::types::vote_extensions::validator_set_update; diff --git a/genesis/localnet/src/pre-genesis/validator-0/transactions.toml b/genesis/localnet/src/pre-genesis/validator-0/transactions.toml index e94a1458f1..bd03907dae 100644 --- a/genesis/localnet/src/pre-genesis/validator-0/transactions.toml +++ b/genesis/localnet/src/pre-genesis/validator-0/transactions.toml @@ -1,6 +1,5 @@ [[validator_account]] alias = "validator-0" -dkg_key = "dpknam1vqqqqqphsfm2hwzpxnkmf3kzcyq3ps2kxjqmk2sresfn8mwas4vysrluu0smn3mlpsshyv0ex49u8n2nm5gpk87unxlzczfvhac2x4malhhr3wwyvhuu3uwgd66jgvkg463h86eywphupgwawnus23vgnats3mvwjulevk" vp = "vp_validator" commission_rate = "0.05" max_commission_rate_change = "0.01" @@ -8,28 +7,28 @@ email = "null@null.net" net_address = "127.0.0.1:27656" [validator_account.account_key] -pk = "tpknam1qzfc6ytsytksl8spkzmqlhmmanf7rnkqta4u3sp87ldakj3a5l2svrms7y9" -authorization = "signam1qrj64httssprssqhhra9668kxlus8muqjef3p20dcuah2vmctkevy7dxysheelt3ng4mdwzytu7405u6mz54w8pj4kg76cvx4hl8l7qv4gp2yx" +pk = "tpknam1qzuaykg8nrmzuaefut39aaxl0gl66y62285cnwe37gq0a96qaf4qgp5yqtw" +authorization = "signam1qpcvzjdqkvhud9lez3exq3vy7dnp4kyjgsk92yx5cslwzjs0q9czx8ajxztx5pftx9hsf9w2shh6rt0uv6xeyu30ljqkrqj6hnrwn5gqfd9pwf" [validator_account.consensus_key] -pk = "tpknam1qr7783f60w4shwlcuz44qcswzzxzpfyren6kzx36dyctds7lkg97gmqvhhm" -authorization = "signam1qqlr2j7qvxrp7hnjs6hxpxd8zgk7xpatplrll3wcpj62tqymvvzty86x3rkrhygczmmkcqssvvtx7m0x9x7qvh3806hcakr4f2zug0cwx60y66" +pk = "tpknam1qpudpptwfh9u5mhvksrguyqk6wvyhus0kf2cs9qr0xuq9k4fepldgqv3ztq" +authorization = "signam1qpuhmvgl330cr3acugaddhn6q9xdw3577h3mv9yszau2smxmn7yvmn2yplfym4sk30r2hz943989sd68umu70e4wsk5q6j2gzzjfg4q0qjvz6f" [validator_account.protocol_key] -pk = "tpknam1qpd3wf3e4j9ms6an68894qu23tz5clwxcg7uknm5tvdspxeep609xqha32d" -authorization = "signam1qpnzlq4lsa7z22gu5nmdyfx09cn78l4a8k0w04d8adhlekl007s8exjmznxm4kxry6u7ep6un8fkz0vqlvh5xt3h3cf7690kmst8r4sr67gsn8" +pk = "tpknam1qzxs6kchkustgjxld3xz0u3c8gfnkvda042vp06auk6zfrru5hhxqqvyxq6" +authorization = "signam1qztaxmfgncmv5jn9tak0au2ryzxwxrlhn2qyfx4fgewuv5p7jelpfpqe9mlp7y73vsw7r8hu509swj8mumgryswu38m7mvxn9asqn0cq7aqvjp" [validator_account.tendermint_node_key] -pk = "tpknam1qzew97uet42t6v74u4vkdhsvhhul874a32rrv6jyaf3tlqnje9dms2rlnql" -authorization = "signam1qpgmdf8r5sdl9l8yljqw9hvhyvkww3zurd72xcr88sl5qxamduwmdufrq8attgypl254fdvqcnt9rnv064x5c2dgxtcm675wph9umqc8k3uly7" +pk = "tpknam1qzckzn2rc4pr26e0clxajgcllasr6tke4yqrsu7wskw89uka29zykram505" +authorization = "signam1qrgvyj39ljlequl20hx2mz9wpuyjl8lj826c0upy9agt4txuyyusuqkhdmm2aajglupssqcsx8nv62etua6vn0duzrucut4m74nmhscwy3knc3" [validator_account.eth_hot_key] -pk = "tpknam1qypl23ydd0l2gcykw9g0juxyycx5l84zr2m4dnw08pepnslllyl4zfq2x9r9d" -authorization = "signam1qx563nytyc58xj422y83n7fhxyc73szxsgdgw90zhptqgajl09s8g08knz2uv80eagpar04aswdmpkxulp8tz6n8kmtk87jwxrm3v2wdqykkpfcz" +pk = "tpknam1qyp8znkp023autwqh2cy6c6vhnz8vsm4p6w9ngpnnamqk6dj5w6ktxqjnd0qj" +authorization = "signam1q9fd4nkz8df5ajh6jrsn6mrt0apvn4266walr8pnczl0xtn847u6usdemslvusseerhrd6hftse8zfch5tlpmqp4y9xz3563mu0d26hnqq942mt2" [validator_account.eth_cold_key] -pk = "tpknam1qyp5ng08ttca26aapu9vwrkjcwfhkncqmdd7lkwxa6wsd892yea5jtchac4xk" -authorization = "signam1qy5n259562ehv82h9ajyfa94gm85zdyds9jhjf5f6gczsp0rgmtps0q6pm3755thne700lc24pr5mjz6muc5sexlvk45s8z5rcr2leqdqqfg7gxx" +pk = "tpknam1qyp4aw7a07f4ltuq3f0c4sgyq3kzgh6z40w8jt40wl7uhfj7e3m3u9qr792xg" +authorization = "signam1qyqcc7wstsnuadu75jnwg8hxz34nglxj9h9yqyx2c4qqdpxw50ff60hu0swfj7xdkz34tgl9e50jlmzphkgtpw3gg0hsgp35lhsl6rmeqqq28kph" [[transfer]] token = "nam" @@ -42,4 +41,4 @@ signature = "signam1qz8ch7n6jp7g7hvnzkhmprhqc5umd0gatarlttm7gpcdx6g8hmgqffdq67fn source = "validator-0" validator = "validator-0" amount = "100000" -signature = "signam1qpfa9tn8wgnfcvafdqu3u7pq0gmfyavsuwc0en533z0kakm9jpks00ns5wrl5g30s6mxxllv94wm86vph4hcp0ztxxe4aw2npcz56lg2c7wtae" +signature = "signam1qrd7wg2sdla73z7626r2ep8895d9ed4ljq37nz6kmy2rcm36yqjugw6vle7kl70l0d585t382s9vd28k2duwz0lu7ux0vua6aaarjssgdf46n2" diff --git a/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml b/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml index 50f0ab9c20..4f3db8b8b0 100644 --- a/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml +++ b/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml @@ -1,11 +1,8 @@ -account_key = "unencrypted:0020b7550a84ffdffc00cef25dd67808337cc5eb9a66aeb462428ff4adb7b12d57" -consensus_key = "unencrypted:00442dd0bfbf75c6556eb381a650ea59cb604ae04beb5c514b8915c4bd1a3429da" -eth_cold_key = "unencrypted:01102274a5753f39fd2fc033bda38f3578dcb0085f734ee8b34349f5a54d11349d" -tendermint_node_key = "unencrypted:00abf205fdd859006b8eadce5e05c3cce6d4f32caffbb24683e347939875365408" +account_key = "unencrypted:00eaa8829ff8932ffad86c4b0ad1ed2f2870c12ca49f03b50e4b34d360daa24268" +consensus_key = "unencrypted:00aabd79879fce99cb528f92d8ea4593241dd49507ff456be52ca2aee98c728338" +eth_cold_key = "unencrypted:0181901af21f92e997c78c61337475d1975c8d29591601e36ace3952d7094d9447" +tendermint_node_key = "unencrypted:00afc7747d1e6d76293553864bbf482d061f1932f83b978b24ba4957dcfcda987c" [validator_keys] -protocol_keypair = "ED25519_SK_PREFIX000bd46e16ebd2079cfe0742f9ba54c1b6c9bf595a5dfedcc9bb6d8eafbde9814b" -eth_bridge_keypair = "SECP256K1_SK_PREFIX013be3dc1cd32c42e675c24679edd4bc5c5482d1551a16b3122ce4ebf4b3fed124" - -[validator_keys.dkg_keypair] -decryption_key = [97, 13, 235, 192, 243, 156, 113, 169, 145, 241, 124, 132, 83, 223, 69, 239, 217, 109, 186, 158, 131, 96, 169, 241, 66, 52, 132, 56, 39, 165, 99, 5] +protocol_keypair = "ED25519_SK_PREFIX00b0da066a528a0e1221e6453f9d10143b07a675a250c66603e8a7e98bdbb8cf19" +eth_bridge_keypair = "SECP256K1_SK_PREFIX0133deb418af6af5c62aecbde3dc3a0ff62ea20c0c8e33cf703d0f5e35248e5ab1" diff --git a/genesis/localnet/transactions.toml b/genesis/localnet/transactions.toml index deb89797aa..cafe123854 100644 --- a/genesis/localnet/transactions.toml +++ b/genesis/localnet/transactions.toml @@ -7,7 +7,6 @@ [[validator_account]] alias = "validator-0" -dkg_key = "dpknam1vqqqqqphsfm2hwzpxnkmf3kzcyq3ps2kxjqmk2sresfn8mwas4vysrluu0smn3mlpsshyv0ex49u8n2nm5gpk87unxlzczfvhac2x4malhhr3wwyvhuu3uwgd66jgvkg463h86eywphupgwawnus23vgnats3mvwjulevk" vp = "vp_validator" commission_rate = "0.05" max_commission_rate_change = "0.01" @@ -15,28 +14,28 @@ email = "null@null.net" net_address = "127.0.0.1:27656" [validator_account.account_key] -pk = "tpknam1qzfc6ytsytksl8spkzmqlhmmanf7rnkqta4u3sp87ldakj3a5l2svrms7y9" -authorization = "signam1qrj64httssprssqhhra9668kxlus8muqjef3p20dcuah2vmctkevy7dxysheelt3ng4mdwzytu7405u6mz54w8pj4kg76cvx4hl8l7qv4gp2yx" +pk = "tpknam1qzuaykg8nrmzuaefut39aaxl0gl66y62285cnwe37gq0a96qaf4qgp5yqtw" +authorization = "signam1qpcvzjdqkvhud9lez3exq3vy7dnp4kyjgsk92yx5cslwzjs0q9czx8ajxztx5pftx9hsf9w2shh6rt0uv6xeyu30ljqkrqj6hnrwn5gqfd9pwf" [validator_account.consensus_key] -pk = "tpknam1qr7783f60w4shwlcuz44qcswzzxzpfyren6kzx36dyctds7lkg97gmqvhhm" -authorization = "signam1qqlr2j7qvxrp7hnjs6hxpxd8zgk7xpatplrll3wcpj62tqymvvzty86x3rkrhygczmmkcqssvvtx7m0x9x7qvh3806hcakr4f2zug0cwx60y66" +pk = "tpknam1qpudpptwfh9u5mhvksrguyqk6wvyhus0kf2cs9qr0xuq9k4fepldgqv3ztq" +authorization = "signam1qpuhmvgl330cr3acugaddhn6q9xdw3577h3mv9yszau2smxmn7yvmn2yplfym4sk30r2hz943989sd68umu70e4wsk5q6j2gzzjfg4q0qjvz6f" [validator_account.protocol_key] -pk = "tpknam1qpd3wf3e4j9ms6an68894qu23tz5clwxcg7uknm5tvdspxeep609xqha32d" -authorization = "signam1qpnzlq4lsa7z22gu5nmdyfx09cn78l4a8k0w04d8adhlekl007s8exjmznxm4kxry6u7ep6un8fkz0vqlvh5xt3h3cf7690kmst8r4sr67gsn8" +pk = "tpknam1qzxs6kchkustgjxld3xz0u3c8gfnkvda042vp06auk6zfrru5hhxqqvyxq6" +authorization = "signam1qztaxmfgncmv5jn9tak0au2ryzxwxrlhn2qyfx4fgewuv5p7jelpfpqe9mlp7y73vsw7r8hu509swj8mumgryswu38m7mvxn9asqn0cq7aqvjp" [validator_account.tendermint_node_key] -pk = "tpknam1qzew97uet42t6v74u4vkdhsvhhul874a32rrv6jyaf3tlqnje9dms2rlnql" -authorization = "signam1qpgmdf8r5sdl9l8yljqw9hvhyvkww3zurd72xcr88sl5qxamduwmdufrq8attgypl254fdvqcnt9rnv064x5c2dgxtcm675wph9umqc8k3uly7" +pk = "tpknam1qzckzn2rc4pr26e0clxajgcllasr6tke4yqrsu7wskw89uka29zykram505" +authorization = "signam1qrgvyj39ljlequl20hx2mz9wpuyjl8lj826c0upy9agt4txuyyusuqkhdmm2aajglupssqcsx8nv62etua6vn0duzrucut4m74nmhscwy3knc3" [validator_account.eth_hot_key] -pk = "tpknam1qypl23ydd0l2gcykw9g0juxyycx5l84zr2m4dnw08pepnslllyl4zfq2x9r9d" -authorization = "signam1qx563nytyc58xj422y83n7fhxyc73szxsgdgw90zhptqgajl09s8g08knz2uv80eagpar04aswdmpkxulp8tz6n8kmtk87jwxrm3v2wdqykkpfcz" +pk = "tpknam1qyp8znkp023autwqh2cy6c6vhnz8vsm4p6w9ngpnnamqk6dj5w6ktxqjnd0qj" +authorization = "signam1q9fd4nkz8df5ajh6jrsn6mrt0apvn4266walr8pnczl0xtn847u6usdemslvusseerhrd6hftse8zfch5tlpmqp4y9xz3563mu0d26hnqq942mt2" [validator_account.eth_cold_key] -pk = "tpknam1qyp5ng08ttca26aapu9vwrkjcwfhkncqmdd7lkwxa6wsd892yea5jtchac4xk" -authorization = "signam1qy5n259562ehv82h9ajyfa94gm85zdyds9jhjf5f6gczsp0rgmtps0q6pm3755thne700lc24pr5mjz6muc5sexlvk45s8z5rcr2leqdqqfg7gxx" +pk = "tpknam1qyp4aw7a07f4ltuq3f0c4sgyq3kzgh6z40w8jt40wl7uhfj7e3m3u9qr792xg" +authorization = "signam1qyqcc7wstsnuadu75jnwg8hxz34nglxj9h9yqyx2c4qqdpxw50ff60hu0swfj7xdkz34tgl9e50jlmzphkgtpw3gg0hsgp35lhsl6rmeqqq28kph" [[transfer]] token = "nam" @@ -49,7 +48,7 @@ signature = "signam1qz8ch7n6jp7g7hvnzkhmprhqc5umd0gatarlttm7gpcdx6g8hmgqffdq67fn source = "validator-0" validator = "validator-0" amount = "100000" -signature = "signam1qpfa9tn8wgnfcvafdqu3u7pq0gmfyavsuwc0en533z0kakm9jpks00ns5wrl5g30s6mxxllv94wm86vph4hcp0ztxxe4aw2npcz56lg2c7wtae" +signature = "signam1qrd7wg2sdla73z7626r2ep8895d9ed4ljq37nz6kmy2rcm36yqjugw6vle7kl70l0d585t382s9vd28k2duwz0lu7ux0vua6aaarjssgdf46n2" # 2. diff --git a/proto/types.proto b/proto/types.proto index 44ad70b77e..288e9c81c8 100644 --- a/proto/types.proto +++ b/proto/types.proto @@ -7,9 +7,3 @@ package types; message Tx { bytes data = 1; } - -message Dkg { string data = 1; } - -message DkgGossipMessage { - oneof dkg_message { Dkg dkg = 1; } -} diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 8e68fec084..b2c38caa5a 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -15,10 +15,7 @@ version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -ferveo-tpke = [ - "namada_core/ferveo-tpke", -] - +default = ["rand", "rand_core"] masp-tx-gen = [ "rand", "rand_core", @@ -29,7 +26,6 @@ multicore = ["masp_proofs/multicore"] namada-sdk = [ "tendermint-rpc", "masp-tx-gen", - "ferveo-tpke", "masp_primitives/transparent-inputs" ] diff --git a/sdk/src/events/mod.rs b/sdk/src/events/mod.rs index 0e83be3731..3ebd5dcae8 100644 --- a/sdk/src/events/mod.rs +++ b/sdk/src/events/mod.rs @@ -9,7 +9,6 @@ use std::str::FromStr; use borsh::{BorshDeserialize, BorshSerialize}; use namada_core::types::ibc::IbcEvent; -#[cfg(feature = "ferveo-tpke")] use namada_core::types::transaction::TxType; use serde_json::Value; @@ -91,7 +90,6 @@ impl FromStr for EventType { impl Event { /// Creates a new event with the hash and height of the transaction /// already filled in - #[cfg(feature = "ferveo-tpke")] pub fn new_tx_event(tx: &crate::proto::Tx, height: u64) -> Self { let mut event = match tx.header().tx_type { TxType::Wrapper(_) => { diff --git a/sdk/src/masp.rs b/sdk/src/masp.rs index 5e22dba3cc..be4e0f194c 100644 --- a/sdk/src/masp.rs +++ b/sdk/src/masp.rs @@ -60,9 +60,7 @@ use namada_core::types::token; use namada_core::types::token::{ Change, MaspDenom, Transfer, HEAD_TX_KEY, PIN_KEY_PREFIX, TX_KEY_PREFIX, }; -use namada_core::types::transaction::{ - AffineCurve, EllipticCurve, PairingEngine, WrapperTx, -}; +use namada_core::types::transaction::WrapperTx; #[cfg(feature = "masp-tx-gen")] use rand_core::{CryptoRng, OsRng, RngCore}; use ripemd::Digest as RipemdDigest; @@ -1964,15 +1962,10 @@ impl ShieldedContext { /// Extract the payload from the given Tx object fn extract_payload( - mut tx: Tx, + tx: Tx, wrapper: &mut Option, transfer: &mut Option, ) -> Result<(), Error> { - let privkey = - ::G2Affine::prime_subgroup_generator(); - tx.decrypt(privkey).map_err(|e| { - Error::Other(format!("unable to decrypt transaction: {}", e)) - })?; *wrapper = tx.header.wrapper(); let _ = tx.data().map(|signed| { Transfer::try_from_slice(&signed[..]).map(|tfer| *transfer = Some(tfer)) diff --git a/sdk/src/queries/router.rs b/sdk/src/queries/router.rs index 1251972608..c408fbd8c7 100644 --- a/sdk/src/queries/router.rs +++ b/sdk/src/queries/router.rs @@ -830,7 +830,7 @@ macro_rules! router { /// You can expand the `handlers!` macro invocation with e.g.: /// ```shell -/// cargo expand ledger::queries::router::test_rpc_handlers --features "ferveo-tpke, ibc-mocks, testing, wasm-runtime, tendermint-rpc" --tests --lib +/// cargo expand ledger::queries::router::test_rpc_handlers --features "ibc-mocks, testing, wasm-runtime, tendermint-rpc" --tests --lib /// ``` #[cfg(test)] mod test_rpc_handlers { @@ -959,7 +959,7 @@ mod test_rpc_handlers { /// You can expand the `router!` macro invocation with e.g.: /// ```shell -/// cargo expand ledger::queries::router::test_rpc --features "ferveo-tpke, ibc-mocks, testing, wasm-runtime, tendermint-rpc" --tests --lib +/// cargo expand ledger::queries::router::test_rpc --features "ibc-mocks, testing, wasm-runtime, tendermint-rpc" --tests --lib /// ``` #[cfg(test)] mod test_rpc { diff --git a/sdk/src/signing.rs b/sdk/src/signing.rs index e19e8925b6..694b5b7476 100644 --- a/sdk/src/signing.rs +++ b/sdk/src/signing.rs @@ -1038,7 +1038,6 @@ pub async fn to_ledger_vector<'a>( format!("Ethereum cold key : {}", init_validator.eth_cold_key), format!("Ethereum hot key : {}", init_validator.eth_hot_key), format!("Protocol key : {}", init_validator.protocol_key), - format!("DKG key : {}", init_validator.dkg_key), format!("Commission rate : {}", init_validator.commission_rate), format!( "Maximum commission rate change : {}", @@ -1059,7 +1058,6 @@ pub async fn to_ledger_vector<'a>( format!("Ethereum cold key : {}", init_validator.eth_cold_key), format!("Ethereum hot key : {}", init_validator.eth_hot_key), format!("Protocol key : {}", init_validator.protocol_key), - format!("DKG key : {}", init_validator.dkg_key), format!("Commission rate : {}", init_validator.commission_rate), format!( "Maximum commission rate change : {}", diff --git a/sdk/src/wallet/store.rs b/sdk/src/wallet/store.rs index 4b13291e03..4d8af29c8e 100644 --- a/sdk/src/wallet/store.rs +++ b/sdk/src/wallet/store.rs @@ -9,7 +9,6 @@ use bip39::Seed; use itertools::Itertools; use masp_primitives::zip32::ExtendedFullViewingKey; use namada_core::types::address::{Address, ImplicitAddress}; -use namada_core::types::key::dkg_session_keys::DkgKeypair; use namada_core::types::key::*; use namada_core::types::masp::{ ExtendedSpendingKey, ExtendedViewingKey, PaymentAddress, @@ -42,9 +41,6 @@ pub struct ValidatorKeys { pub protocol_keypair: common::SecretKey, /// Special hot keypair for signing Ethereum bridge txs pub eth_bridge_keypair: common::SecretKey, - /// Special session keypair needed by validators for participating - /// in the DKG protocol - pub dkg_keypair: Option, } impl ValidatorKeys { diff --git a/shared/Cargo.toml b/shared/Cargo.toml index b68451fbf7..509b412636 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -20,10 +20,6 @@ mainnet = [ "namada_core/mainnet", ] std = ["fd-lock"] -ferveo-tpke = [ - "namada_core/ferveo-tpke", - "namada_sdk/ferveo-tpke", -] wasm-runtime = [ "namada_core/wasm-runtime", "loupe", @@ -84,7 +80,6 @@ testing = [ namada-sdk = [ "tendermint-rpc", "masp-tx-gen", - "ferveo-tpke", "masp_primitives/transparent-inputs", "namada_sdk/namada-sdk", ] @@ -95,7 +90,7 @@ multicore = [ ] [dependencies] -namada_core = {path = "../core", default-features = false} +namada_core = {path = "../core", default-features = false, features = ["rand"]} namada_sdk = {path = "../sdk", default-features = false} namada_proof_of_stake = {path = "../proof_of_stake", default-features = false} namada_ethereum_bridge = {path = "../ethereum_bridge", default-features = false} diff --git a/shared/src/ledger/mod.rs b/shared/src/ledger/mod.rs index 3c3122838b..c946ddcf56 100644 --- a/shared/src/ledger/mod.rs +++ b/shared/src/ledger/mod.rs @@ -6,7 +6,7 @@ pub mod ibc; pub mod native_vp; pub mod pgf; pub mod pos; -#[cfg(all(feature = "wasm-runtime", feature = "ferveo-tpke"))] +#[cfg(feature = "wasm-runtime")] pub mod protocol; pub use namada_sdk::queries; pub mod storage; @@ -19,12 +19,12 @@ pub use namada_core::ledger::{ }; use namada_sdk::queries::{EncodedResponseQuery, RequestCtx, RequestQuery}; -#[cfg(all(feature = "wasm-runtime", feature = "ferveo-tpke"))] +#[cfg(feature = "wasm-runtime")] use crate::vm::wasm::{TxCache, VpCache}; use crate::vm::WasmCacheAccess; /// Dry run a transaction -#[cfg(all(feature = "wasm-runtime", feature = "ferveo-tpke"))] +#[cfg(feature = "wasm-runtime")] pub fn dry_run_tx( mut ctx: RequestCtx<'_, D, H, VpCache, TxCache>, request: &RequestQuery, @@ -38,10 +38,7 @@ where use namada_core::ledger::gas::{Gas, GasMetering, TxGasMeter}; use namada_core::ledger::storage::TempWlStorage; use namada_core::proto::Tx; - use namada_core::types::transaction::wrapper::wrapper_tx::PairingEngine; - use namada_core::types::transaction::{ - AffineCurve, DecryptedTx, EllipticCurve, - }; + use namada_core::types::transaction::DecryptedTx; use crate::ledger::protocol::ShellParams; use crate::types::storage::TxIndex; @@ -76,10 +73,6 @@ where temp_wl_storage.write_log.commit_tx(); cumulated_gas = tx_gas_meter.get_tx_consumed_gas(); - // NOTE: the encryption key for a dry-run should always be an - // hardcoded, dummy one - let _privkey = - ::G2Affine::prime_subgroup_generator(); tx.update_header(TxType::Decrypted(DecryptedTx::Decrypted)); TxGasMeter::new_from_sub_limit(tx_gas_meter.get_available_gas()) } diff --git a/test_fixtures/masp_proofs/0198EA2E90E59AE189F8E4D2148EFC768FE777B9F1B84CA71D843A0062EB1509.bin b/test_fixtures/masp_proofs/0198EA2E90E59AE189F8E4D2148EFC768FE777B9F1B84CA71D843A0062EB1509.bin new file mode 100644 index 0000000000..91158992f1 Binary files /dev/null and b/test_fixtures/masp_proofs/0198EA2E90E59AE189F8E4D2148EFC768FE777B9F1B84CA71D843A0062EB1509.bin differ diff --git a/test_fixtures/masp_proofs/055DA1818E0CFE5FA16EF73281F3C046661C03F25C2E76093D2EDAD921D2DBCD.bin b/test_fixtures/masp_proofs/055DA1818E0CFE5FA16EF73281F3C046661C03F25C2E76093D2EDAD921D2DBCD.bin deleted file mode 100644 index fcfefd7b2a..0000000000 Binary files a/test_fixtures/masp_proofs/055DA1818E0CFE5FA16EF73281F3C046661C03F25C2E76093D2EDAD921D2DBCD.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/07778F6B538EA6F44A31AF8881D0325E92E7B8C2B7D4D88B604885AC074C3C18.bin b/test_fixtures/masp_proofs/07778F6B538EA6F44A31AF8881D0325E92E7B8C2B7D4D88B604885AC074C3C18.bin deleted file mode 100644 index 9672917daf..0000000000 Binary files a/test_fixtures/masp_proofs/07778F6B538EA6F44A31AF8881D0325E92E7B8C2B7D4D88B604885AC074C3C18.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/0BB61ED029B895FEEB7681A39C6EDC5CC89E90D6FF92E31C8C872DCAB358239A.bin b/test_fixtures/masp_proofs/0BB61ED029B895FEEB7681A39C6EDC5CC89E90D6FF92E31C8C872DCAB358239A.bin new file mode 100644 index 0000000000..e5e6e93ec1 Binary files /dev/null and b/test_fixtures/masp_proofs/0BB61ED029B895FEEB7681A39C6EDC5CC89E90D6FF92E31C8C872DCAB358239A.bin differ diff --git a/test_fixtures/masp_proofs/0D47127ED497A1E74B68EDF7F8D435C3F820D144D8EB9D7EF3F6F92ABA9E86D2.bin b/test_fixtures/masp_proofs/0D47127ED497A1E74B68EDF7F8D435C3F820D144D8EB9D7EF3F6F92ABA9E86D2.bin deleted file mode 100644 index 307602ec5f..0000000000 Binary files a/test_fixtures/masp_proofs/0D47127ED497A1E74B68EDF7F8D435C3F820D144D8EB9D7EF3F6F92ABA9E86D2.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/19424ECD5071B2F4FBE6A884F169ED081F538C47DF5FA44816F0FE6563A057DA.bin b/test_fixtures/masp_proofs/19424ECD5071B2F4FBE6A884F169ED081F538C47DF5FA44816F0FE6563A057DA.bin deleted file mode 100644 index 9275723271..0000000000 Binary files a/test_fixtures/masp_proofs/19424ECD5071B2F4FBE6A884F169ED081F538C47DF5FA44816F0FE6563A057DA.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/25633D7F2314DF022B0BFE691E53F37BBCF5DC7A08A2DF4C27B4F97D9DB9C96D.bin b/test_fixtures/masp_proofs/25633D7F2314DF022B0BFE691E53F37BBCF5DC7A08A2DF4C27B4F97D9DB9C96D.bin deleted file mode 100644 index f39a257538..0000000000 Binary files a/test_fixtures/masp_proofs/25633D7F2314DF022B0BFE691E53F37BBCF5DC7A08A2DF4C27B4F97D9DB9C96D.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/297C112C50A5097DB00DC4D192002AC409F2EC41257301CCD2C76F46D8424E1B.bin b/test_fixtures/masp_proofs/297C112C50A5097DB00DC4D192002AC409F2EC41257301CCD2C76F46D8424E1B.bin deleted file mode 100644 index 9cbb4cd428..0000000000 Binary files a/test_fixtures/masp_proofs/297C112C50A5097DB00DC4D192002AC409F2EC41257301CCD2C76F46D8424E1B.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/30F09813D596F8277911C99FF1C6B362D244EDD624244876F9B5F541EBA07FC5.bin b/test_fixtures/masp_proofs/30F09813D596F8277911C99FF1C6B362D244EDD624244876F9B5F541EBA07FC5.bin new file mode 100644 index 0000000000..1329396ab9 Binary files /dev/null and b/test_fixtures/masp_proofs/30F09813D596F8277911C99FF1C6B362D244EDD624244876F9B5F541EBA07FC5.bin differ diff --git a/test_fixtures/masp_proofs/315FBEBD16884E62FCFB437CEA4D13376048954D074973BAD19846CC5570D984.bin b/test_fixtures/masp_proofs/315FBEBD16884E62FCFB437CEA4D13376048954D074973BAD19846CC5570D984.bin new file mode 100644 index 0000000000..3e42d029c4 Binary files /dev/null and b/test_fixtures/masp_proofs/315FBEBD16884E62FCFB437CEA4D13376048954D074973BAD19846CC5570D984.bin differ diff --git a/test_fixtures/masp_proofs/3509591B3F7AFBCD4D5126B45079F7ED34B4FC622A60089A64B5062967571C12.bin b/test_fixtures/masp_proofs/3509591B3F7AFBCD4D5126B45079F7ED34B4FC622A60089A64B5062967571C12.bin deleted file mode 100644 index a74e98732b..0000000000 Binary files a/test_fixtures/masp_proofs/3509591B3F7AFBCD4D5126B45079F7ED34B4FC622A60089A64B5062967571C12.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/800B61A449815EEF9A0E366A15DCC4F6FBE0BD4694476CB967FE3F67A1E9C9A0.bin b/test_fixtures/masp_proofs/3EE70DC758071936C6AADB82E56C536AAC74604CB002CA3558559CACCC24B5EB.bin similarity index 52% rename from test_fixtures/masp_proofs/800B61A449815EEF9A0E366A15DCC4F6FBE0BD4694476CB967FE3F67A1E9C9A0.bin rename to test_fixtures/masp_proofs/3EE70DC758071936C6AADB82E56C536AAC74604CB002CA3558559CACCC24B5EB.bin index 3874a8d2ce..92f501db51 100644 Binary files a/test_fixtures/masp_proofs/800B61A449815EEF9A0E366A15DCC4F6FBE0BD4694476CB967FE3F67A1E9C9A0.bin and b/test_fixtures/masp_proofs/3EE70DC758071936C6AADB82E56C536AAC74604CB002CA3558559CACCC24B5EB.bin differ diff --git a/test_fixtures/masp_proofs/FA174624A786A6CFDDF99BB6F1A140C846F52B52A108A23BF7FF061734E4B01F.bin b/test_fixtures/masp_proofs/4CCF96B9008D42BA633988264D3E116D3BC8B780C76EAEC072E1A71D709AE66F.bin similarity index 54% rename from test_fixtures/masp_proofs/FA174624A786A6CFDDF99BB6F1A140C846F52B52A108A23BF7FF061734E4B01F.bin rename to test_fixtures/masp_proofs/4CCF96B9008D42BA633988264D3E116D3BC8B780C76EAEC072E1A71D709AE66F.bin index 85a7989f4a..3887ce9a44 100644 Binary files a/test_fixtures/masp_proofs/FA174624A786A6CFDDF99BB6F1A140C846F52B52A108A23BF7FF061734E4B01F.bin and b/test_fixtures/masp_proofs/4CCF96B9008D42BA633988264D3E116D3BC8B780C76EAEC072E1A71D709AE66F.bin differ diff --git a/test_fixtures/masp_proofs/50C53F3CA843689FC9C1C3233686DF79F7E021A374BFCF3C6CA82DAC391C6533.bin b/test_fixtures/masp_proofs/50C53F3CA843689FC9C1C3233686DF79F7E021A374BFCF3C6CA82DAC391C6533.bin new file mode 100644 index 0000000000..5d71d8783a Binary files /dev/null and b/test_fixtures/masp_proofs/50C53F3CA843689FC9C1C3233686DF79F7E021A374BFCF3C6CA82DAC391C6533.bin differ diff --git a/test_fixtures/masp_proofs/74E779A7AEE40EA5ACCC7DE141690987679E2F56FD8DE6743C736802DCCA71CA.bin b/test_fixtures/masp_proofs/74E779A7AEE40EA5ACCC7DE141690987679E2F56FD8DE6743C736802DCCA71CA.bin deleted file mode 100644 index d68e32c6fb..0000000000 Binary files a/test_fixtures/masp_proofs/74E779A7AEE40EA5ACCC7DE141690987679E2F56FD8DE6743C736802DCCA71CA.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/819FB7D977389C0AC073BE200FCE87F8358272338A32B5B411E93BD43D963AE0.bin b/test_fixtures/masp_proofs/819FB7D977389C0AC073BE200FCE87F8358272338A32B5B411E93BD43D963AE0.bin new file mode 100644 index 0000000000..f537b76d38 Binary files /dev/null and b/test_fixtures/masp_proofs/819FB7D977389C0AC073BE200FCE87F8358272338A32B5B411E93BD43D963AE0.bin differ diff --git a/test_fixtures/masp_proofs/8686859C447B47946DC21922D83C2404E7EBDFF543A6EAA34544FFF644F08FA9.bin b/test_fixtures/masp_proofs/8686859C447B47946DC21922D83C2404E7EBDFF543A6EAA34544FFF644F08FA9.bin new file mode 100644 index 0000000000..a6d6153a3a Binary files /dev/null and b/test_fixtures/masp_proofs/8686859C447B47946DC21922D83C2404E7EBDFF543A6EAA34544FFF644F08FA9.bin differ diff --git a/test_fixtures/masp_proofs/931AE522191249FAFA4A38C9740412000E423E0085AB074BF8C493574AF3226B.bin b/test_fixtures/masp_proofs/931AE522191249FAFA4A38C9740412000E423E0085AB074BF8C493574AF3226B.bin new file mode 100644 index 0000000000..4e66ffffab Binary files /dev/null and b/test_fixtures/masp_proofs/931AE522191249FAFA4A38C9740412000E423E0085AB074BF8C493574AF3226B.bin differ diff --git a/test_fixtures/masp_proofs/9EF9FF93C65A60615530272351A86DBF2921ACB1380E8F256AD0CE25151C869C.bin b/test_fixtures/masp_proofs/9EF9FF93C65A60615530272351A86DBF2921ACB1380E8F256AD0CE25151C869C.bin new file mode 100644 index 0000000000..b232255a68 Binary files /dev/null and b/test_fixtures/masp_proofs/9EF9FF93C65A60615530272351A86DBF2921ACB1380E8F256AD0CE25151C869C.bin differ diff --git a/test_fixtures/masp_proofs/A55A0682FF0B308BF33C9FF9F8CA0876D3BEADEB3367E918331FD2CB6D81E098.bin b/test_fixtures/masp_proofs/A55A0682FF0B308BF33C9FF9F8CA0876D3BEADEB3367E918331FD2CB6D81E098.bin deleted file mode 100644 index e6ba6bb740..0000000000 Binary files a/test_fixtures/masp_proofs/A55A0682FF0B308BF33C9FF9F8CA0876D3BEADEB3367E918331FD2CB6D81E098.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/C37373E2478B837D2468FBEE5CCA5D2C40DFF157E5FB70DDC84202C160D01CD3.bin b/test_fixtures/masp_proofs/C37373E2478B837D2468FBEE5CCA5D2C40DFF157E5FB70DDC84202C160D01CD3.bin new file mode 100644 index 0000000000..944c1a805c Binary files /dev/null and b/test_fixtures/masp_proofs/C37373E2478B837D2468FBEE5CCA5D2C40DFF157E5FB70DDC84202C160D01CD3.bin differ diff --git a/test_fixtures/masp_proofs/CFA1009F833AE80FEFE49B9CF1D96F616B19187CBB5BFB9CAC56A544EF7AB6F5.bin b/test_fixtures/masp_proofs/CFA1009F833AE80FEFE49B9CF1D96F616B19187CBB5BFB9CAC56A544EF7AB6F5.bin deleted file mode 100644 index 5a48668552..0000000000 Binary files a/test_fixtures/masp_proofs/CFA1009F833AE80FEFE49B9CF1D96F616B19187CBB5BFB9CAC56A544EF7AB6F5.bin and /dev/null differ diff --git a/test_fixtures/masp_proofs/DB978B3F08838665C1ECD7BEA4E600461287D8046692CDB4AA2CF94A1AC7F8F6.bin b/test_fixtures/masp_proofs/DB978B3F08838665C1ECD7BEA4E600461287D8046692CDB4AA2CF94A1AC7F8F6.bin new file mode 100644 index 0000000000..8c5888b087 Binary files /dev/null and b/test_fixtures/masp_proofs/DB978B3F08838665C1ECD7BEA4E600461287D8046692CDB4AA2CF94A1AC7F8F6.bin differ diff --git a/test_fixtures/masp_proofs/DF6782E863D019B6B3303F4922AB43CF25C7E9D5B197C5A3D444CF8415B9CDC5.bin b/test_fixtures/masp_proofs/DF6782E863D019B6B3303F4922AB43CF25C7E9D5B197C5A3D444CF8415B9CDC5.bin deleted file mode 100644 index 15a05ba6d8..0000000000 Binary files a/test_fixtures/masp_proofs/DF6782E863D019B6B3303F4922AB43CF25C7E9D5B197C5A3D444CF8415B9CDC5.bin and /dev/null differ diff --git a/tx_prelude/src/proof_of_stake.rs b/tx_prelude/src/proof_of_stake.rs index dc145b11db..728a0dc7bd 100644 --- a/tx_prelude/src/proof_of_stake.rs +++ b/tx_prelude/src/proof_of_stake.rs @@ -111,7 +111,6 @@ impl Ctx { eth_cold_key, eth_hot_key, protocol_key, - dkg_key, commission_rate, max_commission_rate_change, email, @@ -131,8 +130,6 @@ impl Ctx { &account_keys, threshold, )?; - let dkg_pk_key = key::dkg_session_keys::dkg_pk_key(&validator_address); - self.write(&dkg_pk_key, &dkg_key)?; let eth_cold_key = key::common::PublicKey::Secp256k1(eth_cold_key); let eth_hot_key = key::common::PublicKey::Secp256k1(eth_hot_key); diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 08170e1095..16dd7535f5 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if 1.0.0", - "cipher 0.4.4", + "cipher", "cpufeatures", ] @@ -157,18 +157,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ark-ed-on-bls12-381" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b7ada17db3854f5994e74e60b18e10e818594935ee7e1d329800c117b32970" -dependencies = [ - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-std", -] - [[package]] name = "ark-ff" version = "0.3.0" @@ -209,41 +197,16 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ark-poly" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0f78f47537c2f15706db7e98fe64cc1711dbf9def81218194e17239e53e5aa" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.11.2", -] - [[package]] name = "ark-serialize" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" dependencies = [ - "ark-serialize-derive", "ark-std", "digest 0.9.0", ] -[[package]] -name = "ark-serialize-derive" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd4e5f0bf8285d5ed538d27fab7411f3e297908fd93c62195de8bee3f199e82" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "ark-std" version = "0.3.0" @@ -454,15 +417,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.6", -] - [[package]] name = "blake2b_simd" version = "1.0.1" @@ -551,39 +505,16 @@ dependencies = [ "subtle 2.4.1", ] -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", -] - [[package]] name = "borsh" version = "1.0.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41898277107b0d3f027593697912977397eba6ac39a55bdd2eb02c1d5d5013b5" dependencies = [ - "borsh-derive 1.0.0-alpha.4", + "borsh-derive", "cfg_aliases", ] -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "borsh-derive" version = "1.0.0-alpha.4" @@ -591,41 +522,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413cb435569fe499e89235f758304e0e7198016baa351d8f5827ea0f40526ce0" dependencies = [ "once_cell", - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", "syn_derive", ] -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "borsh-ext" version = "1.0.0-alpha.4" source = "git+https://github.com/heliaxdev/borsh-ext?tag=v1.0.0-alpha.4#6bebf357002f96574ac37a28f547b6c88e91b799" dependencies = [ - "borsh 1.0.0-alpha.4", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "borsh", ] [[package]] @@ -730,7 +639,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -760,17 +669,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if 1.0.0", - "cipher 0.3.0", - "cpufeatures", -] - [[package]] name = "chacha20" version = "0.9.1" @@ -778,7 +676,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if 1.0.0", - "cipher 0.4.4", + "cipher", "cpufeatures", ] @@ -789,8 +687,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ "aead", - "chacha20 0.9.1", - "cipher 0.4.4", + "chacha20", + "cipher", "poly1305", "zeroize", ] @@ -807,15 +705,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.7", -] - [[package]] name = "cipher" version = "0.4.4" @@ -1202,20 +1091,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.4.4", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle 2.4.1", - "zeroize", + "cipher", ] [[package]] @@ -1414,20 +1290,10 @@ dependencies = [ "elliptic-curve", "rfc6979", "serdect", - "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 = [ - "serde", - "signature 1.6.4", -] - [[package]] name = "ed25519" version = "2.2.3" @@ -1435,7 +1301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", - "signature 2.1.0", + "signature", ] [[package]] @@ -1466,22 +1332,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek", - "ed25519 1.5.3", - "merlin", - "rand 0.7.3", - "serde", - "serde_bytes", - "sha2 0.9.9", - "zeroize", -] - [[package]] name = "either" version = "1.8.1" @@ -1951,56 +1801,6 @@ dependencies = [ "instant", ] -[[package]] -name = "ferveo" -version = "0.1.1" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-bls12-381", - "ark-ec", - "ark-ed-on-bls12-381", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "bincode", - "blake2", - "blake2b_simd", - "borsh 0.9.3", - "digest 0.10.6", - "ed25519-dalek", - "either", - "ferveo-common", - "group-threshold-cryptography", - "hex", - "itertools 0.10.5", - "measure_time", - "miracl_core", - "num 0.4.0", - "rand 0.7.3", - "rand 0.8.5", - "serde", - "serde_bytes", - "serde_json", - "subproductdomain", - "subtle 2.4.1", - "zeroize", -] - -[[package]] -name = "ferveo-common" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-ec", - "ark-serialize", - "ark-std", - "serde", - "serde_bytes", -] - [[package]] name = "ff" version = "0.13.0" @@ -2062,7 +1862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26c4b37de5ae15812a764c958297cfc50f5c010438f60c6ce75d11b802abd404" dependencies = [ "cbc", - "cipher 0.4.4", + "cipher", "libm", "num-bigint 0.4.3", "num-integer", @@ -2280,30 +2080,6 @@ dependencies = [ "subtle 2.4.1", ] -[[package]] -name = "group-threshold-cryptography" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "blake2b_simd", - "chacha20 0.8.2", - "hex", - "itertools 0.10.5", - "miracl_core", - "rand 0.8.5", - "rand_core 0.6.4", - "rayon", - "subproductdomain", - "thiserror", -] - [[package]] name = "gumdrop" version = "0.8.1" @@ -2711,7 +2487,7 @@ name = "index-set" version = "0.8.0" source = "git+https://github.com/heliaxdev/index-set?tag=v0.8.0#0c218cc300c1bb7a1acf34f21b6e9d489df5fda8" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "serde", ] @@ -2762,9 +2538,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -2864,7 +2637,7 @@ dependencies = [ "once_cell", "serdect", "sha2 0.10.6", - "signature 2.1.0", + "signature", ] [[package]] @@ -2983,10 +2756,10 @@ name = "masp_note_encryption" version = "0.2.0" source = "git+https://github.com/anoma/masp?rev=77e009626f3f52fe83c81ec6ee38fc2547d38da3#77e009626f3f52fe83c81ec6ee38fc2547d38da3" dependencies = [ - "borsh 1.0.0-alpha.4", - "chacha20 0.9.1", + "borsh", + "chacha20", "chacha20poly1305", - "cipher 0.4.4", + "cipher", "rand_core 0.6.4", "subtle 2.4.1", ] @@ -3002,7 +2775,7 @@ dependencies = [ "blake2b_simd", "blake2s_simd", "bls12_381", - "borsh 1.0.0-alpha.4", + "borsh", "byteorder", "ff", "fpe", @@ -3058,16 +2831,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -[[package]] -name = "measure_time" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" -dependencies = [ - "instant", - "log", -] - [[package]] name = "memchr" version = "2.5.0" @@ -3119,18 +2882,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93c0d11ac30a033511ae414355d80f70d9f29a44a49140face477117a1ee90db" -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - [[package]] name = "mime" version = "0.3.17" @@ -3171,12 +2922,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "miracl_core" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c7128ba23c81f6471141b90f17654f89ef44a56e14b8a4dd0fddfccd655277" - [[package]] name = "more-asserts" version = "0.2.2" @@ -3195,7 +2940,7 @@ version = "0.25.0" dependencies = [ "async-trait", "bimap", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "circular-queue", "clru", @@ -3255,10 +3000,9 @@ name = "namada_core" version = "0.25.0" dependencies = [ "ark-bls12-381", - "ark-ec", "ark-serialize", "bech32 0.8.1", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "chrono", "data-encoding", @@ -3267,9 +3011,6 @@ dependencies = [ "ethabi", "ethbridge-structs", "eyre", - "ferveo", - "ferveo-common", - "group-threshold-cryptography", "ibc", "ibc-derive", "ibc-proto", @@ -3310,7 +3051,7 @@ dependencies = [ name = "namada_ethereum_bridge" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "ethers", "eyre", @@ -3340,7 +3081,7 @@ dependencies = [ name = "namada_proof_of_stake" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "data-encoding", "derivative", "namada_core", @@ -3356,7 +3097,7 @@ version = "0.25.0" dependencies = [ "async-trait", "bimap", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "circular-queue", "data-encoding", @@ -3398,7 +3139,7 @@ dependencies = [ name = "namada_test_utils" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "namada_core", "strum", ] @@ -3439,7 +3180,7 @@ dependencies = [ name = "namada_tx_prelude" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "masp_primitives", "namada_core", @@ -3454,7 +3195,7 @@ dependencies = [ name = "namada_vm_env" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "masp_primitives", "namada_core", ] @@ -3463,7 +3204,7 @@ dependencies = [ name = "namada_vp_prelude" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "namada_core", "namada_macros", @@ -3477,7 +3218,7 @@ dependencies = [ name = "namada_wasm" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "getrandom 0.2.10", "masp_primitives", "namada", @@ -3682,7 +3423,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", @@ -3694,7 +3435,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", @@ -3817,7 +3558,7 @@ version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -4087,15 +3828,6 @@ dependencies = [ "uint", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml 0.5.11", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -4790,7 +4522,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -4820,7 +4552,7 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -5111,12 +4843,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" @@ -5178,7 +4904,7 @@ name = "sparse-merkle-tree" version = "0.3.1-pre" source = "git+https://github.com/heliaxdev/sparse-merkle-tree?rev=aed81070ce2c83a41e1c6bada757347f33ef8eb6#aed81070ce2c83a41e1c6bada757347f33ef8eb6" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "cfg-if 1.0.0", "ics23", "sha2 0.9.9", @@ -5246,19 +4972,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "subproductdomain" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", -] - [[package]] name = "subtle" version = "1.0.0" @@ -5374,7 +5087,7 @@ checksum = "bc2294fa667c8b548ee27a9ba59115472d0a09c2ba255771092a7f1dcf03a789" dependencies = [ "bytes", "digest 0.10.6", - "ed25519 2.2.3", + "ed25519", "ed25519-consensus 2.1.0", "flex-error", "futures", @@ -5387,7 +5100,7 @@ dependencies = [ "serde_json", "serde_repr", "sha2 0.10.6", - "signature 2.1.0", + "signature", "subtle 2.4.1", "subtle-encoding", "tendermint-proto", @@ -5819,7 +5532,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" name = "tx_template" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "getrandom 0.2.10", "namada_tests", "namada_tx_prelude", @@ -5968,7 +5681,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" name = "vp_template" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "getrandom 0.2.10", "namada_tests", "namada_vp_prelude", diff --git a/wasm_for_tests/wasm_source/Cargo.lock b/wasm_for_tests/wasm_source/Cargo.lock index f3efd192b7..c9750fdfbc 100644 --- a/wasm_for_tests/wasm_source/Cargo.lock +++ b/wasm_for_tests/wasm_source/Cargo.lock @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if 1.0.0", - "cipher 0.4.4", + "cipher", "cpufeatures", ] @@ -157,18 +157,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ark-ed-on-bls12-381" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b7ada17db3854f5994e74e60b18e10e818594935ee7e1d329800c117b32970" -dependencies = [ - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-std", -] - [[package]] name = "ark-ff" version = "0.3.0" @@ -209,41 +197,16 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ark-poly" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0f78f47537c2f15706db7e98fe64cc1711dbf9def81218194e17239e53e5aa" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.11.2", -] - [[package]] name = "ark-serialize" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" dependencies = [ - "ark-serialize-derive", "ark-std", "digest 0.9.0", ] -[[package]] -name = "ark-serialize-derive" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd4e5f0bf8285d5ed538d27fab7411f3e297908fd93c62195de8bee3f199e82" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "ark-std" version = "0.3.0" @@ -454,15 +417,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.6", -] - [[package]] name = "blake2b_simd" version = "1.0.1" @@ -551,39 +505,16 @@ dependencies = [ "subtle 2.4.1", ] -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", -] - [[package]] name = "borsh" version = "1.0.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41898277107b0d3f027593697912977397eba6ac39a55bdd2eb02c1d5d5013b5" dependencies = [ - "borsh-derive 1.0.0-alpha.4", + "borsh-derive", "cfg_aliases", ] -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "borsh-derive" version = "1.0.0-alpha.4" @@ -591,41 +522,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413cb435569fe499e89235f758304e0e7198016baa351d8f5827ea0f40526ce0" dependencies = [ "once_cell", - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", "syn_derive", ] -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "borsh-ext" version = "1.0.0-alpha.4" source = "git+https://github.com/heliaxdev/borsh-ext?tag=v1.0.0-alpha.4#6bebf357002f96574ac37a28f547b6c88e91b799" dependencies = [ - "borsh 1.0.0-alpha.4", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "borsh", ] [[package]] @@ -730,7 +639,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -760,17 +669,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if 1.0.0", - "cipher 0.3.0", - "cpufeatures", -] - [[package]] name = "chacha20" version = "0.9.1" @@ -778,7 +676,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if 1.0.0", - "cipher 0.4.4", + "cipher", "cpufeatures", ] @@ -789,8 +687,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ "aead", - "chacha20 0.9.1", - "cipher 0.4.4", + "chacha20", + "cipher", "poly1305", "zeroize", ] @@ -807,15 +705,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.7", -] - [[package]] name = "cipher" version = "0.4.4" @@ -1202,20 +1091,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.4.4", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle 2.4.1", - "zeroize", + "cipher", ] [[package]] @@ -1414,20 +1290,10 @@ dependencies = [ "elliptic-curve", "rfc6979", "serdect", - "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 = [ - "serde", - "signature 1.6.4", -] - [[package]] name = "ed25519" version = "2.2.3" @@ -1435,7 +1301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", - "signature 2.1.0", + "signature", ] [[package]] @@ -1466,22 +1332,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek", - "ed25519 1.5.3", - "merlin", - "rand 0.7.3", - "serde", - "serde_bytes", - "sha2 0.9.9", - "zeroize", -] - [[package]] name = "either" version = "1.8.1" @@ -1951,56 +1801,6 @@ dependencies = [ "instant", ] -[[package]] -name = "ferveo" -version = "0.1.1" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-bls12-381", - "ark-ec", - "ark-ed-on-bls12-381", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "bincode", - "blake2", - "blake2b_simd", - "borsh 0.9.3", - "digest 0.10.6", - "ed25519-dalek", - "either", - "ferveo-common", - "group-threshold-cryptography", - "hex", - "itertools 0.10.5", - "measure_time", - "miracl_core", - "num 0.4.0", - "rand 0.7.3", - "rand 0.8.5", - "serde", - "serde_bytes", - "serde_json", - "subproductdomain", - "subtle 2.4.1", - "zeroize", -] - -[[package]] -name = "ferveo-common" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-ec", - "ark-serialize", - "ark-std", - "serde", - "serde_bytes", -] - [[package]] name = "ff" version = "0.13.0" @@ -2062,7 +1862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26c4b37de5ae15812a764c958297cfc50f5c010438f60c6ce75d11b802abd404" dependencies = [ "cbc", - "cipher 0.4.4", + "cipher", "libm", "num-bigint 0.4.3", "num-integer", @@ -2280,30 +2080,6 @@ dependencies = [ "subtle 2.4.1", ] -[[package]] -name = "group-threshold-cryptography" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-bls12-381", - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "blake2b_simd", - "chacha20 0.8.2", - "hex", - "itertools 0.10.5", - "miracl_core", - "rand 0.8.5", - "rand_core 0.6.4", - "rayon", - "subproductdomain", - "thiserror", -] - [[package]] name = "gumdrop" version = "0.8.1" @@ -2711,7 +2487,7 @@ name = "index-set" version = "0.8.0" source = "git+https://github.com/heliaxdev/index-set?tag=v0.8.0#0c218cc300c1bb7a1acf34f21b6e9d489df5fda8" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "serde", ] @@ -2762,9 +2538,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -2864,7 +2637,7 @@ dependencies = [ "once_cell", "serdect", "sha2 0.10.6", - "signature 2.1.0", + "signature", ] [[package]] @@ -2983,10 +2756,10 @@ name = "masp_note_encryption" version = "0.2.0" source = "git+https://github.com/anoma/masp?rev=77e009626f3f52fe83c81ec6ee38fc2547d38da3#77e009626f3f52fe83c81ec6ee38fc2547d38da3" dependencies = [ - "borsh 1.0.0-alpha.4", - "chacha20 0.9.1", + "borsh", + "chacha20", "chacha20poly1305", - "cipher 0.4.4", + "cipher", "rand_core 0.6.4", "subtle 2.4.1", ] @@ -3002,7 +2775,7 @@ dependencies = [ "blake2b_simd", "blake2s_simd", "bls12_381", - "borsh 1.0.0-alpha.4", + "borsh", "byteorder", "ff", "fpe", @@ -3058,16 +2831,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -[[package]] -name = "measure_time" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" -dependencies = [ - "instant", - "log", -] - [[package]] name = "memchr" version = "2.5.0" @@ -3119,18 +2882,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93c0d11ac30a033511ae414355d80f70d9f29a44a49140face477117a1ee90db" -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - [[package]] name = "mime" version = "0.3.17" @@ -3171,12 +2922,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "miracl_core" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c7128ba23c81f6471141b90f17654f89ef44a56e14b8a4dd0fddfccd655277" - [[package]] name = "more-asserts" version = "0.2.2" @@ -3195,7 +2940,7 @@ version = "0.25.0" dependencies = [ "async-trait", "bimap", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "circular-queue", "clru", @@ -3255,10 +3000,9 @@ name = "namada_core" version = "0.25.0" dependencies = [ "ark-bls12-381", - "ark-ec", "ark-serialize", "bech32 0.8.1", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "chrono", "data-encoding", @@ -3267,9 +3011,6 @@ dependencies = [ "ethabi", "ethbridge-structs", "eyre", - "ferveo", - "ferveo-common", - "group-threshold-cryptography", "ibc", "ibc-derive", "ibc-proto", @@ -3310,7 +3051,7 @@ dependencies = [ name = "namada_ethereum_bridge" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "ethers", "eyre", @@ -3340,7 +3081,7 @@ dependencies = [ name = "namada_proof_of_stake" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "data-encoding", "derivative", "namada_core", @@ -3356,7 +3097,7 @@ version = "0.25.0" dependencies = [ "async-trait", "bimap", - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "circular-queue", "data-encoding", @@ -3398,7 +3139,7 @@ dependencies = [ name = "namada_test_utils" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "namada_core", "strum", ] @@ -3439,7 +3180,7 @@ dependencies = [ name = "namada_tx_prelude" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "masp_primitives", "namada_core", @@ -3454,7 +3195,7 @@ dependencies = [ name = "namada_vm_env" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "masp_primitives", "namada_core", ] @@ -3463,7 +3204,7 @@ dependencies = [ name = "namada_vp_prelude" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "borsh-ext", "namada_core", "namada_macros", @@ -3477,7 +3218,7 @@ dependencies = [ name = "namada_wasm_for_tests" version = "0.25.0" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "getrandom 0.2.10", "namada_test_utils", "namada_tests", @@ -3675,7 +3416,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.38", @@ -3810,7 +3551,7 @@ version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -4080,15 +3821,6 @@ dependencies = [ "uint", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml 0.5.11", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -4783,7 +4515,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -4813,7 +4545,7 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -5104,12 +4836,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" @@ -5171,7 +4897,7 @@ name = "sparse-merkle-tree" version = "0.3.1-pre" source = "git+https://github.com/heliaxdev/sparse-merkle-tree?rev=aed81070ce2c83a41e1c6bada757347f33ef8eb6#aed81070ce2c83a41e1c6bada757347f33ef8eb6" dependencies = [ - "borsh 1.0.0-alpha.4", + "borsh", "cfg-if 1.0.0", "ics23", "sha2 0.9.9", @@ -5239,19 +4965,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "subproductdomain" -version = "0.1.0" -source = "git+https://github.com/anoma/ferveo?rev=e5abd0acc938da90140351a65a26472eb495ce4d#e5abd0acc938da90140351a65a26472eb495ce4d" -dependencies = [ - "anyhow", - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", -] - [[package]] name = "subtle" version = "1.0.0" @@ -5367,7 +5080,7 @@ checksum = "bc2294fa667c8b548ee27a9ba59115472d0a09c2ba255771092a7f1dcf03a789" dependencies = [ "bytes", "digest 0.10.6", - "ed25519 2.2.3", + "ed25519", "ed25519-consensus 2.1.0", "flex-error", "futures", @@ -5380,7 +5093,7 @@ dependencies = [ "serde_json", "serde_repr", "sha2 0.10.6", - "signature 2.1.0", + "signature", "subtle 2.4.1", "subtle-encoding", "tendermint-proto",