diff --git a/Cargo.lock b/Cargo.lock index d558f6deba..174dde7645 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,13 +4,19 @@ version = 3 [[package]] name = "addr2line" -version = "0.24.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "adler2" version = "2.0.0" @@ -64,9 +70,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android-tzdata" @@ -91,9 +97,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -106,49 +112,49 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" -version = "1.4.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" dependencies = [ "derive_arbitrary", ] @@ -161,9 +167,9 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayref" -version = "0.3.9" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" @@ -190,9 +196,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.6" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", @@ -201,13 +207,13 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.6" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -218,7 +224,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -229,9 +235,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.4.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" @@ -260,7 +266,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "tokio", "tower", "tower-layer", @@ -270,9 +276,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", @@ -283,7 +289,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", "tracing", @@ -291,20 +297,21 @@ dependencies = [ [[package]] name = "axum-macros" -version = "0.4.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" +checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" dependencies = [ + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "backon" -version = "1.3.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5289ec98f68f28dd809fd601059e6aa908bb8f6108620930828283d4ee23d7" +checksum = "e4fa97bb310c33c811334143cf64c5bb2b7b3c06e453db6b095d7061eff8f113" dependencies = [ "fastrand", "gloo-timers", @@ -313,19 +320,25 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.74" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", + "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", - "windows-targets 0.52.6", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -394,15 +407,15 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.89", + "syn 2.0.75", "which", ] [[package]] name = "bindgen" -version = "0.69.5" +version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ "bitflags 2.6.0", "cexpr", @@ -415,7 +428,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -425,7 +438,7 @@ source = "git+https://github.com/dashpay/rs-bip37-bloom-filter?branch=develop#35 dependencies = [ "bitvec", "murmur3", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -445,9 +458,9 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitcoin-io" -version = "0.1.3" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf" +checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" [[package]] name = "bitcoin_hashes" @@ -493,7 +506,7 @@ dependencies = [ "arrayvec", "cc", "cfg-if", - "constant_time_eq 0.3.1", + "constant_time_eq 0.3.0", ] [[package]] @@ -502,7 +515,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -526,11 +539,68 @@ dependencies = [ "serde", ] +[[package]] +name = "blsful" +version = "3.0.0-pre6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9de4566ea9f21109f6b3f11551b591ff22683ff47c3a30d97e2feb23257427" +dependencies = [ + "anyhow", + "arrayref", + "blstrs_plus", + "hex", + "hkdf", + "merlin", + "pairing", + "rand", + "rand_chacha", + "rand_core", + "serde", + "serde_bare", + "sha2", + "sha3", + "subtle", + "thiserror", + "uint-zigzag", + "vsss-rs", + "zeroize", +] + +[[package]] +name = "blst" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62dc83a094a71d43eeadd254b1ec2d24cb6a0bb6cadce00df51f0db594711a32" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "blstrs_plus" +version = "0.8.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a16dd4b0d6b4538e1fa0388843acb186363082713a8fc8416d802a04d013818" +dependencies = [ + "arrayref", + "blst", + "elliptic-curve", + "ff", + "group", + "pairing", + "rand_core", + "serde", + "subtle", + "zeroize", +] + [[package]] name = "borsh" -version = "1.5.3" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" dependencies = [ "borsh-derive", "cfg_aliases", @@ -538,15 +608,16 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.3" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" dependencies = [ "once_cell", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", + "syn_derive", ] [[package]] @@ -600,9 +671,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" dependencies = [ "serde", ] @@ -636,9 +707,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.1" +version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" dependencies = [ "jobserver", "libc", @@ -762,9 +833,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -772,9 +843,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -784,27 +855,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "colored" @@ -827,9 +898,9 @@ dependencies = [ [[package]] name = "console-api" -version = "0.8.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8030735ecb0d128428b64cd379809817e620a40e5001c54465b99ec5feec2857" +checksum = "86ed14aa9c9f927213c6e4f3ef75faaad3406134efe84ba2cb7983431d5f0931" dependencies = [ "futures-core", "prost", @@ -840,9 +911,9 @@ dependencies = [ [[package]] name = "console-subscriber" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6539aa9c6a4cd31f4b1c040f860a1eac9aa80e7df6b05d506a6e7179936d6a01" +checksum = "e2e3a111a37f3333946ebf9da370ba5c5577b18eb342ec683eb488dd21980302" dependencies = [ "console-api", "crossbeam-channel", @@ -878,9 +949,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "convert_case" @@ -898,27 +969,26 @@ dependencies = [ "libc", ] -[[package]] -name = "core-foundation" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" -version = "0.2.16" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -1008,13 +1078,26 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array 0.14.7", + "rand_core", + "serdect", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array", + "generic-array 0.14.7", "typenum", ] @@ -1042,7 +1125,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1066,9 +1149,9 @@ name = "dapi-grpc-macros" version = "1.6.0-dev.2" dependencies = [ "dapi-grpc", - "heck", + "heck 0.5.0", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1092,7 +1175,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1103,7 +1186,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1137,7 +1220,7 @@ dependencies = [ "serde", "serde_json", "test-case", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-test", "tokio-util", @@ -1148,14 +1231,14 @@ dependencies = [ [[package]] name = "dashcore" -version = "0.32.0" -source = "git+https://github.com/dashpay/rust-dashcore?tag=0.32.0#6a0ec164ca1bdcb8d19b29f40e946120e99473eb" +version = "0.33.1" +source = "git+https://github.com/dashpay/rust-dashcore?tag=0.33.1#eb700aeff1610188414d0250254d0a6daaa4db46" dependencies = [ "anyhow", "bech32", "bitflags 2.6.0", - "bls-signatures", - "dashcore-private", + "blsful", + "dashcore-private 0.1.0 (git+https://github.com/dashpay/rust-dashcore?tag=0.33.1)", "dashcore_hashes", "ed25519-dalek", "hex", @@ -1173,12 +1256,17 @@ name = "dashcore-private" version = "0.1.0" source = "git+https://github.com/dashpay/rust-dashcore?tag=0.32.0#6a0ec164ca1bdcb8d19b29f40e946120e99473eb" +[[package]] +name = "dashcore-private" +version = "0.1.0" +source = "git+https://github.com/dashpay/rust-dashcore?tag=0.33.1#eb700aeff1610188414d0250254d0a6daaa4db46" + [[package]] name = "dashcore-rpc" -version = "0.15.8" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.8#4d4d5b1488daa7f083d254a1f5acf03b550d5b10" +version = "0.15.9" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.9#dcfa6b34da596c52093ed6a1f26f15bcf2196c0d" dependencies = [ - "dashcore-private", + "dashcore-private 0.1.0 (git+https://github.com/dashpay/rust-dashcore?tag=0.32.0)", "dashcore-rpc-json", "env_logger 0.10.2", "hex", @@ -1190,8 +1278,8 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" -version = "0.15.8" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.8#4d4d5b1488daa7f083d254a1f5acf03b550d5b10" +version = "0.15.9" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.9#dcfa6b34da596c52093ed6a1f26f15bcf2196c0d" dependencies = [ "bincode", "dashcore", @@ -1205,9 +1293,9 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.14.0" -source = "git+https://github.com/dashpay/rust-dashcore?tag=0.32.0#6a0ec164ca1bdcb8d19b29f40e946120e99473eb" +source = "git+https://github.com/dashpay/rust-dashcore?tag=0.33.1#eb700aeff1610188414d0250254d0a6daaa4db46" dependencies = [ - "dashcore-private", + "dashcore-private 0.1.0 (git+https://github.com/dashpay/rust-dashcore?tag=0.33.1)", "secp256k1", "serde", ] @@ -1219,7 +1307,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1233,20 +1321,20 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror 1.0.69", + "thiserror", "wallet-utils-contract", "withdrawals-contract", ] [[package]] name = "delegate" -version = "0.13.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc2323e10c92e1cf4d86e11538512e6dc03ceb586842970b6332af3d4046a046" +checksum = "5060bb0febb73fa907273f8a7ed17ab4bf831d585eac835b28ec24a1e2460956" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1271,13 +1359,13 @@ dependencies = [ [[package]] name = "derive_arbitrary" -version = "1.4.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1290,7 +1378,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1310,7 +1398,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", "unicode-xid", ] @@ -1339,7 +1427,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1361,7 +1449,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1410,7 +1498,7 @@ dependencies = [ "sha2", "strum", "test-case", - "thiserror 1.0.69", + "thiserror", "tokio", ] @@ -1451,7 +1539,7 @@ dependencies = [ "serde_json", "sqlparser", "tempfile", - "thiserror 1.0.69", + "thiserror", "tracing", ] @@ -1464,6 +1552,7 @@ dependencies = [ "async-trait", "base64 0.22.1", "bincode", + "bls-signatures", "bs58", "chrono", "ciborium 0.2.0", @@ -1501,7 +1590,7 @@ dependencies = [ "strategy-tests", "tempfile", "tenderdash-abci", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-util", "tracing", @@ -1525,7 +1614,7 @@ dependencies = [ "serde", "serde_json", "tenderdash-abci", - "thiserror 1.0.69", + "thiserror", "tracing", ] @@ -1536,7 +1625,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9c8d6ea916fadcd87e3d1ff4802b696d717c83519b47e76f267ab77e536dd5a" dependencies = [ "ed-derive", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1581,11 +1670,46 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array 0.14.7", + "group", + "hkdf", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "tap", + "zeroize", +] + +[[package]] +name = "elliptic-curve-tools" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48843edfbd0a370b3dd14cdbb4e446e9a8855311e6b2b57bf9a1fd1367bc317" +dependencies = [ + "elliptic-curve", + "heapless", + "hex", + "multiexp", + "serde", + "zeroize", +] + [[package]] name = "encoding_rs" -version = "0.8.35" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -1607,7 +1731,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -1711,7 +1835,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure 0.12.6", + "synstructure", ] [[package]] @@ -1721,15 +1845,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" dependencies = [ "bit-set", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] name = "fastrand" -version = "2.2.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "feature-flags-contract" @@ -1738,7 +1862,18 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror 1.0.69", + "thiserror", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "bitvec", + "rand_core", + "subtle", ] [[package]] @@ -1765,12 +1900,12 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.35" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" +checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -1788,12 +1923,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foldhash" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" - [[package]] name = "foreign-types" version = "0.3.2" @@ -1848,9 +1977,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1863,9 +1992,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1873,15 +2002,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1890,38 +2019,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1943,6 +2072,17 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "generic-array" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96512db27971c2c3eece70a1e106fbe6c87760234e31e8f7e5634912fe52794a" +dependencies = [ + "serde", + "typenum", ] [[package]] @@ -1960,9 +2100,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -1982,6 +2122,19 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand", + "rand_core", + "rand_xorshift", + "subtle", +] + [[package]] name = "grovedb" version = "2.1.0" @@ -2010,7 +2163,7 @@ dependencies = [ "reqwest", "sha2", "tempfile", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-util", "tower-http", @@ -2025,7 +2178,7 @@ checksum = "360f7c8d3b20beafcbf3cde8754bbcfd201ae2a30ec7594a4b9678fd2fa3c7a8" dependencies = [ "integer-encoding", "intmap", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -2038,7 +2191,7 @@ dependencies = [ "hex", "integer-encoding", "intmap", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -2063,7 +2216,7 @@ dependencies = [ "integer-encoding", "num_cpus", "rand", - "thiserror 1.0.69", + "thiserror", "time", ] @@ -2090,7 +2243,7 @@ dependencies = [ "rocksdb", "strum", "tempfile", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -2099,7 +2252,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4be0c1a1ef97068fe93212e7b6f349e0b44a9fc90063c8c28e110cfb8c2fcb2" dependencies = [ - "thiserror 1.0.69", + "thiserror", "versioned-feature-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2120,14 +2273,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "921b9a29facf9d3f0de667cd1da083a34695ede9e7bfacd74bb5bd29f8f7c178" dependencies = [ "serde", - "serde_with 3.11.0", + "serde_with 3.9.0", ] [[package]] name = "h2" -version = "0.4.7" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -2158,6 +2311,15 @@ dependencies = [ "crunchy", ] +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -2174,18 +2336,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash 0.8.11", + "allocator-api2", ] [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" [[package]] name = "hdrhistogram" @@ -2200,6 +2358,22 @@ dependencies = [ "num-traits", ] +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "heck" version = "0.5.0" @@ -2248,6 +2422,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + [[package]] name = "hmac" version = "0.12.1" @@ -2318,9 +2501,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.5" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -2336,9 +2519,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.5.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -2357,9 +2540,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", "http", @@ -2374,9 +2557,9 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ "hyper", "hyper-util", @@ -2403,9 +2586,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.10" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ "bytes", "futures-channel", @@ -2416,6 +2599,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", + "tower", "tower-service", "tracing", ] @@ -2443,124 +2627,6 @@ dependencies = [ "cc", ] -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -2569,23 +2635,12 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "icu_normalizer", - "icu_properties", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -2606,7 +2661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown 0.15.0", "serde", ] @@ -2616,7 +2671,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -2636,9 +2691,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" @@ -2695,9 +2750,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.13" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" @@ -2725,7 +2780,7 @@ checksum = "ec9ad60d674508f3ca8f380a928cfe7b096bc729c4e2dbfe3852bc45da3ab30b" dependencies = [ "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -2737,7 +2792,7 @@ dependencies = [ "json-schema-compatibility-validator", "once_cell", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -2778,6 +2833,15 @@ dependencies = [ "uuid", ] +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -2798,9 +2862,9 @@ checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" [[package]] name = "libc" -version = "0.2.164" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" @@ -2818,7 +2882,7 @@ version = "0.16.0+8.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" dependencies = [ - "bindgen 0.69.5", + "bindgen 0.69.4", "bzip2-sys", "cc", "glob", @@ -2830,9 +2894,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.20" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" dependencies = [ "cc", "pkg-config", @@ -2845,12 +2909,6 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "litemap" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" - [[package]] name = "lock_api" version = "0.4.12" @@ -2875,18 +2933,18 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lru" -version = "0.12.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ - "hashbrown 0.15.1", + "hashbrown 0.14.5", ] [[package]] name = "lz4-sys" -version = "1.11.1+lz4-1.10.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" +checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" dependencies = [ "cc", "libc", @@ -2899,7 +2957,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -2923,6 +2981,18 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + [[package]] name = "metrics" version = "0.23.0" @@ -2948,7 +3018,7 @@ dependencies = [ "metrics", "metrics-util", "quanta", - "thiserror 1.0.69", + "thiserror", "tokio", "tracing", ] @@ -2990,6 +3060,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + [[package]] name = "miniz_oxide" version = "0.8.0" @@ -3013,9 +3092,9 @@ dependencies = [ [[package]] name = "mockall" -version = "0.13.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39a6bfcc6c8c7eed5ee98b9c3e33adc726054389233e201c95dab2d41a3839d2" +checksum = "d4c28b3fb6d753d28c20e826cd46ee611fda1cf3cde03a443a974043247c065a" dependencies = [ "cfg-if", "downcast", @@ -3027,14 +3106,14 @@ dependencies = [ [[package]] name = "mockall_derive" -version = "0.13.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ca3004c2efe9011bd4e461bd8256445052b9615405b4f7ea43fc8ca5c20898" +checksum = "341014e7f530314e9a1fdbc7400b244efea7122662c96bfa248c31da5bfb2020" dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -3056,11 +3135,24 @@ dependencies = [ "rustc_version", "smallvec", "tagptr", - "thiserror 1.0.69", + "thiserror", "triomphe", "uuid", ] +[[package]] +name = "multiexp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a383da1ae933078ddb1e4141f1dd617b512b4183779d6977e6451b0e644806" +dependencies = [ + "ff", + "group", + "rustversion", + "std-shims", + "zeroize", +] + [[package]] name = "multimap" version = "0.10.0" @@ -3085,7 +3177,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework 2.11.1", + "security-framework", "security-framework-sys", "tempfile", ] @@ -3138,6 +3230,8 @@ checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", + "rand", + "serde", ] [[package]] @@ -3153,6 +3247,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", + "rand", + "serde", ] [[package]] @@ -3169,7 +3265,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -3201,6 +3297,7 @@ dependencies = [ "num-bigint", "num-integer", "num-traits", + "serde", ] [[package]] @@ -3258,26 +3355,26 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "object" -version = "0.36.5" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" @@ -3287,9 +3384,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "openssl" -version = "0.10.68" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -3308,7 +3405,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -3319,9 +3416,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.104" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -3335,11 +3432,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + [[package]] name = "parking" -version = "2.2.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -3417,29 +3523,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -3459,9 +3565,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platform-serialization" @@ -3477,7 +3583,7 @@ version = "1.6.0-dev.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", "virtue 0.0.17", ] @@ -3498,7 +3604,7 @@ dependencies = [ "regex", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "treediff", ] @@ -3507,7 +3613,7 @@ name = "platform-value-convertible" version = "1.6.0-dev.2" dependencies = [ "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -3517,7 +3623,7 @@ dependencies = [ "bincode", "grovedb-version", "once_cell", - "thiserror 1.0.69", + "thiserror", "versioned-feature-core 1.0.0 (git+https://github.com/dashpay/versioned-feature-core)", ] @@ -3527,7 +3633,7 @@ version = "1.6.0-dev.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -3545,24 +3651,24 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" [[package]] name = "plotters-svg" -version = "0.3.7" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" dependencies = [ "plotters-backend", ] [[package]] name = "portable-atomic" -version = "1.9.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" [[package]] name = "powerfmt" @@ -3617,12 +3723,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -3637,27 +3743,50 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "toml_edit 0.22.22", + "proc-macro2", + "quote", + "version_check", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.13.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" dependencies = [ "bytes", "prost-derive", @@ -3665,12 +3794,12 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.13.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" +checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" dependencies = [ "bytes", - "heck", + "heck 0.5.0", "itertools 0.13.0", "log", "multimap", @@ -3680,28 +3809,28 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.89", + "syn 2.0.75", "tempfile", ] [[package]] name = "prost-derive" -version = "0.13.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" dependencies = [ "anyhow", "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "prost-types" -version = "0.13.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ "prost", ] @@ -3786,11 +3915,20 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + [[package]] name = "raw-cpuid" -version = "11.2.0" +version = "11.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" +checksum = "cb9ee317cfe3fbd54b36a511efc1edd42e216903c9cd575e686dd68a2ba90d8d" dependencies = [ "bitflags 2.6.0", ] @@ -3817,23 +3955,23 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -3847,13 +3985,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax 0.8.4", ] [[package]] @@ -3864,9 +4002,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rend" @@ -3918,7 +4056,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "system-configuration", "tokio", "tokio-native-tls", @@ -3999,7 +4137,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "thiserror 1.0.69", + "thiserror", "tokio", "tracing", ] @@ -4044,18 +4182,18 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.41" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.6.0", "errno", @@ -4066,9 +4204,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.17" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ "log", "once_cell", @@ -4081,36 +4219,38 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" dependencies = [ "openssl-probe", + "rustls-pemfile", "rustls-pki-types", "schannel", - "security-framework 3.0.1", + "security-framework", ] [[package]] name = "rustls-pemfile" -version = "2.2.0" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ + "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.8" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring", "rustls-pki-types", @@ -4119,9 +4259,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" @@ -4150,11 +4290,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.27" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4169,6 +4309,20 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array 0.14.7", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "secp256k1" version = "0.30.0" @@ -4197,20 +4351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" -dependencies = [ - "bitflags 2.6.0", - "core-foundation 0.10.0", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -4218,9 +4359,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.1" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -4234,9 +4375,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] @@ -4251,6 +4392,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "serde_bare" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51c55386eed0f1ae957b091dc2ca8122f287b60c79c774cbe3d5f2b69fded660" +dependencies = [ + "serde", +] + [[package]] name = "serde_bytes" version = "0.11.15" @@ -4262,20 +4412,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "b3b863381a05ffefbc82571a2d893edf47b27fb0ebedbf582c39640e51abebef" dependencies = [ "indexmap 2.6.0", "itoa", @@ -4302,14 +4452,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "serde_spanned" -version = "0.6.8" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -4344,9 +4494,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ "base64 0.22.1", "chrono", @@ -4356,7 +4506,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with_macros 3.11.0", + "serde_with_macros 3.9.0", "time", ] @@ -4369,19 +4519,29 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", +] + +[[package]] +name = "serdect" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +dependencies = [ + "base16ct", + "serde", ] [[package]] @@ -4406,6 +4566,16 @@ dependencies = [ "digest", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -4497,6 +4667,9 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] [[package]] name = "spki" @@ -4523,6 +4696,16 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "std-shims" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90e49360f31b0b75a6a82a5205c6103ea07a79a60808d44f5cc879d303337926" +dependencies = [ + "hashbrown 0.14.5", + "spin", +] + [[package]] name = "strategy-tests" version = "1.6.0-dev.2" @@ -4563,11 +4746,11 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -4598,20 +4781,38 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "sync_wrapper" -version = "1.0.2" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" dependencies = [ "futures-core", ] @@ -4628,17 +4829,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "system-configuration" version = "0.6.1" @@ -4646,7 +4836,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.6.0", - "core-foundation 0.9.4", + "core-foundation", "system-configuration-sys", ] @@ -4674,9 +4864,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.14.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", @@ -4697,7 +4887,7 @@ dependencies = [ "semver", "serde_json", "tenderdash-proto", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-util", "tracing", @@ -4737,7 +4927,7 @@ dependencies = [ "tonic-build", "ureq", "walkdir", - "zip 2.2.1", + "zip 2.2.0", ] [[package]] @@ -4773,7 +4963,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -4784,48 +4974,48 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", "test-case-core", ] [[package]] name = "thiserror" -version = "1.0.69" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ - "thiserror-impl 1.0.69", + "thiserror-impl", ] [[package]] -name = "thiserror" -version = "2.0.3" +name = "thiserror-impl" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ - "thiserror-impl 2.0.3", + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] -name = "thiserror-impl" -version = "1.0.69" +name = "thiserror-impl-no-std" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 1.0.109", ] [[package]] -name = "thiserror-impl" -version = "2.0.3" +name = "thiserror-no-std" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", + "thiserror-impl-no-std", ] [[package]] @@ -4838,6 +5028,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.3.36" @@ -4869,16 +5068,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tinystr" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" -dependencies = [ - "displaydoc", - "zerovec", -] - [[package]] name = "tinytemplate" version = "1.2.1" @@ -4906,9 +5095,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.1" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -4931,7 +5120,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -5001,7 +5190,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.22", + "toml_edit 0.22.20", ] [[package]] @@ -5026,15 +5215,26 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap 2.6.0", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.20", + "winnow 0.6.18", ] [[package]] @@ -5082,7 +5282,7 @@ dependencies = [ "prost-build", "prost-types", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -5159,7 +5359,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -5238,23 +5438,50 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "uint-zigzag" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abbf77aed65cb885a8ba07138c365879be3d9a93dce82bf6cc50feca9138ec15" +dependencies = [ + "core2", +] + [[package]] name = "unicase" -version = "2.8.0" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] [[package]] name = "unicode-xid" -version = "0.2.6" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "untrusted" @@ -5280,27 +5507,15 @@ dependencies = [ [[package]] name = "url" -version = "2.5.3" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -5309,9 +5524,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.11.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", "rand", @@ -5358,6 +5573,26 @@ version = "0.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7302ac74a033bf17b6e609ceec0f891ca9200d502d31f02dc7908d3d98767c9d" +[[package]] +name = "vsss-rs" +version = "5.0.0-rc1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9860fb75908021ae4cc125917c9763134f7f236a716d181ed644627783230c5d" +dependencies = [ + "crypto-bigint", + "elliptic-curve", + "elliptic-curve-tools", + "generic-array 1.1.0", + "hex", + "num", + "rand_core", + "serde", + "sha3", + "subtle", + "thiserror-no-std", + "zeroize", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -5375,7 +5610,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -5414,7 +5649,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -5448,7 +5683,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5476,7 +5711,7 @@ dependencies = [ "serde", "serde-wasm-bindgen", "serde_json", - "thiserror 1.0.69", + "thiserror", "wasm-bindgen", "wasm-bindgen-futures", "wasm-logger", @@ -5506,9 +5741,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.7" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" dependencies = [ "rustls-pki-types", ] @@ -5754,9 +5989,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -5771,21 +6006,9 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "thiserror 1.0.69", + "thiserror", ] -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - [[package]] name = "wyz" version = "0.5.1" @@ -5801,30 +6024,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -[[package]] -name = "yoke" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", - "synstructure 0.13.1", -] - [[package]] name = "zerocopy" version = "0.7.35" @@ -5843,28 +6042,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", -] - -[[package]] -name = "zerofrom" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", - "synstructure 0.13.1", + "syn 2.0.75", ] [[package]] @@ -5885,29 +6063,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", -] - -[[package]] -name = "zerovec" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", + "syn 2.0.75", ] [[package]] @@ -5932,9 +6088,9 @@ dependencies = [ [[package]] name = "zip" -version = "2.2.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d52293fc86ea7cf13971b3bb81eb21683636e7ae24c729cdaf1b7c4157a352" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" dependencies = [ "arbitrary", "crc32fast", @@ -5943,7 +6099,7 @@ dependencies = [ "flate2", "indexmap 2.6.0", "memchr", - "thiserror 2.0.3", + "thiserror", "zopfli", ] diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 286456cfb4..5a6e11867b 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -28,9 +28,7 @@ dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [ "rand", "signer", "serde", - "bls", - "eddsa", -], default-features = false, tag = "0.32.0" } +], default-features = false, tag = "0.33.1" } env_logger = { version = "0.11" } getrandom = { version = "0.2", features = ["js"] } hex = { version = "0.4" } diff --git a/packages/rs-dpp/src/bls/native_bls.rs b/packages/rs-dpp/src/bls/native_bls.rs index 5dc7e2bc82..492f563511 100644 --- a/packages/rs-dpp/src/bls/native_bls.rs +++ b/packages/rs-dpp/src/bls/native_bls.rs @@ -1,12 +1,14 @@ +use crate::bls_signatures::{ + Bls12381G2Impl, Pairing, PublicKey, SecretKey, Signature, SignatureSchemes, +}; use crate::{BlsModule, ProtocolError, PublicKeyValidationError}; -use anyhow::anyhow; -use dashcore::bls_signatures::{self, PrivateKey, PublicKey}; +use std::array::TryFromSliceError; #[derive(Default)] pub struct NativeBlsModule; impl BlsModule for NativeBlsModule { fn validate_public_key(&self, pk: &[u8]) -> Result<(), PublicKeyValidationError> { - match PublicKey::from_bytes(pk) { + match PublicKey::::try_from(pk) { Ok(_) => Ok(()), Err(e) => Err(PublicKeyValidationError::new(e.to_string())), } @@ -18,31 +20,61 @@ impl BlsModule for NativeBlsModule { data: &[u8], public_key: &[u8], ) -> Result { - let public_key = PublicKey::from_bytes(public_key).map_err(anyhow::Error::msg)?; - let signature = - bls_signatures::Signature::from_bytes(signature).map_err(anyhow::Error::msg)?; - match public_key.verify(&signature, data) { - true => Ok(true), - // TODO change to specific error type - false => Err(anyhow!("Verification failed").into()), + let public_key = PublicKey::::try_from(public_key)?; + let signature_96_bytes = + signature + .try_into() + .map_err(|_| ProtocolError::BlsSignatureSizeError { + got: signature.len() as u32, + })?; + let Some(g2_element) = + ::Signature::from_compressed(&signature_96_bytes) + .into_option() + else { + return Ok(false); // We should not error because the signature could be given by an invalid source + }; + + let signature = Signature::Basic(g2_element); + + match signature.verify(&public_key, data) { + Ok(_) => Ok(true), + Err(_) => Ok(false), } } fn private_key_to_public_key(&self, private_key: &[u8]) -> Result, ProtocolError> { - let fixed_len_key: [u8; 32] = private_key - .try_into() - .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; - let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; - let public_key = pk.g1_element().map_err(anyhow::Error::msg)?; - let public_key_bytes = public_key.to_bytes().to_vec(); + let fixed_len_key: [u8; 32] = + private_key + .try_into() + .map_err(|_| ProtocolError::PrivateKeySizeError { + got: private_key.len() as u32, + })?; + let pk = SecretKey::::from_be_bytes(&fixed_len_key) + .into_option() + .ok_or(ProtocolError::InvalidBLSPrivateKeyError( + "key not valid".to_string(), + ))?; + let public_key = pk.public_key(); + let public_key_bytes = public_key.0.to_compressed().to_vec(); Ok(public_key_bytes) } fn sign(&self, data: &[u8], private_key: &[u8]) -> Result, ProtocolError> { - let fixed_len_key: [u8; 32] = private_key - .try_into() - .map_err(|_| anyhow!("the BLS private key must be 32 bytes long"))?; - let pk = PrivateKey::from_bytes(&fixed_len_key, false).map_err(anyhow::Error::msg)?; - Ok(pk.sign(data).to_bytes().to_vec()) + let fixed_len_key: [u8; 32] = + private_key + .try_into() + .map_err(|_| ProtocolError::PrivateKeySizeError { + got: private_key.len() as u32, + })?; + let pk = SecretKey::::from_be_bytes(&fixed_len_key) + .into_option() + .ok_or(ProtocolError::InvalidBLSPrivateKeyError( + "key not valid".to_string(), + ))?; + Ok(pk + .sign(SignatureSchemes::Basic, data)? + .as_raw_value() + .to_compressed() + .to_vec()) } } diff --git a/packages/rs-dpp/src/core_types/validator/mod.rs b/packages/rs-dpp/src/core_types/validator/mod.rs index 2261bac56f..01716ab044 100644 --- a/packages/rs-dpp/src/core_types/validator/mod.rs +++ b/packages/rs-dpp/src/core_types/validator/mod.rs @@ -1,4 +1,4 @@ -use crate::bls_signatures::PublicKey as BlsPublicKey; +use crate::bls_signatures::{Bls12381G2Impl, PublicKey as BlsPublicKey}; use crate::core_types::validator::v0::{ValidatorV0, ValidatorV0Getters, ValidatorV0Setters}; use dashcore::{ProTxHash, PubkeyHash}; #[cfg(feature = "core-types-serde-conversion")] @@ -25,7 +25,7 @@ impl ValidatorV0Getters for Validator { } } - fn public_key(&self) -> &Option { + fn public_key(&self) -> &Option> { match self { Validator::V0(v0) => v0.public_key(), } @@ -75,7 +75,7 @@ impl ValidatorV0Setters for Validator { } } - fn set_public_key(&mut self, public_key: Option) { + fn set_public_key(&mut self, public_key: Option>) { match self { Validator::V0(v0) => v0.set_public_key(public_key), } diff --git a/packages/rs-dpp/src/core_types/validator/v0/mod.rs b/packages/rs-dpp/src/core_types/validator/v0/mod.rs index b427431a04..fe45fe675d 100644 --- a/packages/rs-dpp/src/core_types/validator/v0/mod.rs +++ b/packages/rs-dpp/src/core_types/validator/v0/mod.rs @@ -1,7 +1,7 @@ use dashcore::{ProTxHash, PubkeyHash}; use std::fmt::{Debug, Formatter}; -use crate::bls_signatures::PublicKey as BlsPublicKey; +use crate::bls_signatures::{Bls12381G2Impl, PublicKey as BlsPublicKey}; #[cfg(feature = "core-types-serde-conversion")] use serde::{Deserialize, Serialize}; @@ -26,7 +26,7 @@ pub struct ValidatorV0 { /// The proTxHash pub pro_tx_hash: ProTxHash, /// The public key share of this validator for this quorum - pub public_key: Option, + pub public_key: Option>, /// The node address pub node_ip: String, /// The node id @@ -54,7 +54,7 @@ impl Encode for ValidatorV0 { match &self.public_key { Some(public_key) => { true.encode(encoder)?; // Indicate that public_key is present - public_key.to_bytes().encode(encoder)?; + public_key.0.to_compressed().encode(encoder)?; } None => { false.encode(encoder)?; // Indicate that public_key is not present @@ -94,9 +94,12 @@ impl Decode for ValidatorV0 { let has_public_key = bool::decode(decoder)?; let public_key = if has_public_key { let public_key_bytes = <[u8; 48]>::decode(decoder)?; - Some(BlsPublicKey::from_bytes(&public_key_bytes).map_err(|_| { - DecodeError::OtherString("Failed to decode BlsPublicKey".to_string()) - })?) + + Some( + BlsPublicKey::try_from(public_key_bytes.as_slice()).map_err(|_| { + DecodeError::OtherString("Failed to decode BlsPublicKey".to_string()) + })?, + ) } else { None }; @@ -150,7 +153,7 @@ pub trait ValidatorV0Getters { /// Returns the proTxHash of the validator. fn pro_tx_hash(&self) -> &ProTxHash; /// Returns the public key share of this validator for this quorum. - fn public_key(&self) -> &Option; + fn public_key(&self) -> &Option>; /// Returns the node address of the validator. fn node_ip(&self) -> &String; /// Returns the node id of the validator. @@ -170,7 +173,7 @@ pub trait ValidatorV0Setters { /// Sets the proTxHash of the validator. fn set_pro_tx_hash(&mut self, pro_tx_hash: ProTxHash); /// Sets the public key share of this validator for this quorum. - fn set_public_key(&mut self, public_key: Option); + fn set_public_key(&mut self, public_key: Option>); /// Sets the node address of the validator. fn set_node_ip(&mut self, node_ip: String); /// Sets the node id of the validator. @@ -190,7 +193,7 @@ impl ValidatorV0Getters for ValidatorV0 { &self.pro_tx_hash } - fn public_key(&self) -> &Option { + fn public_key(&self) -> &Option> { &self.public_key } @@ -224,7 +227,7 @@ impl ValidatorV0Setters for ValidatorV0 { self.pro_tx_hash = pro_tx_hash; } - fn set_public_key(&mut self, public_key: Option) { + fn set_public_key(&mut self, public_key: Option>) { self.public_key = public_key; } @@ -257,12 +260,16 @@ impl ValidatorV0Setters for ValidatorV0 { mod tests { use super::*; use bincode::config; + use dashcore::blsful::SecretKey; + use rand::prelude::StdRng; + use rand::SeedableRng; #[test] fn test_serialize_deserialize_validator_v0() { // Sample data for testing let pro_tx_hash = ProTxHash::from_slice(&[1; 32]).unwrap(); - let public_key = Some(BlsPublicKey::generate()); + let mut rng = StdRng::seed_from_u64(0); + let public_key = Some(SecretKey::::random(&mut rng).public_key()); let node_ip = "127.0.0.1".to_string(); let node_id = PubkeyHash::from_slice(&[3; 20]).unwrap(); let core_port = 9999; diff --git a/packages/rs-dpp/src/core_types/validator_set/mod.rs b/packages/rs-dpp/src/core_types/validator_set/mod.rs index 74b78fca05..0d56edbc6c 100644 --- a/packages/rs-dpp/src/core_types/validator_set/mod.rs +++ b/packages/rs-dpp/src/core_types/validator_set/mod.rs @@ -1,4 +1,4 @@ -use crate::bls_signatures::PublicKey as BlsPublicKey; +use crate::bls_signatures::{Bls12381G2Impl, PublicKey as BlsPublicKey}; use crate::core_types::validator::v0::ValidatorV0; use crate::core_types::validator_set::v0::{ ValidatorSetV0, ValidatorSetV0Getters, ValidatorSetV0Setters, @@ -80,7 +80,7 @@ impl ValidatorSetV0Getters for ValidatorSet { } } - fn threshold_public_key(&self) -> &BlsPublicKey { + fn threshold_public_key(&self) -> &BlsPublicKey { match self { ValidatorSet::V0(v0) => v0.threshold_public_key(), } @@ -112,7 +112,7 @@ impl ValidatorSetV0Setters for ValidatorSet { } } - fn set_threshold_public_key(&mut self, threshold_public_key: BlsPublicKey) { + fn set_threshold_public_key(&mut self, threshold_public_key: BlsPublicKey) { match self { ValidatorSet::V0(v0) => v0.set_threshold_public_key(threshold_public_key), } diff --git a/packages/rs-dpp/src/core_types/validator_set/v0/mod.rs b/packages/rs-dpp/src/core_types/validator_set/v0/mod.rs index dba9180e24..4789d53dd6 100644 --- a/packages/rs-dpp/src/core_types/validator_set/v0/mod.rs +++ b/packages/rs-dpp/src/core_types/validator_set/v0/mod.rs @@ -8,6 +8,7 @@ use bincode::enc::Encoder; use bincode::error::EncodeError; #[cfg(feature = "core-types-serialization")] use bincode::{BorrowDecode, Decode, Encode}; +use dashcore::blsful::Bls12381G2Impl; use dashcore::hashes::Hash; use dashcore::{ProTxHash, QuorumHash}; use itertools::Itertools; @@ -34,7 +35,7 @@ pub struct ValidatorSetV0 { /// The list of masternodes pub members: BTreeMap, /// The threshold quorum public key - pub threshold_public_key: BlsPublicKey, + pub threshold_public_key: BlsPublicKey, } impl Display for ValidatorSetV0 { @@ -61,7 +62,7 @@ impl Display for ValidatorSetV0 { pro_tx_hash, validator.node_ip )) .join(", "), - hex::encode(self.threshold_public_key.to_bytes().as_slice()) // Assuming BlsPublicKey is a byte array + hex::encode(self.threshold_public_key.0.to_compressed()) // Assuming BlsPublicKey is a byte array ) } } @@ -85,7 +86,7 @@ impl Encode for ValidatorSetV0 { // Custom encoding for BlsPublicKey if needed // Assuming BlsPublicKey can be serialized to a byte slice - let public_key_bytes = *self.threshold_public_key.to_bytes(); + let public_key_bytes = self.threshold_public_key.0.to_compressed(); public_key_bytes.encode(encoder)?; Ok(()) @@ -118,9 +119,13 @@ impl Decode for ValidatorSetV0 { let mut public_key_bytes = [0u8; 48]; let bytes = <[u8; 48]>::decode(decoder)?; public_key_bytes.copy_from_slice(&bytes); - let threshold_public_key = BlsPublicKey::from_bytes(&public_key_bytes).map_err(|_| { - bincode::error::DecodeError::OtherString("Failed to decode BlsPublicKey".to_string()) - })?; + let threshold_public_key = + BlsPublicKey::try_from(public_key_bytes.as_slice()).map_err(|e| { + bincode::error::DecodeError::OtherString(format!( + "Failed to decode BlsPublicKey: {}", + e + )) + })?; Ok(ValidatorSetV0 { quorum_hash: QuorumHash::from_byte_array(quorum_hash), @@ -162,11 +167,13 @@ impl<'de> BorrowDecode<'de> for ValidatorSetV0 { let mut public_key_bytes = [0u8; 48]; let bytes = <[u8; 48]>::decode(decoder)?; public_key_bytes.copy_from_slice(&bytes); - let threshold_public_key = BlsPublicKey::from_bytes(&public_key_bytes).map_err(|_| { - bincode::error::DecodeError::OtherString( - "Failed to decode BlsPublicKey in borrow decode".to_string(), - ) - })?; + let threshold_public_key = + BlsPublicKey::try_from(public_key_bytes.as_slice()).map_err(|e| { + bincode::error::DecodeError::OtherString(format!( + "Failed to decode BlsPublicKey in borrow decode: {}", + e + )) + })?; Ok(ValidatorSetV0 { quorum_hash: QuorumHash::from_byte_array(quorum_hash), @@ -211,7 +218,7 @@ pub trait ValidatorSetV0Getters { /// Returns the members of the validator set. fn members_owned(self) -> BTreeMap; /// Returns the threshold public key of the validator set. - fn threshold_public_key(&self) -> &BlsPublicKey; + fn threshold_public_key(&self) -> &BlsPublicKey; } /// Trait providing setter methods for `ValidatorSetV0` struct @@ -225,7 +232,7 @@ pub trait ValidatorSetV0Setters { /// Sets the members of the validator set. fn set_members(&mut self, members: BTreeMap); /// Sets the threshold public key of the validator set. - fn set_threshold_public_key(&mut self, threshold_public_key: BlsPublicKey); + fn set_threshold_public_key(&mut self, threshold_public_key: BlsPublicKey); } impl ValidatorSetV0Getters for ValidatorSetV0 { @@ -253,7 +260,7 @@ impl ValidatorSetV0Getters for ValidatorSetV0 { self.members } - fn threshold_public_key(&self) -> &BlsPublicKey { + fn threshold_public_key(&self) -> &BlsPublicKey { &self.threshold_public_key } } @@ -275,7 +282,7 @@ impl ValidatorSetV0Setters for ValidatorSetV0 { self.members = members; } - fn set_threshold_public_key(&mut self, threshold_public_key: BlsPublicKey) { + fn set_threshold_public_key(&mut self, threshold_public_key: BlsPublicKey) { self.threshold_public_key = threshold_public_key; } } @@ -284,7 +291,10 @@ impl ValidatorSetV0Setters for ValidatorSetV0 { mod tests { use super::*; use bincode::config; + use dashcore::blsful::SecretKey; use dashcore::PubkeyHash; + use rand::rngs::StdRng; + use rand::SeedableRng; use std::collections::BTreeMap; #[test] @@ -296,7 +306,8 @@ mod tests { // Create a sample ProTxHash and ValidatorV0 instance let pro_tx_hash = ProTxHash::from_slice(&[2; 32]).unwrap(); - let public_key = Some(BlsPublicKey::generate()); + let mut rng = StdRng::seed_from_u64(0); + let public_key = Some(SecretKey::::random(&mut rng).public_key()); let node_ip = "192.168.1.1".to_string(); let node_id = PubkeyHash::from_slice(&[4; 20]).unwrap(); let validator = ValidatorV0 { @@ -315,7 +326,7 @@ mod tests { members.insert(pro_tx_hash, validator); // Create a sample threshold public key - let threshold_public_key = BlsPublicKey::generate(); + let threshold_public_key = SecretKey::::random(&mut rng).public_key(); // Create the ValidatorSetV0 instance let validator_set = ValidatorSetV0 { diff --git a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs index 8d72de7772..49403c9164 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs @@ -18,7 +18,7 @@ use bincode::{Decode, Encode}; PlatformSerialize, PlatformDeserialize, )] -#[error("Instant lock proof signature is invalid or wasn't created recently. Pleases try chain asset lock proof instead.")] +#[error("Instant lock proof signature is invalid or wasn't created recently. Please try chain asset lock proof instead.")] #[platform_serialize(unversioned)] pub struct InvalidInstantAssetLockProofSignatureError; diff --git a/packages/rs-dpp/src/errors/protocol_error.rs b/packages/rs-dpp/src/errors/protocol_error.rs index 2164b339f1..1ed9888821 100644 --- a/packages/rs-dpp/src/errors/protocol_error.rs +++ b/packages/rs-dpp/src/errors/protocol_error.rs @@ -1,3 +1,4 @@ +use std::array::TryFromSliceError; use thiserror::Error; use crate::consensus::basic::state_transition::InvalidStateTransitionTypeError; @@ -247,6 +248,20 @@ pub enum ProtocolError { /// Invalid CBOR error #[error("invalid cbor error: {0}")] InvalidCBOR(String), + + /// BLS signature error + #[cfg(feature = "bls-signatures")] + #[error(transparent)] + BlsError(#[from] dashcore::blsful::BlsError), + + #[error("Private key wrong size: expected 32, got {got}")] + PrivateKeySizeError { got: u32 }, + + #[error("Private key invalid error: {0}")] + InvalidBLSPrivateKeyError(String), + + #[error("Signature wrong size: expected 96, got {got}")] + BlsSignatureSizeError { got: u32 }, } impl From<&str> for ProtocolError { diff --git a/packages/rs-dpp/src/identity/identity_public_key/key_type.rs b/packages/rs-dpp/src/identity/identity_public_key/key_type.rs index e40437a33e..e87df348bb 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/key_type.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/key_type.rs @@ -8,13 +8,15 @@ use dashcore::secp256k1::rand::rngs::StdRng as EcdsaRng; #[cfg(feature = "random-public-keys")] use dashcore::secp256k1::rand::SeedableRng; use dashcore::secp256k1::Secp256k1; -use dashcore::{bls_signatures, ed25519_dalek, Network}; +use dashcore::Network; use itertools::Itertools; use lazy_static::lazy_static; +#[cfg(feature = "bls-signatures")] +use crate::bls_signatures::{self as bls_signatures, Bls12381G2Impl, BlsError}; use crate::fee::Credits; use crate::version::PlatformVersion; -use crate::{InvalidVectorSizeError, ProtocolError}; +use crate::ProtocolError; #[cfg(feature = "random-public-keys")] use rand::rngs::StdRng; #[cfg(feature = "random-public-keys")] @@ -165,13 +167,8 @@ impl KeyType { private_key.public_key(&secp).to_bytes() } KeyType::BLS12_381 => { - let private_key = bls_signatures::PrivateKey::generate_dash(rng) - .expect("expected to generate a bls private key"); // we assume this will never error - private_key - .g1_element() - .expect("expected to get a public key from a bls private key") - .to_bytes() - .to_vec() + let private_key = bls_signatures::SecretKey::::random(rng); + private_key.public_key().0.to_compressed().to_vec() } KeyType::ECDSA_HASH160 | KeyType::BIP13_SCRIPT_HASH | KeyType::EDDSA_25519_HASH160 => { (0..self.default_size()).map(|_| rng.gen::()).collect() @@ -204,13 +201,13 @@ impl KeyType { /// Gets the public key data for a private key depending on the key type pub fn public_key_data_from_private_key_data( &self, - private_key_bytes: &[u8], + private_key_bytes: &[u8; 32], network: Network, ) -> Result, ProtocolError> { match self { KeyType::ECDSA_SECP256K1 => { let secp = Secp256k1::new(); - let secret_key = dashcore::secp256k1::SecretKey::from_slice(private_key_bytes) + let secret_key = dashcore::secp256k1::SecretKey::from_byte_array(private_key_bytes) .map_err(|e| ProtocolError::Generic(e.to_string()))?; let private_key = dashcore::PrivateKey::new(secret_key, network); @@ -219,14 +216,18 @@ impl KeyType { KeyType::BLS12_381 => { #[cfg(feature = "bls-signatures")] { - let private_key = - bls_signatures::PrivateKey::from_bytes(private_key_bytes, false) - .map_err(|e| ProtocolError::Generic(e.to_string()))?; - let public_key_bytes = private_key - .g1_element() - .expect("expected to get a public key from a bls private key") - .to_bytes() - .to_vec(); + let private_key: Option> = + bls_signatures::SecretKey::::from_be_bytes( + private_key_bytes, + ) + .into(); + if private_key.is_none() { + return Err(ProtocolError::BlsError(BlsError::DeserializationError( + "private key bytes not a valid secret key".to_string(), + ))); + } + let private_key = private_key.expect("expected private key"); + let public_key_bytes = private_key.public_key().0.to_compressed().to_vec(); Ok(public_key_bytes) } #[cfg(not(feature = "bls-signatures"))] @@ -236,7 +237,7 @@ impl KeyType { } KeyType::ECDSA_HASH160 => { let secp = Secp256k1::new(); - let secret_key = dashcore::secp256k1::SecretKey::from_slice(private_key_bytes) + let secret_key = dashcore::secp256k1::SecretKey::from_byte_array(private_key_bytes) .map_err(|e| ProtocolError::Generic(e.to_string()))?; let private_key = dashcore::PrivateKey::new(secret_key, network); @@ -245,14 +246,8 @@ impl KeyType { KeyType::EDDSA_25519_HASH160 => { #[cfg(feature = "ed25519-dalek")] { - let key_pair = ed25519_dalek::SigningKey::from_bytes( - &private_key_bytes.try_into().map_err(|_| { - ProtocolError::InvalidVectorSizeError(InvalidVectorSizeError::new( - 32, - private_key_bytes.len(), - )) - })?, - ); + let key_pair = + dashcore::ed25519_dalek::SigningKey::from_bytes(private_key_bytes); Ok(ripemd160_sha256(key_pair.verifying_key().to_bytes().as_slice()).to_vec()) } #[cfg(not(feature = "ed25519-dalek"))] @@ -260,17 +255,15 @@ impl KeyType { "Converting a private key to a eddsa hash 160 is not supported without the ed25519-dalek feature".to_string(), )); } - KeyType::BIP13_SCRIPT_HASH => { - return Err(ProtocolError::NotSupported( - "Converting a private key to a script hash is not supported".to_string(), - )); - } + KeyType::BIP13_SCRIPT_HASH => Err(ProtocolError::NotSupported( + "Converting a private key to a script hash is not supported".to_string(), + )), } } #[cfg(feature = "random-public-keys")] /// Gets the default size of the public key - pub fn random_public_and_private_key_data_v0(&self, rng: &mut StdRng) -> (Vec, Vec) { + pub fn random_public_and_private_key_data_v0(&self, rng: &mut StdRng) -> (Vec, [u8; 32]) { match self { KeyType::ECDSA_SECP256K1 => { let secp = Secp256k1::new(); @@ -279,18 +272,13 @@ impl KeyType { let private_key = dashcore::PrivateKey::new(secret_key, Network::Dash); ( private_key.public_key(&secp).to_bytes(), - private_key.to_bytes(), + private_key.inner.secret_bytes(), ) } KeyType::BLS12_381 => { - let private_key = bls_signatures::PrivateKey::generate_dash(rng) - .expect("expected to generate a bls private key"); // we assume this will never error - let public_key_bytes = private_key - .g1_element() - .expect("expected to get a public key from a bls private key") - .to_bytes() - .to_vec(); - (public_key_bytes, private_key.to_bytes().to_vec()) + let private_key = dashcore::blsful::SecretKey::::random(rng); + let public_key_bytes = private_key.public_key().0.to_compressed().to_vec(); + (public_key_bytes, private_key.0.to_be_bytes()) } KeyType::ECDSA_HASH160 => { let secp = Secp256k1::new(); @@ -299,14 +287,14 @@ impl KeyType { let private_key = dashcore::PrivateKey::new(secret_key, Network::Dash); ( ripemd160_sha256(private_key.public_key(&secp).to_bytes().as_slice()).to_vec(), - private_key.to_bytes(), + private_key.inner.secret_bytes(), ) } KeyType::EDDSA_25519_HASH160 => { - let key_pair = ed25519_dalek::SigningKey::generate(rng); + let key_pair = dashcore::ed25519_dalek::SigningKey::generate(rng); ( ripemd160_sha256(key_pair.verifying_key().to_bytes().as_slice()).to_vec(), - key_pair.to_bytes().to_vec(), + key_pair.to_bytes(), ) } KeyType::BIP13_SCRIPT_HASH => { @@ -317,7 +305,7 @@ impl KeyType { let private_key = dashcore::PrivateKey::new(secret_key, Network::Dash); ( ripemd160_sha256(private_key.public_key(&secp).to_bytes().as_slice()).to_vec(), - private_key.to_bytes(), + private_key.inner.secret_bytes(), ) } } @@ -329,7 +317,7 @@ impl KeyType { &self, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Vec, Vec), ProtocolError> { + ) -> Result<(Vec, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions diff --git a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs index b22a3f0c26..5cc4828dd7 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/mod.rs @@ -14,7 +14,7 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKey { fn validate_private_key_bytes( &self, - private_key_bytes: &[u8], + private_key_bytes: &[u8; 32], network: Network, ) -> Result { match self { diff --git a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs index b11c79c31f..dd2b975e88 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/methods/hash/v0/mod.rs @@ -8,7 +8,7 @@ pub trait IdentityPublicKeyHashMethodsV0 { /// Verifies that the private key bytes match this identity public key fn validate_private_key_bytes( &self, - private_key_bytes: &[u8], + private_key_bytes: &[u8; 32], network: Network, ) -> Result; } diff --git a/packages/rs-dpp/src/identity/identity_public_key/random.rs b/packages/rs-dpp/src/identity/identity_public_key/random.rs index dec286b927..6ed13153e4 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/random.rs @@ -138,7 +138,7 @@ impl IdentityPublicKey { id: KeyID, seed: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let mut rng = match seed { None => StdRng::from_entropy(), Some(seed_value) => StdRng::seed_from_u64(seed_value), @@ -176,7 +176,7 @@ impl IdentityPublicKey { rng: &mut StdRng, used_key_matrix: Option<(KeyCount, &mut UsedKeyMatrix)>, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -272,7 +272,7 @@ impl IdentityPublicKey { key_type: KeyType, contract_bounds: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -318,7 +318,7 @@ impl IdentityPublicKey { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -346,7 +346,7 @@ impl IdentityPublicKey { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -384,7 +384,7 @@ impl IdentityPublicKey { id: KeyID, seed: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let mut rng = match seed { None => StdRng::from_entropy(), Some(seed_value) => StdRng::seed_from_u64(seed_value), @@ -411,7 +411,7 @@ impl IdentityPublicKey { id: KeyID, seed: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let mut rng = match seed { None => StdRng::from_entropy(), Some(seed_value) => StdRng::seed_from_u64(seed_value), @@ -442,7 +442,7 @@ impl IdentityPublicKey { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -489,7 +489,7 @@ impl IdentityPublicKey { id: KeyID, seed: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let mut rng = match seed { None => StdRng::from_entropy(), Some(seed_value) => StdRng::seed_from_u64(seed_value), @@ -518,7 +518,7 @@ impl IdentityPublicKey { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -558,7 +558,7 @@ impl IdentityPublicKey { id: KeyID, seed: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let mut rng = match seed { None => StdRng::from_entropy(), Some(seed_value) => StdRng::seed_from_u64(seed_value), @@ -587,7 +587,7 @@ impl IdentityPublicKey { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -629,7 +629,7 @@ impl IdentityPublicKey { id: KeyID, seed: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let mut rng = match seed { None => StdRng::from_entropy(), Some(seed_value) => StdRng::seed_from_u64(seed_value), @@ -656,7 +656,7 @@ impl IdentityPublicKey { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { match platform_version .dpp .identity_versions @@ -703,7 +703,7 @@ impl IdentityPublicKey { key_count: KeyCount, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result)>, ProtocolError> { + ) -> Result, ProtocolError> { (start_id..(start_id + key_count)) .map(|i| { Self::random_authentication_key_with_private_key_with_rng( @@ -720,7 +720,7 @@ impl IdentityPublicKey { key_count: KeyCount, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result)>, ProtocolError> { + ) -> Result, ProtocolError> { if key_count < 2 { return Err(ProtocolError::PublicKeyGenerationError( "at least 2 keys must be created".to_string(), diff --git a/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs b/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs index 470dc92b9b..ea064e33b6 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/v0/methods/mod.rs @@ -4,12 +4,15 @@ use crate::identity::KeyType; use crate::util::hash::ripemd160_sha256; use crate::ProtocolError; use anyhow::anyhow; +#[cfg(feature = "ed25519-dalek")] +use dashcore::ed25519_dalek; use dashcore::hashes::Hash; use dashcore::key::Secp256k1; use dashcore::secp256k1::SecretKey; -use dashcore::{bls_signatures, ed25519_dalek, Network, PublicKey as ECDSAPublicKey}; +use dashcore::{Network, PublicKey as ECDSAPublicKey}; use platform_value::Bytes20; - +#[cfg(feature = "bls-signatures")] +use {crate::bls_signatures, dashcore::blsful::Bls12381G2Impl}; impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { /// Get the original public key hash fn public_key_hash(&self) -> Result<[u8; 20], ProtocolError> { @@ -50,13 +53,13 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { fn validate_private_key_bytes( &self, - private_key_bytes: &[u8], + private_key_bytes: &[u8; 32], network: Network, ) -> Result { match self.key_type { KeyType::ECDSA_SECP256K1 => { let secp = Secp256k1::new(); - let secret_key = match SecretKey::from_slice(private_key_bytes) { + let secret_key = match SecretKey::from_byte_array(private_key_bytes) { Ok(secret_key) => secret_key, Err(_) => return Ok(false), }; @@ -67,17 +70,17 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { KeyType::BLS12_381 => { #[cfg(feature = "bls-signatures")] { - let private_key = - match bls_signatures::PrivateKey::from_bytes(private_key_bytes, false) { - Ok(secret_key) => secret_key, - Err(_) => return Ok(false), - }; - let g1_element = match private_key.g1_element() { - Ok(g1_element) => g1_element, - Err(_) => return Ok(false), - }; + let private_key: Option> = + bls_signatures::SecretKey::::from_be_bytes( + private_key_bytes, + ) + .into(); + if private_key.is_none() { + return Ok(false); + } + let private_key = private_key.expect("expected private key"); - Ok(g1_element.to_bytes().as_slice() == self.data.as_slice()) + Ok(private_key.public_key().0.to_compressed() == self.data.as_slice()) } #[cfg(not(feature = "bls-signatures"))] return Err(ProtocolError::NotSupported( @@ -86,7 +89,7 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { } KeyType::ECDSA_HASH160 => { let secp = Secp256k1::new(); - let secret_key = match SecretKey::from_slice(private_key_bytes) { + let secret_key = match SecretKey::from_byte_array(private_key_bytes) { Ok(secret_key) => secret_key, Err(_) => return Ok(false), }; @@ -101,11 +104,7 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { KeyType::EDDSA_25519_HASH160 => { #[cfg(feature = "ed25519-dalek")] { - let secret_key = match private_key_bytes.try_into() { - Ok(secret_key) => secret_key, - Err(_) => return Ok(false), - }; - let key_pair = ed25519_dalek::SigningKey::from_bytes(&secret_key); + let key_pair = ed25519_dalek::SigningKey::from_bytes(private_key_bytes); Ok( ripemd160_sha256(key_pair.verifying_key().to_bytes().as_slice()).as_slice() == self.data.as_slice(), @@ -116,11 +115,9 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { "Converting a private key to a eddsa hash 160 is not supported without the ed25519-dalek feature".to_string(), )); } - KeyType::BIP13_SCRIPT_HASH => { - return Err(ProtocolError::NotSupported( - "Converting a private key to a script hash is not supported".to_string(), - )); - } + KeyType::BIP13_SCRIPT_HASH => Err(ProtocolError::NotSupported( + "Converting a private key to a script hash is not supported".to_string(), + )), } } } @@ -129,11 +126,51 @@ impl IdentityPublicKeyHashMethodsV0 for IdentityPublicKeyV0 { mod tests { use super::*; use crate::identity::{Purpose, SecurityLevel}; + use dashcore::blsful::{Bls12381G2Impl, Pairing, Signature, SignatureSchemes}; use dashcore::Network; use dpp::version::PlatformVersion; use rand::rngs::StdRng; use rand::SeedableRng; + #[test] + fn test_bls_serialization_deserialization() { + let mut rng = StdRng::seed_from_u64(5); + let (public_key_data, secret_key) = KeyType::BLS12_381 + .random_public_and_private_key_data(&mut rng, PlatformVersion::latest()) + .expect("expected to get keys"); + let decoded_secret_key = + dashcore::blsful::SecretKey::::from_be_bytes(&secret_key) + .expect("expected to get secret key"); + let public_key = decoded_secret_key.public_key(); + let decoded_public_key_data = public_key.0.to_compressed(); + assert_eq!( + public_key_data.as_slice(), + decoded_public_key_data.as_slice() + ) + } + + #[test] + fn test_bls_serialization_deserialization_signature() { + let mut rng = StdRng::seed_from_u64(5); + let (_, secret_key) = KeyType::BLS12_381 + .random_public_and_private_key_data(&mut rng, PlatformVersion::latest()) + .expect("expected to get keys"); + let decoded_secret_key = + dashcore::blsful::SecretKey::::from_be_bytes(&secret_key) + .expect("expected to get secret key"); + let signature = decoded_secret_key + .sign(SignatureSchemes::Basic, b"hello") + .expect("expected to sign"); + let compressed = signature.as_raw_value().to_compressed(); + let g2 = ::Signature::from_compressed(&compressed) + .expect("G2 projective"); + let decoded_signature = Signature::::Basic(g2); + assert_eq!( + compressed.as_slice(), + decoded_signature.as_raw_value().to_compressed().as_slice() + ) + } + #[cfg(feature = "random-public-keys")] #[test] fn test_validate_private_key_bytes_with_random_keys() { @@ -143,7 +180,7 @@ mod tests { // Test for ECDSA_SECP256K1 let key_type = KeyType::ECDSA_SECP256K1; let (public_key_data, private_key_data) = key_type - .random_public_and_private_key_data(&mut rng, &platform_version) + .random_public_and_private_key_data(&mut rng, platform_version) .expect("expected to generate random keys"); let identity_public_key = IdentityPublicKeyV0 { @@ -158,21 +195,15 @@ mod tests { }; // Validate that the private key matches the public key - assert_eq!( - identity_public_key - .validate_private_key_bytes(&private_key_data, Network::Testnet) - .unwrap(), - true - ); + assert!(identity_public_key + .validate_private_key_bytes(&private_key_data, Network::Testnet) + .unwrap(),); // Test with an invalid private key - let invalid_private_key_bytes = vec![0u8; private_key_data.len()]; - assert_eq!( - identity_public_key - .validate_private_key_bytes(&invalid_private_key_bytes, Network::Testnet) - .unwrap(), - false - ); + let invalid_private_key_bytes = [0u8; 32]; + assert!(!identity_public_key + .validate_private_key_bytes(&invalid_private_key_bytes, Network::Testnet) + .unwrap()); } #[cfg(all(feature = "random-public-keys", feature = "bls-signatures"))] @@ -184,7 +215,7 @@ mod tests { // Test for BLS12_381 let key_type = KeyType::BLS12_381; let (public_key_data, private_key_data) = key_type - .random_public_and_private_key_data(&mut rng, &platform_version) + .random_public_and_private_key_data(&mut rng, platform_version) .expect("expected to generate random keys"); let identity_public_key = IdentityPublicKeyV0 { @@ -199,21 +230,15 @@ mod tests { }; // Validate that the private key matches the public key - assert_eq!( - identity_public_key - .validate_private_key_bytes(&private_key_data, Network::Testnet) - .unwrap(), - true - ); + assert!(identity_public_key + .validate_private_key_bytes(&private_key_data, Network::Testnet) + .unwrap()); // Test with an invalid private key - let invalid_private_key_bytes = vec![0u8; private_key_data.len()]; - assert_eq!( - identity_public_key - .validate_private_key_bytes(&invalid_private_key_bytes, Network::Testnet) - .unwrap(), - false - ); + let invalid_private_key_bytes = [0u8; 32]; + assert!(!identity_public_key + .validate_private_key_bytes(&invalid_private_key_bytes, Network::Testnet) + .unwrap()); } #[cfg(all(feature = "random-public-keys", feature = "ed25519-dalek"))] @@ -225,7 +250,7 @@ mod tests { // Test for EDDSA_25519_HASH160 let key_type = KeyType::EDDSA_25519_HASH160; let (public_key_data, private_key_data) = key_type - .random_public_and_private_key_data(&mut rng, &platform_version) + .random_public_and_private_key_data(&mut rng, platform_version) .expect("expected to generate random keys"); let identity_public_key = IdentityPublicKeyV0 { @@ -240,20 +265,14 @@ mod tests { }; // Validate that the private key matches the public key - assert_eq!( - identity_public_key - .validate_private_key_bytes(&private_key_data, Network::Testnet) - .unwrap(), - true - ); + assert!(identity_public_key + .validate_private_key_bytes(&private_key_data, Network::Testnet) + .unwrap()); // Test with an invalid private key - let invalid_private_key_bytes = vec![0u8; private_key_data.len()]; - assert_eq!( - identity_public_key - .validate_private_key_bytes(&invalid_private_key_bytes, Network::Testnet) - .unwrap(), - false - ); + let invalid_private_key_bytes = [0u8; 32]; + assert!(!identity_public_key + .validate_private_key_bytes(&invalid_private_key_bytes, Network::Testnet) + .unwrap()); } } diff --git a/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs b/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs index 162e836e1b..a7ba471b3a 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/v0/random.rs @@ -68,7 +68,7 @@ impl IdentityPublicKeyV0 { rng: &mut StdRng, used_key_matrix: Option<(KeyCount, &mut UsedKeyMatrix)>, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { // we have 16 different permutations possible let mut binding = [false; 16].to_vec(); let (key_count, key_matrix) = used_key_matrix.unwrap_or((0, &mut binding)); @@ -124,7 +124,7 @@ impl IdentityPublicKeyV0 { key_type: KeyType, contract_bounds: Option, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let read_only = false; let (public_data, private_data) = key_type.random_public_and_private_key_data(rng, platform_version)?; @@ -197,7 +197,7 @@ impl IdentityPublicKeyV0 { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let key_type = ECDSA_SECP256K1; let purpose = AUTHENTICATION; let security_level = MASTER; @@ -223,7 +223,7 @@ impl IdentityPublicKeyV0 { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let key_type = ECDSA_HASH160; let purpose = VOTING; let security_level = MEDIUM; @@ -249,7 +249,7 @@ impl IdentityPublicKeyV0 { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let key_type = ECDSA_HASH160; let purpose = OWNER; let security_level = CRITICAL; @@ -275,7 +275,7 @@ impl IdentityPublicKeyV0 { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let key_type = ECDSA_HASH160; let purpose = TRANSFER; let security_level = CRITICAL; @@ -301,7 +301,7 @@ impl IdentityPublicKeyV0 { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let key_type = ECDSA_SECP256K1; let purpose = AUTHENTICATION; let security_level = CRITICAL; @@ -327,7 +327,7 @@ impl IdentityPublicKeyV0 { id: KeyID, rng: &mut StdRng, platform_version: &PlatformVersion, - ) -> Result<(Self, Vec), ProtocolError> { + ) -> Result<(Self, [u8; 32]), ProtocolError> { let key_type = ECDSA_SECP256K1; let purpose = AUTHENTICATION; let security_level = HIGH; diff --git a/packages/rs-dpp/src/identity/random.rs b/packages/rs-dpp/src/identity/random.rs index d5f19f493a..c14525272c 100644 --- a/packages/rs-dpp/src/identity/random.rs +++ b/packages/rs-dpp/src/identity/random.rs @@ -66,8 +66,8 @@ impl Identity { ) -> Result<(Self, I), ProtocolError> where I: Default - + IntoIterator)> - + Extend<(IdentityPublicKey, Vec)>, + + IntoIterator + + Extend<(IdentityPublicKey, [u8; 32])>, { match platform_version .dpp @@ -234,8 +234,8 @@ impl Identity { ) -> Result<(Vec, I), ProtocolError> where I: Default - + FromIterator<(IdentityPublicKey, Vec)> - + Extend<(IdentityPublicKey, Vec)>, + + FromIterator<(IdentityPublicKey, [u8; 32])> + + Extend<(IdentityPublicKey, [u8; 32])>, { match platform_version .dpp diff --git a/packages/rs-dpp/src/identity/v0/random.rs b/packages/rs-dpp/src/identity/v0/random.rs index 2be4a34cfe..5733aeda9e 100644 --- a/packages/rs-dpp/src/identity/v0/random.rs +++ b/packages/rs-dpp/src/identity/v0/random.rs @@ -47,8 +47,8 @@ impl IdentityV0 { ) -> Result<(Self, I), ProtocolError> where I: Default - + IntoIterator)> - + Extend<(IdentityPublicKey, Vec)>, + + IntoIterator + + Extend<(IdentityPublicKey, [u8; 32])>, { let id = Identifier::new(rng.gen::<[u8; 32]>()); let revision = 0; @@ -126,11 +126,11 @@ impl IdentityV0 { ) -> Result<(Vec, I), ProtocolError> where I: Default - + FromIterator<(IdentityPublicKey, Vec)> - + Extend<(IdentityPublicKey, Vec)>, + + FromIterator<(IdentityPublicKey, [u8; 32])> + + Extend<(IdentityPublicKey, [u8; 32])>, { let mut vec: Vec = vec![]; - let mut private_key_map: Vec<(IdentityPublicKey, Vec)> = vec![]; + let mut private_key_map: Vec<(IdentityPublicKey, [u8; 32])> = vec![]; for _i in 0..count { let (identity, mut map) = Self::random_identity_with_main_keys_with_private_key( key_count, diff --git a/packages/rs-dpp/src/lib.rs b/packages/rs-dpp/src/lib.rs index 168a9ad284..27932329aa 100644 --- a/packages/rs-dpp/src/lib.rs +++ b/packages/rs-dpp/src/lib.rs @@ -89,8 +89,8 @@ pub mod prelude { } pub use bincode; -#[cfg(all(not(target_arch = "wasm32"), feature = "bls-signatures"))] -pub use dashcore::bls_signatures; +#[cfg(feature = "bls-signatures")] +pub use dashcore::blsful as bls_signatures; #[cfg(feature = "ed25519-dalek")] pub use dashcore::ed25519_dalek; #[cfg(feature = "system_contracts")] diff --git a/packages/rs-dpp/src/signing.rs b/packages/rs-dpp/src/signing.rs index d4f69942b6..d637c0480b 100644 --- a/packages/rs-dpp/src/signing.rs +++ b/packages/rs-dpp/src/signing.rs @@ -1,14 +1,20 @@ -#[cfg(feature = "message-signature-verification")] -use crate::consensus::signature::{ - BasicBLSError, BasicECDSAError, SignatureError, SignatureShouldNotBePresentError, -}; use crate::identity::KeyType; use crate::serialization::PlatformMessageSignable; #[cfg(feature = "message-signature-verification")] -use crate::validation::SimpleConsensusValidationResult; +use crate::{ + consensus::signature::{ + BasicBLSError, BasicECDSAError, SignatureError, SignatureShouldNotBePresentError, + }, + validation::SimpleConsensusValidationResult, +}; #[cfg(feature = "message-signing")] use crate::{BlsModule, ProtocolError}; -use dashcore::{bls_signatures, signer}; +use dashcore::signer; +#[cfg(feature = "bls-signatures")] +use { + crate::bls_signatures::{Bls12381G2Impl, Pairing}, + dashcore::{blsful as bls_signatures, blsful::Signature}, +}; impl PlatformMessageSignable for &[u8] { #[cfg(feature = "message-signature-verification")] @@ -38,25 +44,44 @@ impl PlatformMessageSignable for &[u8] { } } KeyType::BLS12_381 => { - let public_key = match bls_signatures::PublicKey::from_bytes(public_key_data) { - Ok(public_key) => public_key, - Err(e) => { - // dbg!(format!("bls public_key could not be recovered")); + let public_key = + match bls_signatures::PublicKey::::try_from(public_key_data) { + Ok(public_key) => public_key, + Err(e) => { + // dbg!(format!("bls public_key could not be recovered")); + return SimpleConsensusValidationResult::new_with_error( + SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())) + .into(), + ); + } + }; + let signature_bytes: [u8; 96] = match signature.try_into() { + Ok(bytes) => bytes, + Err(_) => { return SimpleConsensusValidationResult::new_with_error( - SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), - ); + SignatureError::BasicBLSError(BasicBLSError::new(format!( + "Signature was {} bytes, expected 96 bytes", + signature.len() + ))) + .into(), + ) } }; - let signature = match bls_signatures::Signature::from_bytes(signature) { - Ok(public_key) => public_key, - Err(e) => { - // dbg!(format!("bls signature could not be recovered")); + let g2 = match ::Signature::from_compressed( + &signature_bytes, + ) + .into_option() + { + Some(g2) => g2, + None => { return SimpleConsensusValidationResult::new_with_error( - SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), + SignatureError::BasicBLSError(BasicBLSError::new("bls signature does not conform to proper bls signature serialization".to_string())).into(), ); } }; - if !public_key.verify(&signature, signable_data) { + let signature = Signature::::Basic(g2); + + if signature.verify(&public_key, signable_data).is_err() { SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new( "bls signature was incorrect".to_string(), diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/methods/v0/mod.rs index eeb7104420..588fafe2c0 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_transfer_transition/methods/v0/mod.rs @@ -5,7 +5,6 @@ use crate::{ state_transition::StateTransition, ProtocolError, }; -use platform_value::Identifier; #[cfg(feature = "state-transition-signing")] use platform_version::version::{FeatureVersion, PlatformVersion}; @@ -15,7 +14,7 @@ pub trait IdentityCreditTransferTransitionMethodsV0 { #[cfg(feature = "state-transition-signing")] fn try_from_identity( identity: &Identity, - to_identity_with_identifier: Identifier, + to_identity_with_identifier: platform_value::Identifier, amount: u64, user_fee_increase: UserFeeIncrease, signer: S, diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 14a9d742fe..3b9318598c 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -28,7 +28,7 @@ rand = "0.8.5" tempfile = "3.3.0" hex = "0.4.3" indexmap = { version = "2.2.6", features = ["serde"] } -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.8" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.9" } dpp = { path = "../rs-dpp", features = ["abci"] } simple-signer = { path = "../simple-signer" } rust_decimal = "1.2.5" @@ -73,6 +73,7 @@ tokio-util = { version = "0.7" } derive_more = { version = "1.0", features = ["from", "deref", "deref_mut"] } async-trait = "0.1.77" console-subscriber = { version = "0.4", optional = true } +bls-signatures = { git = "https://github.com/dashpay/bls-signatures", tag = "1.3.3" } [dev-dependencies] bs58 = { version = "0.5.0" } diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 9c45694f6c..4cef4a48bc 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -272,7 +272,7 @@ where // Rebroadcast expired withdrawals if they exist self.rebroadcast_expired_withdrawal_documents( &block_info, - &last_committed_platform_state, + last_committed_platform_state, transaction, platform_version, )?; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs index 898eec524c..7c901380b0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/update_operator_identity/v0/mod.rs @@ -400,7 +400,7 @@ mod tests { use dashcore_rpc::dashcore_rpc_json::{MasternodeListItem, MasternodeType}; use dashcore_rpc::json::DMNState; use dpp::block::block_info::BlockInfo; - use dpp::bls_signatures::PrivateKey as BlsPrivateKey; + use dpp::bls_signatures::{Bls12381G2Impl, SecretKey as BlsPrivateKey}; use dpp::dashcore::hashes::Hash; use dpp::dashcore::Txid; use dpp::identifier::MasternodeIdentifiers; @@ -433,13 +433,15 @@ mod tests { let node_id_bytes: [u8; 20] = rng.gen(); // Create a public key operator and payout address - let private_key_operator = - BlsPrivateKey::generate_dash(rng).expect("expected to generate a private key"); - let pub_key_operator = private_key_operator - .g1_element() - .expect("expected to get public key") + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(rng) + .expect("expected to generate a private key") .to_bytes() .to_vec(); + let private_key_operator = BlsPrivateKey::::from_be_bytes( + &private_key_operator_bytes.try_into().expect("expected the secret key to be 32 bytes"), + ) + .expect("expected the conversion between bls signatures library and blsful to happen without failing"); + let pub_key_operator = private_key_operator.public_key().0.to_compressed().to_vec(); let operator_key: IdentityPublicKey = IdentityPublicKeyV0 { id: 0, @@ -950,13 +952,15 @@ mod tests { ) = create_operator_identity(&platform, &mut rng); // Generate a new public key operator - let new_private_key_operator = - BlsPrivateKey::generate_dash(&mut rng).expect("expected to generate a private key"); - let new_pub_key_operator = new_private_key_operator - .g1_element() - .expect("expected to get public key") + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(&mut rng) + .expect("expected to generate a private key") .to_bytes() .to_vec(); + let private_key_operator = BlsPrivateKey::::from_be_bytes( + &private_key_operator_bytes.try_into().expect("expected the secret key to be 32 bytes"), + ) + .expect("expected the conversion between bls signatures library and blsful to happen without failing"); + let new_pub_key_operator = private_key_operator.public_key().0.to_compressed().to_vec(); // Create an old masternode state let masternode_list_item = MasternodeListItem { @@ -1040,13 +1044,15 @@ mod tests { ) = create_operator_identity(&platform, &mut rng); // Generate a new public key operator - let new_private_key_operator = - BlsPrivateKey::generate_dash(&mut rng).expect("expected to generate a private key"); - let new_pub_key_operator = new_private_key_operator - .g1_element() - .expect("expected to get public key") + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(&mut rng) + .expect("expected to generate a private key") .to_bytes() .to_vec(); + let private_key_operator = BlsPrivateKey::::from_be_bytes( + &private_key_operator_bytes.try_into().expect("expected the secret key to be 32 bytes"), + ) + .expect("expected the conversion between bls signatures library and blsful to happen without failing"); + let new_pub_key_operator = private_key_operator.public_key().0.to_compressed().to_vec(); // Create an old masternode state with original public key operator let masternode_list_item = MasternodeListItem { diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index 5ca6ce4070..14320ad1d2 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -386,7 +386,7 @@ where )?; let public_key = - match BlsPublicKey::from_bytes(quorum_info.quorum_public_key.as_slice()) + match BlsPublicKey::try_from(quorum_info.quorum_public_key.as_slice()) .map_err(ExecutionError::BlsErrorFromDashCoreResponse) { Ok(public_key) => public_key, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs index 3af3b3fbd2..397709ed19 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -3,7 +3,7 @@ mod v0; use crate::error::execution::ExecutionError; use crate::error::Error; use dashcore_rpc::dashcore_rpc_json::QuorumType; -use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::bls_signatures::{Bls12381G2Impl, PublicKey as BlsPublicKey}; use dpp::dashcore::QuorumHash; use std::collections::BTreeMap; @@ -24,10 +24,10 @@ where // TODO: use CoreQuorumSet.select_quorums instead pub fn choose_quorum<'a>( llmq_quorum_type: QuorumType, - quorums: &'a BTreeMap, + quorums: &'a BTreeMap>, request_id: &[u8; 32], platform_version: &PlatformVersion, - ) -> Result, Error> { + ) -> Result)>, Error> { match platform_version .drive_abci .methods diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index 0d8ac563e3..3b6d1f8673 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -1,5 +1,5 @@ use dashcore_rpc::dashcore_rpc_json::QuorumType; -use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::bls_signatures::{Bls12381G2Impl, PublicKey as BlsPublicKey}; use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; use dpp::dashcore::QuorumHash; use std::collections::BTreeMap; @@ -12,11 +12,15 @@ impl Platform { /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums pub(super) fn choose_quorum_v0<'a>( llmq_quorum_type: QuorumType, - quorums: &'a BTreeMap, + quorums: &'a BTreeMap>, request_id: &[u8; 32], - ) -> Option<(ReversedQuorumHashBytes, &'a BlsPublicKey)> { + ) -> Option<(ReversedQuorumHashBytes, &'a BlsPublicKey)> { // Scoring system logic - let mut scores: Vec<(ReversedQuorumHashBytes, &BlsPublicKey, [u8; 32])> = Vec::new(); + let mut scores: Vec<( + ReversedQuorumHashBytes, + &BlsPublicKey, + [u8; 32], + )> = Vec::new(); for (quorum_hash, public_key) in quorums { let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); @@ -92,9 +96,11 @@ mod tests { use crate::platform_types::platform::Platform; use crate::rpc::core::MockCoreRPCLike; use dashcore_rpc::dashcore_rpc_json::QuorumType; - use dpp::bls_signatures::PublicKey as BlsPublicKey; + use dpp::bls_signatures::SecretKey; use dpp::dashcore::hashes::Hash; use dpp::dashcore::QuorumHash; + use rand::rngs::StdRng; + use rand::SeedableRng; use std::collections::BTreeMap; #[test] @@ -124,11 +130,12 @@ mod tests { .as_slice(), ) .unwrap(); + let mut rng = StdRng::seed_from_u64(345); let quorums = BTreeMap::from([ - (quorum_hash1, BlsPublicKey::generate()), - (quorum_hash2, BlsPublicKey::generate()), - (quorum_hash3, BlsPublicKey::generate()), - (quorum_hash4, BlsPublicKey::generate()), + (quorum_hash1, SecretKey::random(&mut rng).public_key()), + (quorum_hash2, SecretKey::random(&mut rng).public_key()), + (quorum_hash3, SecretKey::random(&mut rng).public_key()), + (quorum_hash4, SecretKey::random(&mut rng).public_key()), ]); // diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index a48fc30c67..cefe129e4d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -1,4 +1,4 @@ -use dpp::bls_signatures::G2Element; +use dpp::bls_signatures::{Bls12381G2Impl, Pairing, Signature}; use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; use dpp::dashcore::{ChainLock, QuorumSigningRequestId}; @@ -37,10 +37,30 @@ where let quorum_config = quorum_set.config(); // First verify that the signature conforms to a signature - let Ok(signature) = G2Element::from_bytes(chain_lock.signature.as_bytes()) else { - return Ok(Some(false)); + + let decoded_sig = match ::Signature::from_compressed( + chain_lock.signature.as_bytes(), + ) + .into_option() + { + Some(signature) => signature, + None => { + tracing::error!( + ?chain_lock, + "chain lock signature was not deserializable: h:{} r:{}", + platform_state.last_committed_block_height() + 1, + round + ); + return Err(Error::BLSError( + dpp::bls_signatures::BlsError::DeserializationError( + "chain lock signature was not deserializable".to_string(), + ), + )); + } }; + let signature = Signature::Basic(decoded_sig); + // we attempt to verify the chain lock locally let chain_lock_height = chain_lock.block_height; @@ -119,9 +139,12 @@ where let message_digest = sha256d::Hash::from_engine(engine); - let mut chain_lock_verified = quorum - .public_key - .verify(&signature, message_digest.as_ref()); + let mut chain_lock_verified = signature + .verify( + &quorum.public_key, + message_digest.as_byte_array().as_slice(), + ) + .is_ok(); tracing::debug!( ?chain_lock, @@ -162,9 +185,12 @@ where let message_digest = sha256d::Hash::from_engine(engine); - chain_lock_verified = quorum - .public_key - .verify(&signature, message_digest.as_ref()); + chain_lock_verified = signature + .verify( + &quorum.public_key, + message_digest.as_byte_array().as_slice(), + ) + .is_ok(); tracing::debug!( ?chain_lock, @@ -210,6 +236,7 @@ where #[cfg(test)] mod tests { use crate::execution::platform_events::core_chain_lock::verify_chain_lock_locally::v0::CHAIN_LOCK_REQUEST_ID_PREFIX; + use dpp::bls_signatures::{Bls12381G2Impl, Pairing}; use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; use dpp::dashcore::QuorumSigningRequestId; @@ -279,4 +306,30 @@ mod tests { "5ec53e83b8ff390b970e28db21da5b8e45fbe3b69d9f11a2c39062769b1f5e47" ); } + + #[test] + // Verify that the signature can be deserialized + fn verify_signature() { + let signatures =vec![ + // local devnet + [ + 139, 91, 189, 131, 240, 161, 167, 171, 205, 251, 134, 2, 160, 27, 100, 46, 55, 162, 23, + 224, 18, 130, 100, 147, 255, 29, 128, 110, 111, 138, 195, 219, 243, 137, 110, 60, 243, + 176, 180, 242, 58, 223, 235, 59, 172, 168, 235, 146, 6, 243, 139, 112, 175, 99, 82, 69, + 144, 38, 15, 72, 250, 94, 82, 198, 52, 35, 126, 131, 37, 140, 25, 178, 33, 187, 71, + 167, 87, 81, 15, 210, 220, 201, 44, 245, 222, 66, 252, 70, 227, 109, 43, 60, 102, 187, + 144, 108, + ], + // mainnet + hex::decode("9609d7dea0812c0a6b72d6f20f988d269d3076324c5e51ff6042ce0506370a738bfce420f8174a4e0e34ded7e5792ac217a169b71c7dc3eefde5abba9feaf7d3c7c29fb36ade2e41bc5dfada13d7546c6061ef7e03e894e813f72dd20af8bcbb").unwrap().try_into().unwrap(), + ]; + + for signature in signatures { + assert!( + ::Signature::from_compressed(&signature) + .into_option() + .is_some(), + ); + } + } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs index 335e5cb201..0f3d38e5a8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_instant_send_lock/verify_recent_signature_locally/v0/mod.rs @@ -1,4 +1,4 @@ -use dpp::bls_signatures::G2Element; +use dpp::bls_signatures::{Bls12381G2Impl, Pairing, Signature}; use std::fmt::{Debug, Formatter}; use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; @@ -20,15 +20,16 @@ pub(super) fn verify_recent_instant_lock_signature_locally_v0( platform_state: &PlatformState, ) -> Result { // First verify that the signature conforms to a signature - let signature = match G2Element::from_bytes(instant_lock.signature.as_bytes()) { - Ok(signature) => signature, - Err(e) => { + + let signature = match ::Signature::from_compressed( + instant_lock.signature.as_bytes(), + ) + .into_option() + { + Some(signature) => Signature::Basic(signature), + None => { tracing::trace!( - instant_lock = ?InstantLockDebug(instant_lock), - "Invalid instant Lock {} signature format: {}", - instant_lock.txid, - e, - ); + instant_lock = ?InstantLockDebug(instant_lock), "Invalid instant Lock {} signature format", instant_lock.txid, ); return Ok(false); } @@ -96,9 +97,12 @@ pub(super) fn verify_recent_instant_lock_signature_locally_v0( let message_digest = sha256d::Hash::from_engine(engine); - if quorum - .public_key - .verify(&signature, message_digest.as_ref()) + if signature + .verify( + &quorum.public_key, + message_digest.as_byte_array().as_slice(), + ) + .is_ok() { return Ok(true); } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs index 6347c9515c..0f11ba2a64 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/common/asset_lock/transaction/fetch_asset_lock_transaction_output_sync/v0/mod.rs @@ -5,7 +5,7 @@ use dpp::consensus::basic::identity::{ IdentityAssetLockTransactionIsNotFoundError, IdentityAssetLockTransactionOutputNotFoundError, InvalidAssetLockProofTransactionHeightError, }; -use dpp::dashcore::secp256k1::ThirtyTwoByteHash; +use dpp::dashcore::hashes::Hash; use dpp::dashcore::TxOut; use dpp::identity::state_transition::asset_lock_proof::validate_asset_lock_transaction_structure::validate_asset_lock_transaction_structure; use dpp::prelude::{AssetLockProof, ConsensusValidationResult}; @@ -49,7 +49,7 @@ pub fn fetch_asset_lock_transaction_output_sync_v0( let Some(transaction_info) = maybe_transaction_info else { // Transaction hash bytes needs to be reversed to match actual transaction hash - let mut hash = transaction_hash.as_raw_hash().into_32(); + let mut hash: [u8; 32] = *transaction_hash.as_raw_hash().as_byte_array(); hash.reverse(); return Ok(ValidationResult::new_with_error( diff --git a/packages/rs-drive-abci/src/mimic/mod.rs b/packages/rs-drive-abci/src/mimic/mod.rs index 0fb866b107..f0c5f895bc 100644 --- a/packages/rs-drive-abci/src/mimic/mod.rs +++ b/packages/rs-drive-abci/src/mimic/mod.rs @@ -13,6 +13,7 @@ use crate::platform_types::withdrawal::unsigned_withdrawal_txs::v0::{ use crate::rpc::core::CoreRPCLike; use ciborium::Value as CborValue; use dpp::block::block_info::BlockInfo; +use dpp::bls_signatures::SignatureSchemes; use dpp::consensus::ConsensusError; use dpp::dashcore::hashes::Hash; use dpp::platform_value::btreemap_extensions::BTreeValueMapHelper; @@ -514,9 +515,12 @@ impl<'a, C: CoreRPCLike> FullAbciApplication<'a, C> { public_key = ?current_quorum.public_key, "Signing block" ); - let block_signature = current_quorum.private_key.sign(digest.as_slice()); + let block_signature = current_quorum + .private_key + .sign(SignatureSchemes::Basic, digest.as_slice()) + .expect("expected to be able to sign"); - commit_info.block_signature = block_signature.to_bytes().to_vec(); + commit_info.block_signature = block_signature.as_raw_value().to_compressed().to_vec(); } else { commit_info.block_signature = [0u8; 96].to_vec(); } diff --git a/packages/rs-drive-abci/src/mimic/test_quorum.rs b/packages/rs-drive-abci/src/mimic/test_quorum.rs index c1653183c6..389abf3bc1 100644 --- a/packages/rs-drive-abci/src/mimic/test_quorum.rs +++ b/packages/rs-drive-abci/src/mimic/test_quorum.rs @@ -3,8 +3,9 @@ use crate::platform_types::validator_set::v0::ValidatorSetV0; use dashcore_rpc::dashcore::hashes::Hash; use dashcore_rpc::dashcore::{ProTxHash, PubkeyHash, QuorumHash}; use dashcore_rpc::dashcore_rpc_json::{QuorumInfoResult, QuorumMember, QuorumType}; -use dpp::bls_signatures; -use dpp::bls_signatures::{PrivateKey as BlsPrivateKey, PublicKey as BlsPublicKey}; +use dpp::bls_signatures::{ + Bls12381G2Impl, PublicKey as BlsPublicKey, PublicKey, SecretKey as BlsPrivateKey, SecretKey, +}; use rand::rngs::StdRng; use rand::Rng; use std::collections::BTreeMap; @@ -17,9 +18,9 @@ pub struct ValidatorInQuorum { /// The hash of the transaction that identifies this validator in the network. pub pro_tx_hash: ProTxHash, /// The private key for this validator's BLS signature scheme. - pub private_key: BlsPrivateKey, + pub private_key: BlsPrivateKey, /// The public key for this validator's BLS signature scheme. - pub public_key: BlsPublicKey, + pub public_key: BlsPublicKey, /// The node address pub node_ip: String, /// The node id @@ -102,9 +103,9 @@ pub struct TestQuorumInfo { /// A map of validators indexed by their `ProTxHash` identifiers. pub validator_map: BTreeMap, /// The private key used to sign messages for the quorum (for testing purposes only). - pub private_key: BlsPrivateKey, + pub private_key: BlsPrivateKey, /// The public key corresponding to the private key used for signing. - pub public_key: BlsPublicKey, + pub public_key: BlsPublicKey, } fn random_ipv4_address(rng: &mut StdRng) -> Ipv4Addr { @@ -135,6 +136,7 @@ impl TestQuorumInfo { pro_tx_hashes: Vec, rng: &mut StdRng, ) -> Self { + // We test on purpose with the bls library that Dash Core uses let private_keys = bls_signatures::PrivateKey::generate_dash_many(pro_tx_hashes.len(), rng) .expect("expected to generate private keys"); let bls_id_private_key_pairs = private_keys @@ -154,8 +156,12 @@ impl TestQuorumInfo { ValidatorInQuorum { pro_tx_hash: ProTxHash::from_slice(pro_tx_hash.as_slice()) .expect("expected 32 bytes for pro_tx_hash"), - private_key: key, - public_key, + private_key: SecretKey::from_be_bytes( + &key.to_bytes().to_vec().try_into().expect("32 bytes"), + ) + .expect("expected conversion to work"), + public_key: PublicKey::try_from(public_key.to_bytes().as_slice()) + .expect("expected conversion to work"), node_ip: random_socket_addr(rng).to_string(), node_id: PubkeyHash::from_slice(pro_tx_hash.split_at(20).0).unwrap(), core_port: 1, @@ -178,8 +184,16 @@ impl TestQuorumInfo { quorum_index, validator_set, validator_map: map, - private_key: recovered_private_key, - public_key, + private_key: SecretKey::from_be_bytes( + &recovered_private_key + .to_bytes() + .to_vec() + .try_into() + .expect("32 bytes"), + ) + .expect("expected conversion to work"), + public_key: PublicKey::try_from(public_key.to_bytes().as_slice()) + .expect("expected conversion to work"), } } } @@ -255,7 +269,7 @@ impl From<&TestQuorumInfo> for QuorumInfoResult { pro_tx_hash: *pro_tx_hash, pub_key_operator: vec![], //doesn't matter valid: true, - pub_key_share: Some(public_key.to_bytes().to_vec()), + pub_key_share: Some(public_key.0.to_compressed().to_vec()), } }) .collect(); @@ -266,7 +280,7 @@ impl From<&TestQuorumInfo> for QuorumInfoResult { quorum_index: 0, mined_block: vec![], members, - quorum_public_key: public_key.to_bytes().to_vec(), + quorum_public_key: public_key.0.to_compressed().to_vec(), secret_key_share: None, } } diff --git a/packages/rs-drive-abci/src/platform_types/commit/mod.rs b/packages/rs-drive-abci/src/platform_types/commit/mod.rs index 1a24fddcd1..a903ce25d8 100644 --- a/packages/rs-drive-abci/src/platform_types/commit/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/commit/mod.rs @@ -5,6 +5,7 @@ use crate::platform_types::cleaned_abci_messages::{cleaned_block_id, cleaned_com use crate::platform_types::commit::v0::CommitV0; use dashcore_rpc::dashcore_rpc_json::QuorumType; use dpp::bls_signatures; +use dpp::bls_signatures::Bls12381G2Impl; use dpp::validation::SimpleValidationResult; use dpp::version::PlatformVersion; use tenderdash_abci::proto::abci::CommitInfo; @@ -82,7 +83,7 @@ impl Commit { pub fn verify_signature( &self, signature: &[u8; 96], - public_key: &bls_signatures::PublicKey, + public_key: &bls_signatures::PublicKey, ) -> SimpleValidationResult { match self { Commit::V0(v0) => v0.verify_signature(signature, public_key), diff --git a/packages/rs-drive-abci/src/platform_types/commit/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/commit/v0/mod.rs index 403a3fff30..2f70aa8e5c 100644 --- a/packages/rs-drive-abci/src/platform_types/commit/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/commit/v0/mod.rs @@ -6,6 +6,7 @@ use crate::abci::AbciError; use crate::platform_types::cleaned_abci_messages::{cleaned_block_id, cleaned_commit_info}; use dashcore_rpc::dashcore_rpc_json::QuorumType; use dpp::bls_signatures; +use dpp::bls_signatures::{Bls12381G2Impl, BlsError, Pairing, Signature}; use dpp::validation::{SimpleValidationResult, ValidationResult}; use tenderdash_abci::proto; use tenderdash_abci::proto::abci::CommitInfo; @@ -81,24 +82,27 @@ impl CommitV0 { pub(super) fn verify_signature( &self, signature: &[u8; 96], - public_key: &bls_signatures::PublicKey, + public_key: &bls_signatures::PublicKey, ) -> SimpleValidationResult { if signature == &[0; 96] { return ValidationResult::new_with_error(AbciError::BadRequest( "commit signature not initialized".to_string(), )); } + // We could have received a fake commit, so signature validation needs to be returned if error as a simple validation result - let signature = match bls_signatures::Signature::from_bytes(signature).map_err(|e| { - AbciError::BlsErrorOfTenderdashThresholdMechanism( - e, + let g2_element = match ::Signature::from_compressed(signature) + .into_option() + .ok_or(AbciError::BlsErrorOfTenderdashThresholdMechanism( + BlsError::InvalidSignature, "verification of a commit signature".to_string(), - ) - }) { + )) { Ok(signature) => signature, Err(e) => return ValidationResult::new_with_error(e), }; + let signature = Signature::Basic(g2_element); + //todo: maybe cache this to lower the chance of a hashing based attack (forcing the // same calculation each time) let quorum_hash = &self.inner.quorum_hash[..] @@ -120,11 +124,11 @@ impl CommitV0 { Err(e) => return ValidationResult::new_with_error(e), }; - match public_key.verify(&signature, &hash) { - true => ValidationResult::default(), - false => ValidationResult::new_with_error(AbciError::BadCommitSignature(format!( + match signature.verify(public_key, &hash) { + Ok(_) => ValidationResult::default(), + Err(_) => ValidationResult::new_with_error(AbciError::BadCommitSignature(format!( "commit signature {} is wrong", - hex::encode(signature.to_bytes().as_slice()) + signature ))), } } @@ -184,7 +188,7 @@ mod test { }; let pubkey = hex::decode("8d63d603fe858be4d7c14a8f308936bd3447c1f361148ad508a04df92f48cd3b2f2b374ef5d1ee8a75f5aeda2f6f3418").unwrap(); - let pubkey = PublicKey::from_bytes(pubkey.as_slice()).unwrap(); + let pubkey = PublicKey::try_from(pubkey.as_slice()).unwrap(); let signature = hex::decode("b95efd51c69a0baf09b130871e735b49cb1b9a0d566bc7ba8fd0fa149dbd28539ab3df435e87ed2a83c94ea714bc8e120504b1cba9363b32c3d58499ed85ecf14539e8e99329fa7952420e4ad9da80b3b28388d62be00770988e4aee705da830").unwrap(); let commit = CommitV0::new_from_cleaned( diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index d1c2ccd464..9bb41bf2d6 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -1,3 +1,5 @@ +mod old_structures; + use crate::error::execution::ExecutionError; use crate::error::Error; use dashcore_rpc::dashcore::{ProTxHash, QuorumHash}; @@ -126,7 +128,7 @@ fn hex_encoded_validator_sets(validator_sets: &IndexMap, /// Information about the last block @@ -143,7 +145,7 @@ pub struct PlatformStateForSavingV0 { /// The validator set quorums are a subset of the quorums, but they also contain the list of /// all members #[bincode(with_serde)] - pub validator_sets: Vec<(Bytes32, ValidatorSet)>, + pub validator_sets: Vec<(Bytes32, old_structures::ValidatorSet)>, /// The quorums used for validating chain locks pub chain_lock_validating_quorums: SignatureVerificationQuorumSetForSaving, @@ -267,7 +269,7 @@ impl From for PlatformStateV0 { validator_sets: value .validator_sets .into_iter() - .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) + .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v.into())) .collect(), chain_lock_validating_quorums: value.chain_lock_validating_quorums.into(), instant_lock_validating_quorums: value.instant_lock_validating_quorums.into(), diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs new file mode 100644 index 0000000000..ebd0e85875 --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs @@ -0,0 +1,103 @@ +use dpp::bls_signatures::PublicKey; +use dpp::dashcore::{ProTxHash, PubkeyHash, QuorumHash}; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub(super) enum ValidatorSet { + /// Version 0 + V0(ValidatorSetV0), +} + +impl From for dpp::core_types::validator_set::ValidatorSet { + fn from(value: ValidatorSet) -> Self { + match value { + ValidatorSet::V0(v0) => dpp::core_types::validator_set::ValidatorSet::V0(v0.into()), + } + } +} + +/// The validator set is only slightly different from a quorum as it does not contain non valid +/// members +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub(super) struct ValidatorSetV0 { + /// The quorum hash + pub quorum_hash: QuorumHash, + /// Rotation quorum index is available only for DIP24 quorums + pub quorum_index: Option, + /// Active height + pub core_height: u32, + /// The list of masternodes + pub members: BTreeMap, + /// The threshold quorum public key + pub threshold_public_key: bls_signatures::PublicKey, +} + +impl From for dpp::core_types::validator_set::v0::ValidatorSetV0 { + fn from(value: ValidatorSetV0) -> Self { + let ValidatorSetV0 { + quorum_hash, + quorum_index, + core_height, + members, + threshold_public_key, + } = value; + Self { + quorum_hash, + quorum_index, + core_height, + members: members + .into_iter() + .map(|(pro_tx_hash, validator)| (pro_tx_hash, validator.into())) + .collect(), + threshold_public_key: PublicKey::try_from(threshold_public_key.to_bytes().as_slice()) + .expect("this should not be possible to error as the threshold_public_key was already verified on disk"), + } + } +} + +/// A validator in the context of a quorum +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub(super) struct ValidatorV0 { + /// The proTxHash + pub pro_tx_hash: ProTxHash, + /// The public key share of this validator for this quorum + pub public_key: Option, + /// The node address + pub node_ip: String, + /// The node id + pub node_id: PubkeyHash, + /// Core port + pub core_port: u16, + /// Http port + pub platform_http_port: u16, + /// Tenderdash port + pub platform_p2p_port: u16, + /// Is the validator banned + pub is_banned: bool, +} + +impl From for dpp::core_types::validator::v0::ValidatorV0 { + fn from(value: ValidatorV0) -> Self { + let ValidatorV0 { + pro_tx_hash, + public_key, + node_ip, + node_id, + core_port, + platform_http_port, + platform_p2p_port, + is_banned, + } = value; + Self { + pro_tx_hash, + public_key: public_key.map(|pk| PublicKey::try_from(pk.to_bytes().as_slice()).expect("this should not be possible to error as the public_key was already verified on disk")), + node_ip, + node_id, + core_port, + platform_http_port, + platform_p2p_port, + is_banned, + } + } +} diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs index 8d0eac3c0a..a314829a7d 100644 --- a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs @@ -4,6 +4,7 @@ use crate::config::QuorumLikeConfig; use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::signature_verification_quorum_set::v0::for_saving::SignatureVerificationQuorumSetForSavingV0; +use crate::platform_types::signature_verification_quorum_set::v0::for_saving_v1::SignatureVerificationQuorumSetForSavingV1; pub use crate::platform_types::signature_verification_quorum_set::v0::quorum_set::{ QuorumConfig, QuorumsWithConfig, SelectedQuorumSetIterator, SignatureVerificationQuorumSetV0, SignatureVerificationQuorumSetV0Methods, SIGN_OFFSET, @@ -118,13 +119,15 @@ impl SignatureVerificationQuorumSetV0Methods for SignatureVerificationQuorumSet pub enum SignatureVerificationQuorumSetForSaving { /// Version 0 of the signature verification quorums V0(SignatureVerificationQuorumSetForSavingV0), + /// Version 1 of the signature verification quorums + V1(SignatureVerificationQuorumSetForSavingV1), } impl From for SignatureVerificationQuorumSetForSaving { fn from(value: SignatureVerificationQuorumSet) -> Self { match value { SignatureVerificationQuorumSet::V0(v0) => { - SignatureVerificationQuorumSetForSaving::V0(v0.into()) + SignatureVerificationQuorumSetForSaving::V1(v0.into()) } } } @@ -136,6 +139,9 @@ impl From for SignatureVerificationQuor SignatureVerificationQuorumSetForSaving::V0(v0) => { SignatureVerificationQuorumSet::V0(v0.into()) } + SignatureVerificationQuorumSetForSaving::V1(v1) => { + SignatureVerificationQuorumSet::V0(v1.into()) + } } } } diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs index a1ce283885..de69aff56d 100644 --- a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs @@ -3,7 +3,7 @@ use crate::platform_types::signature_verification_quorum_set::v0::quorum_set::{ }; use crate::platform_types::signature_verification_quorum_set::{ Quorums, SignatureVerificationQuorumSetForSaving, SignatureVerificationQuorumSetV0, - ThresholdBlsPublicKey, VerificationQuorum, + VerificationQuorum, }; use dashcore_rpc::dashcore::hashes::Hash; use dashcore_rpc::dashcore::QuorumHash; @@ -135,7 +135,7 @@ impl From for PreviousPastQuorumsV0 { pub struct QuorumForSavingV0 { hash: Bytes32, #[bincode(with_serde)] - public_key: ThresholdBlsPublicKey, + public_key: bls_signatures::PublicKey, index: Option, } @@ -145,7 +145,10 @@ impl From> for Quorums { ( QuorumHash::from_byte_array(quorum.hash.to_buffer()), VerificationQuorum { - public_key: quorum.public_key, + public_key: dpp::bls_signatures::PublicKey::try_from( + quorum.public_key.to_bytes().as_slice(), + ) + .expect("expected to convert between BLS key libraries (from chia)"), index: quorum.index, }, ) @@ -153,13 +156,16 @@ impl From> for Quorums { } } -#[allow(clippy::from_over_into)] -impl Into> for Quorums { - fn into(self) -> Vec { - self.into_iter() +impl From> for Vec { + fn from(quorums: Quorums) -> Self { + quorums + .into_iter() .map(|(hash, quorum)| QuorumForSavingV0 { hash: Bytes32::from(hash.as_byte_array()), - public_key: quorum.public_key, + public_key: bls_signatures::PublicKey::from_bytes( + &quorum.public_key.0.to_compressed(), + ) + .expect("expected to convert between BLS key libraries (to chia)"), index: quorum.index, }) .collect() diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving_v1.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving_v1.rs new file mode 100644 index 0000000000..bfb596e451 --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving_v1.rs @@ -0,0 +1,92 @@ +use crate::platform_types::signature_verification_quorum_set::v0::for_saving::{ + PreviousPastQuorumsForSavingV0, QuorumConfigForSavingV0, +}; +use crate::platform_types::signature_verification_quorum_set::{ + Quorums, SignatureVerificationQuorumSetForSaving, SignatureVerificationQuorumSetV0, + ThresholdBlsPublicKey, VerificationQuorum, +}; +use dashcore_rpc::dashcore::hashes::Hash; +use dashcore_rpc::dashcore::QuorumHash; +use dpp::bls_signatures::Bls12381G2Impl; +use dpp::identity::state_transition::asset_lock_proof::Encode; +use dpp::platform_serialization::de::Decode; +use dpp::platform_value::Bytes32; + +#[derive(Debug, Clone, Encode, Decode)] +pub struct SignatureVerificationQuorumSetForSavingV1 { + config: QuorumConfigForSavingV0, + current_quorums: Vec, + previous_quorums: Option, +} + +impl From for SignatureVerificationQuorumSetForSaving { + fn from(value: SignatureVerificationQuorumSetForSavingV1) -> Self { + SignatureVerificationQuorumSetForSaving::V1(value) + } +} + +impl From for SignatureVerificationQuorumSetForSavingV1 { + fn from(value: SignatureVerificationQuorumSetV0) -> Self { + let SignatureVerificationQuorumSetV0 { + config, + current_quorums, + previous, + } = value; + + Self { + config: config.into(), + current_quorums: current_quorums.into(), + previous_quorums: previous.map(|previous| previous.into()), + } + } +} + +impl From for SignatureVerificationQuorumSetV0 { + fn from(value: SignatureVerificationQuorumSetForSavingV1) -> Self { + let SignatureVerificationQuorumSetForSavingV1 { + config, + current_quorums, + previous_quorums, + } = value; + + Self { + config: config.into(), + current_quorums: current_quorums.into(), + previous: previous_quorums.map(|previous| previous.into()), + } + } +} + +#[derive(Debug, Clone, Encode, Decode)] +pub struct QuorumForSavingV1 { + hash: Bytes32, + #[bincode(with_serde)] + public_key: ThresholdBlsPublicKey, + index: Option, +} + +impl From> for Quorums { + fn from(value: Vec) -> Self { + Quorums::from_iter(value.into_iter().map(|quorum| { + ( + QuorumHash::from_byte_array(quorum.hash.to_buffer()), + VerificationQuorum { + public_key: quorum.public_key, + index: quorum.index, + }, + ) + })) + } +} +impl From> for Vec { + fn from(quorums: Quorums) -> Self { + quorums + .into_iter() + .map(|(hash, quorum)| QuorumForSavingV1 { + hash: Bytes32::from(hash.as_byte_array()), + public_key: quorum.public_key, + index: quorum.index, + }) + .collect() + } +} diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs index e78d6c1c7f..f38657c29c 100644 --- a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/mod.rs @@ -1,3 +1,4 @@ pub mod for_saving; +pub mod for_saving_v1; pub mod quorum_set; pub mod quorums; diff --git a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs index 112b877a9b..7a38272f90 100644 --- a/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs +++ b/packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs @@ -1,13 +1,13 @@ use derive_more::{Deref, DerefMut, From}; -use dpp::bls_signatures::PrivateKey; +use dpp::bls_signatures; +pub use dpp::bls_signatures::PublicKey as ThresholdBlsPublicKey; +use dpp::bls_signatures::{Bls12381G2Impl, SignatureSchemes}; use dpp::dashcore::bls_sig_utils::BLSSignature; use dpp::dashcore::{QuorumHash, Txid}; use std::collections::BTreeMap; use std::convert::TryInto; use std::fmt::Debug; -pub use dpp::bls_signatures::PublicKey as ThresholdBlsPublicKey; - use crate::error::Error; use crate::platform_types::signature_verification_quorum_set::QuorumConfig; use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; @@ -149,17 +149,14 @@ pub struct VerificationQuorum { /// Quorum threshold public key is used to verify /// signatures produced by corresponding quorum - pub public_key: ThresholdBlsPublicKey, + pub public_key: ThresholdBlsPublicKey, } impl Debug for VerificationQuorum { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("VerificationQuorum") .field("index", &self.index) - .field( - "public_key", - &hex::encode(*self.public_key.to_bytes()).to_string(), - ) + .field("public_key", &self.public_key.to_string()) .finish() } } @@ -210,11 +207,21 @@ impl SigningQuorum { let message_digest = sha256d::Hash::from_engine(engine); let private_key = - PrivateKey::from_bytes(&self.private_key, false).map_err(Error::BLSError)?; - - let g2element = private_key.sign(message_digest.as_ref()); - let g2element_bytes = *g2element.to_bytes(); + bls_signatures::SecretKey::::from_be_bytes(&self.private_key) + .into_option() + .ok_or(Error::BLSError( + dpp::bls_signatures::BlsError::DeserializationError( + "Could not deserialize private key".to_string(), + ), + ))?; + + let signature = private_key + .sign( + SignatureSchemes::Basic, + message_digest.as_byte_array().as_slice(), + ) + .map_err(Error::BLSError)?; - Ok(BLSSignature::from(g2element_bytes)) + Ok(BLSSignature::from(signature.as_raw_value().to_compressed())) } } diff --git a/packages/rs-drive-abci/src/platform_types/validator/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/validator/v0/mod.rs index 433fe506bf..798713b0e0 100644 --- a/packages/rs-drive-abci/src/platform_types/validator/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/validator/v0/mod.rs @@ -1,14 +1,14 @@ use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use dashcore_rpc::json::{DMNState, MasternodeListItem}; -use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::bls_signatures::{Bls12381G2Impl, PublicKey as BlsPublicKey}; pub use dpp::core_types::validator::v0::*; use dpp::dashcore::hashes::Hash; use dpp::dashcore::{ProTxHash, PubkeyHash}; pub(crate) trait NewValidatorIfMasternodeInState { fn new_validator_if_masternode_in_state( pro_tx_hash: ProTxHash, - public_key: Option, + public_key: Option>, state: &PlatformState, ) -> Option; } @@ -17,7 +17,7 @@ impl NewValidatorIfMasternodeInState for ValidatorV0 { /// Makes a validator if the masternode is in the list and is valid fn new_validator_if_masternode_in_state( pro_tx_hash: ProTxHash, - public_key: Option, + public_key: Option>, state: &PlatformState, ) -> Option { let MasternodeListItem { state, .. } = state.hpmn_masternode_list().get(&pro_tx_hash)?; diff --git a/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs index f7141d1ff4..6ce9f40c0b 100644 --- a/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs @@ -55,8 +55,8 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { return Err(Error::Execution(ExecutionError::CorruptedCachedState( format!( "updating validator set doesn't match threshold public key ours: {} theirs: {}", - hex::encode(*self.threshold_public_key.to_bytes()), - hex::encode(*rhs.threshold_public_key.to_bytes()) + hex::encode(self.threshold_public_key.0.to_compressed()), + hex::encode(rhs.threshold_public_key.0.to_compressed()) ), ))); } @@ -99,7 +99,9 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { Some(Ok(abci::ValidatorUpdate { pub_key: public_key.clone().map(|public_key| { crypto::PublicKey { - sum: Some(Bls12381(public_key.to_bytes().to_vec())), + sum: Some(Bls12381( + public_key.0.to_compressed().to_vec(), + )), } }), power: 100, @@ -131,7 +133,9 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { Some(Ok(abci::ValidatorUpdate { pub_key: public_key.clone().map(|public_key| { crypto::PublicKey { - sum: Some(Bls12381(public_key.to_bytes().to_vec())), + sum: Some(Bls12381( + public_key.0.to_compressed().to_vec(), + )), } }), power: 100, @@ -148,7 +152,9 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { Ok(ValidatorSetUpdate { validator_updates, threshold_public_key: Some(crypto::PublicKey { - sum: Some(Bls12381(self.threshold_public_key.to_bytes().to_vec())), + sum: Some(Bls12381( + self.threshold_public_key.0.to_compressed().to_vec(), + )), }), quorum_hash: self.quorum_hash.to_byte_array().to_vec(), }) @@ -186,7 +192,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { ); Some(abci::ValidatorUpdate { pub_key: public_key.as_ref().map(|public_key| crypto::PublicKey { - sum: Some(Bls12381(public_key.to_bytes().to_vec())), + sum: Some(Bls12381(public_key.0.to_compressed().to_vec())), }), power: 100, pro_tx_hash: pro_tx_hash.to_byte_array().to_vec(), @@ -195,7 +201,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { }) .collect(), threshold_public_key: Some(crypto::PublicKey { - sum: Some(Bls12381(threshold_public_key.to_bytes().to_vec())), + sum: Some(Bls12381(threshold_public_key.0.to_compressed().to_vec())), }), quorum_hash: quorum_hash.to_byte_array().to_vec(), } @@ -233,7 +239,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { Some(abci::ValidatorUpdate { pub_key: public_key.map(|public_key| crypto::PublicKey { - sum: Some(Bls12381(public_key.to_bytes().to_vec())), + sum: Some(Bls12381(public_key.0.to_compressed().to_vec())), }), power: 100, pro_tx_hash: pro_tx_hash.to_byte_array().to_vec(), @@ -242,7 +248,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { }) .collect(), threshold_public_key: Some(crypto::PublicKey { - sum: Some(Bls12381(threshold_public_key.to_bytes().to_vec())), + sum: Some(Bls12381(threshold_public_key.0.to_compressed().to_vec())), }), quorum_hash: quorum_hash.to_byte_array().to_vec(), } @@ -271,7 +277,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { } let public_key = if let Some(public_key_share) = quorum_member.pub_key_share { - match BlsPublicKey::from_bytes(public_key_share.as_slice()) + match BlsPublicKey::try_from(public_key_share.as_slice()) .map_err(ExecutionError::BlsErrorFromDashCoreResponse) { Ok(public_key) => Some(public_key), @@ -290,7 +296,7 @@ impl ValidatorSetMethodsV0 for ValidatorSetV0 { }) .collect::, Error>>()?; - let threshold_public_key = BlsPublicKey::from_bytes(quorum_public_key.as_slice()) + let threshold_public_key = BlsPublicKey::try_from(quorum_public_key.as_slice()) .map_err(ExecutionError::BlsErrorFromDashCoreResponse)?; let optional_quorum_index = if quorum_index == 0 { diff --git a/packages/rs-drive-abci/src/query/system/current_quorums_info/v0/mod.rs b/packages/rs-drive-abci/src/query/system/current_quorums_info/v0/mod.rs index f512f4b8f0..bf75b0c522 100644 --- a/packages/rs-drive-abci/src/query/system/current_quorums_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/current_quorums_info/v0/mod.rs @@ -40,7 +40,11 @@ impl Platform { quorum_hash: validator_set.quorum_hash().as_byte_array().to_vec(), core_height: validator_set.core_height(), members, - threshold_public_key: validator_set.threshold_public_key().to_bytes().to_vec(), + threshold_public_key: validator_set + .threshold_public_key() + .0 + .to_compressed() + .to_vec(), } }) .collect(); diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index 777dc361a2..d02a11e950 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -20,7 +20,7 @@ use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV use strategy_tests::operations::FinalizeBlockOperation::IdentityAddKeys; use dashcore_rpc::json::{ExtendedQuorumListResult, SoftforkInfo}; -use dpp::bls_signatures::PrivateKey; +use dpp::bls_signatures::{Bls12381G2Impl, SecretKey as BlsPrivateKey, SignatureSchemes}; use dpp::dashcore::consensus::Encodable; use dpp::dashcore::hashes::{sha256d, HashEngine}; use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; @@ -352,7 +352,7 @@ pub(crate) fn run_chain_for_strategy<'a>( instant_lock_quorums_infos .iter() .map(|(quorum_hash, info)| { - let bytes = info.private_key.to_bytes(); + let bytes = info.private_key.to_be_bytes(); let fixed_bytes: [u8; 32] = bytes .as_slice() .try_into() @@ -379,7 +379,7 @@ pub(crate) fn run_chain_for_strategy<'a>( let signing_quorums = validator_quorums .iter() .map(|(quorum_hash, info)| { - let bytes = info.private_key.to_bytes(); + let bytes = info.private_key.to_be_bytes(); let fixed_bytes: [u8; 32] = bytes .as_slice() .try_into() @@ -653,7 +653,7 @@ pub(crate) fn run_chain_for_strategy<'a>( let chain_lock_quorums_private_keys: BTreeMap = chain_lock_quorums .iter() .map(|(quorum_hash, info)| { - let bytes = info.private_key.to_bytes(); + let bytes = info.private_key.to_be_bytes(); let fixed_bytes: [u8; 32] = bytes .as_slice() .try_into() @@ -728,13 +728,18 @@ pub(crate) fn run_chain_for_strategy<'a>( let message_digest = sha256d::Hash::from_engine(engine); let quorum_private_key = - PrivateKey::from_bytes(quorum_private_key.as_slice(), false) + BlsPrivateKey::::from_be_bytes(quorum_private_key) .expect("expected to have a valid private key"); - let signature = quorum_private_key.sign(message_digest.as_byte_array()); + let signature = quorum_private_key + .sign( + SignatureSchemes::Basic, + message_digest.as_byte_array().as_slice(), + ) + .expect("expected to sign"); let chain_lock = ChainLock { block_height, block_hash: BlockHash::from_byte_array(*block_hash), - signature: (*signature.to_bytes()).into(), + signature: signature.as_raw_value().to_compressed().into(), }; Ok(chain_lock) @@ -847,7 +852,9 @@ pub(crate) fn start_chain_for_strategy( .map( |validator_in_quorum| tenderdash_abci::proto::abci::ValidatorUpdate { pub_key: Some(tenderdash_abci::proto::crypto::PublicKey { - sum: Some(Bls12381(validator_in_quorum.public_key.to_bytes().to_vec())), + sum: Some(Bls12381( + validator_in_quorum.public_key.0.to_compressed().to_vec(), + )), }), power: 100, pro_tx_hash: validator_in_quorum.pro_tx_hash.to_byte_array().to_vec(), @@ -857,7 +864,11 @@ pub(crate) fn start_chain_for_strategy( .collect(), threshold_public_key: Some(tenderdash_abci::proto::crypto::PublicKey { sum: Some(Bls12381( - current_quorum_with_test_info.public_key.to_bytes().to_vec(), + current_quorum_with_test_info + .public_key + .0 + .to_compressed() + .to_vec(), )), }), quorum_hash: current_validator_quorum_hash.to_byte_array().to_vec(), diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index 03bb92bc1a..4194e30689 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -3,7 +3,7 @@ extern crate core; -use dpp::bls_signatures::PrivateKey as BlsPrivateKey; +use dpp::bls_signatures::SecretKey as BlsPrivateKey; use drive_abci::test::helpers::setup::TestPlatformBuilder; use drive_abci::{config::PlatformConfig, test::helpers::setup::TempPlatform}; diff --git a/packages/rs-drive-abci/tests/strategy_tests/masternode_list_item_helpers.rs b/packages/rs-drive-abci/tests/strategy_tests/masternode_list_item_helpers.rs index f89be95ee1..4084e7f065 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/masternode_list_item_helpers.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/masternode_list_item_helpers.rs @@ -1,5 +1,6 @@ use crate::BlsPrivateKey; use dashcore_rpc::json::MasternodeListItem; +use dpp::bls_signatures::Bls12381G2Impl; use rand::prelude::IteratorRandom; use rand::rngs::StdRng; use rand::Rng; @@ -32,13 +33,16 @@ impl UpdateMasternodeListItem for MasternodeListItem { 1 => self.state.voting_address = rng.gen::<[u8; 20]>(), 2 => self.state.payout_address = rng.gen::<[u8; 20]>(), 3 => { - let private_key_operator = BlsPrivateKey::generate_dash(rng) - .expect("expected to generate a private key"); - let pub_key_operator = private_key_operator - .g1_element() - .expect("expected to get public key") + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(rng) + .expect("expected to generate a private key") .to_bytes() .to_vec(); + let private_key_operator = BlsPrivateKey::::from_be_bytes( + &private_key_operator_bytes.try_into().expect("expected the secret key to be 32 bytes"), + ) + .expect("expected the conversion between bls signatures library and blsful to happen without failing"); + let pub_key_operator = + private_key_operator.public_key().0.to_compressed().to_vec(); self.state.pub_key_operator = pub_key_operator; } 4 => { @@ -83,13 +87,15 @@ mod tests { let mut rng = StdRng::seed_from_u64(0); let i = 0; let pro_tx_hash = ProTxHash::from_byte_array(rng.gen::<[u8; 32]>()); - let private_key_operator = - BlsPrivateKey::generate_dash(&mut rng).expect("expected to generate a private key"); - let pub_key_operator = private_key_operator - .g1_element() - .expect("expected to get public key") + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(&mut rng) + .expect("expected to generate a private key") .to_bytes() .to_vec(); + let private_key_operator = BlsPrivateKey::::from_be_bytes( + &private_key_operator_bytes.try_into().expect("expected the secret key to be 32 bytes"), + ) + .expect("expected the conversion between bls signatures library and blsful to happen without failing"); + let pub_key_operator = private_key_operator.public_key().0.to_compressed().to_vec(); let masternode_list_item = MasternodeListItem { node_type: MasternodeType::Regular, pro_tx_hash, diff --git a/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs b/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs index 51693b5b60..02a647b66c 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/masternodes.rs @@ -2,7 +2,7 @@ use crate::masternode_list_item_helpers::UpdateMasternodeListItem; use dashcore_rpc::dashcore::hashes::Hash; use dashcore_rpc::dashcore::{ProTxHash, QuorumHash, Txid}; use dashcore_rpc::dashcore_rpc_json::{DMNState, MasternodeListItem, MasternodeType}; -use dpp::bls_signatures::PrivateKey as BlsPrivateKey; +use dpp::bls_signatures::{Bls12381G2Impl, SecretKey as BlsPrivateKey}; use dpp::identity::hash::IdentityPublicKeyHashMethodsV0; use dpp::identity::IdentityPublicKey; use drive_abci::mimic::test_quorum::TestQuorumInfo; @@ -209,13 +209,15 @@ pub fn generate_test_masternodes( } for i in 0..masternode_count { - let private_key_operator = - BlsPrivateKey::generate_dash(rng).expect("expected to generate a private key"); - let pub_key_operator = private_key_operator - .g1_element() - .expect("expected to get public key") + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(rng) + .expect("expected to generate a private key") .to_bytes() .to_vec(); + let private_key_operator = BlsPrivateKey::::from_be_bytes( + &private_key_operator_bytes.try_into().expect("expected the secret key to be 32 bytes"), + ) + .expect("expected the conversion between bls signatures library and blsful to happen without failing"); + let pub_key_operator = private_key_operator.public_key().0.to_compressed().to_vec(); let pro_tx_hash = ProTxHash::from_byte_array(rng.gen::<[u8; 32]>()); let masternode_list_item = MasternodeListItem { node_type: MasternodeType::Regular, @@ -345,13 +347,15 @@ pub fn generate_test_masternodes( } for i in 0..hpmn_count { - let private_key_operator = - BlsPrivateKey::generate_dash(rng).expect("expected to generate a private key"); - let pub_key_operator = private_key_operator - .g1_element() - .expect("expected to get public key") + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(rng) + .expect("expected to generate a private key") .to_bytes() .to_vec(); + let private_key_operator = BlsPrivateKey::::from_be_bytes( + &private_key_operator_bytes.try_into().expect("expected the secret key to be 32 bytes"), + ) + .expect("expected the conversion between bls signatures library and blsful to happen without failing"); + let pub_key_operator = private_key_operator.public_key().0.to_compressed().to_vec(); let masternode_list_item = MasternodeListItem { node_type: MasternodeType::Evo, pro_tx_hash: ProTxHash::from_byte_array(rng.gen::<[u8; 32]>()), diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index a7b035dfdb..56f166ab74 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -5,6 +5,7 @@ use dapi_grpc::platform::v0::{ GetIdentityByPublicKeyHashRequest, Proof, }; use dashcore_rpc::dashcore_rpc_json::QuorumType; +use dpp::bls_signatures::{Bls12381G2Impl, BlsError, Pairing, Signature}; use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::identity_public_key::methods::hash::IdentityPublicKeyHashMethodsV0; @@ -68,7 +69,7 @@ pub struct ProofVerification<'a> { pub signature: &'a [u8; 96], /// Threshold key used to verify the signature - pub public_key: &'a dpp::bls_signatures::PublicKey, + pub public_key: &'a dpp::bls_signatures::PublicKey, } impl<'a> ProofVerification<'a> { @@ -105,17 +106,20 @@ impl<'a> ProofVerification<'a> { Err(e) => return SimpleValidationResult::new_with_error(e.into()), }; // We could have received a fake commit, so signature validation needs to be returned if error as a simple validation result - let signature = match dpp::bls_signatures::Signature::from_bytes(self.signature) { - Ok(signature) => signature, - Err(e) => { - return SimpleValidationResult::new_with_error( - AbciError::BlsErrorOfTenderdashThresholdMechanism( - e, - format!("Malformed signature data: {}", hex::encode(self.signature)), - ), - ); - } - }; + let signature = + match ::Signature::from_compressed(self.signature) + .into_option() + { + Some(signature) => Signature::Basic(signature), + None => { + return SimpleValidationResult::new_with_error( + AbciError::BlsErrorOfTenderdashThresholdMechanism( + BlsError::InvalidSignature, + format!("malformed signature data: {}", hex::encode(self.signature)), + ), + ); + } + }; tracing::trace!( digest=hex::encode(&digest), ?state_id, @@ -123,14 +127,11 @@ impl<'a> ProofVerification<'a> { verification_context = ?self, "Proof verification" ); - match self.public_key.verify(&signature, &digest) { - true => SimpleValidationResult::default(), - false => { - SimpleValidationResult::new_with_error(AbciError::BadCommitSignature(format!( - "commit signature {} is wrong", - hex::encode(signature.to_bytes().as_slice()) - ))) - } + match signature.verify(self.public_key, &digest) { + Ok(_) => SimpleValidationResult::default(), + Err(e) => SimpleValidationResult::new_with_error(AbciError::BadCommitSignature( + format!("commit signature {} is wrong: {}", signature, e), + )), } } diff --git a/packages/rs-drive-proof-verifier/src/unproved.rs b/packages/rs-drive-proof-verifier/src/unproved.rs index cc7c63c83e..93e18b7e21 100644 --- a/packages/rs-drive-proof-verifier/src/unproved.rs +++ b/packages/rs-drive-proof-verifier/src/unproved.rs @@ -249,8 +249,8 @@ impl FromUnproved for CurrentQuorumsInfo quorum_index: None, // Assuming it's not provided here core_height: vs.core_height, members, - threshold_public_key: BlsPublicKey::from_bytes( - &vs.threshold_public_key, + threshold_public_key: BlsPublicKey::try_from( + vs.threshold_public_key.as_slice(), ) .map_err(|_| Error::ProtocolError { error: "Invalid BlsPublicKey format".to_string(), diff --git a/packages/rs-drive-proof-verifier/src/verify.rs b/packages/rs-drive-proof-verifier/src/verify.rs index 284efb5a89..6015999df2 100644 --- a/packages/rs-drive-proof-verifier/src/verify.rs +++ b/packages/rs-drive-proof-verifier/src/verify.rs @@ -1,13 +1,13 @@ use dapi_grpc::platform::v0::{Proof, ResponseMetadata}; use dpp::bls_signatures; +use crate::Error; +use dpp::bls_signatures::{Bls12381G2Impl, Pairing, Signature}; use tenderdash_abci::{ proto::types::{CanonicalVote, SignedMsgType, StateId}, signatures::{Hashable, Signable}, }; -use crate::Error; - use crate::ContextProvider; /// Verify cryptographic proof generated by Tenderdash @@ -92,11 +92,10 @@ pub(crate) fn verify_tenderdash_proof( } })?; - let pubkey = bls_signatures::PublicKey::from_bytes(&pubkey_bytes).map_err(|e| { - Error::InvalidPublicKey { + let pubkey = bls_signatures::PublicKey::::try_from(pubkey_bytes.as_slice()) + .map_err(|e| Error::InvalidPublicKey { error: e.to_string(), - } - })?; + })?; tracing::trace!( ?state_id, @@ -123,18 +122,20 @@ pub(crate) fn verify_tenderdash_proof( pub fn verify_signature_digest( sign_digest: &[u8], signature: &[u8; 96], - public_key: &bls_signatures::PublicKey, + public_key: &bls_signatures::PublicKey, ) -> Result { if signature == &[0; 96] { return Err(Error::SignatureVerificationError { error: "empty signature".to_string(), }); } - let signature = bls_signatures::Signature::from_bytes(signature).map_err(|e| { - Error::SignatureVerificationError { - error: e.to_string(), - } - })?; + let signature = Signature::Basic( + ::Signature::from_compressed(&signature) + .into_option() + .ok_or(Error::SignatureVerificationError { + error: "Could not verify signature digest".to_string(), + })?, + ); - Ok(public_key.verify(&signature, sign_digest)) + Ok(signature.verify(public_key, sign_digest).is_ok()) } diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index fdf02c2e30..9cce344782 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -35,7 +35,7 @@ envy = { version = "0.4.2", optional = true } futures = { version = "0.3.30" } derive_more = { version = "1.0", features = ["from"] } # dashcore-rpc is only needed for core rpc; TODO remove once we have correct core rpc impl -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.8" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.9" } lru = { version = "0.12.3", optional = true } bip37-bloom-filter = { git = "https://github.com/dashpay/rs-bip37-bloom-filter", branch = "develop" } zeroize = { version = "1.8", features = ["derive"] } diff --git a/packages/rs-sdk/src/lib.rs b/packages/rs-sdk/src/lib.rs index f965730c83..fe2c51ab06 100644 --- a/packages/rs-sdk/src/lib.rs +++ b/packages/rs-sdk/src/lib.rs @@ -71,6 +71,7 @@ pub mod sdk; pub use error::Error; pub use sdk::{RequestSettings, Sdk, SdkBuilder}; +pub use dapi_grpc; pub use dashcore_rpc; pub use dpp; pub use drive; diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 95b14fa8ed..44e3caad25 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -8,6 +8,6 @@ rust-version.workspace = true [dependencies] bincode = { version = "2.0.0-rc.3", features = ["serde"] } -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.8" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.9" } dpp = { path = "../rs-dpp", features = ["abci"] } base64 = { version = "0.22.1" } diff --git a/packages/simple-signer/src/signer.rs b/packages/simple-signer/src/signer.rs index 448e1a5c9c..d93acb5aee 100644 --- a/packages/simple-signer/src/signer.rs +++ b/packages/simple-signer/src/signer.rs @@ -2,6 +2,7 @@ use base64::prelude::BASE64_STANDARD; use base64::Engine; use dashcore_rpc::dashcore::signer; use dpp::bincode::{Decode, Encode}; +use dpp::bls_signatures::{Bls12381G2Impl, SignatureSchemes}; use dpp::ed25519_dalek::Signer as BlsSigner; use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV0; use dpp::identity::signer::Signer; @@ -16,9 +17,9 @@ use std::fmt::{Debug, Formatter}; #[derive(Default, Clone, PartialEq, Encode, Decode)] pub struct SimpleSigner { /// Private keys is a map from the public key to the Private key bytes - pub private_keys: BTreeMap>, + pub private_keys: BTreeMap, /// Private keys to be added at the end of a block - pub private_keys_in_creation: BTreeMap>, + pub private_keys_in_creation: BTreeMap, } impl Debug for SimpleSigner { @@ -46,12 +47,12 @@ impl Debug for SimpleSigner { impl SimpleSigner { /// Add a key to the signer - pub fn add_key(&mut self, public_key: IdentityPublicKey, private_key: Vec) { + pub fn add_key(&mut self, public_key: IdentityPublicKey, private_key: [u8; 32]) { self.private_keys.insert(public_key, private_key); } /// Add keys to the signer - pub fn add_keys)>>(&mut self, keys: I) { + pub fn add_keys>(&mut self, keys: I) { self.private_keys.extend(keys) } @@ -81,13 +82,15 @@ impl Signer for SimpleSigner { Ok(signature.to_vec().into()) } KeyType::BLS12_381 => { - let pk = - bls_signatures::PrivateKey::from_bytes(private_key, false).map_err(|_e| { - ProtocolError::Generic( - "bls private key from bytes isn't correct".to_string(), - ) - })?; - Ok(pk.sign(data).to_bytes().to_vec().into()) + let pk = bls_signatures::SecretKey::::from_be_bytes(private_key) + .into_option() + .ok_or(ProtocolError::Generic( + "bls private key from bytes isn't correct".to_string(), + ))?; + let signature = pk + .sign(SignatureSchemes::Basic, data) + .map_err(|e| ProtocolError::Generic(format!("BLS signing failed {}", e)))?; + Ok(signature.as_raw_value().to_compressed().to_vec().into()) } KeyType::EDDSA_25519_HASH160 => { let key: [u8; 32] = private_key.clone().try_into().expect("expected 32 bytes");