diff --git a/Cargo.lock b/Cargo.lock index 4ce11703..40e50240 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,12 +73,12 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.2.15", + "getrandom 0.3.2", "once_cell", "version_check", "zerocopy", @@ -112,15 +112,16 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2179ba839ac532f50279f5da2a6c5047f791f03f6f808b4dfab11327b97902f" +checksum = "35f021a55afd68ff2364ccfddaa364fc9a38a72200cdc74fcfb8dc3231d38f2c" dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", "alloy-serde", "alloy-trie", + "alloy-tx-macros", "auto_impl", "c-kzg", "derive_more 2.0.1", @@ -128,6 +129,7 @@ dependencies = [ "k256", "once_cell", "rand 0.8.5", + "secp256k1 0.30.0", "serde", "serde_with", "thiserror 2.0.16", @@ -135,9 +137,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec6f67bdc62aa277e0ec13c1b1fb396c8a62b65c8e9bd8c1d3583cc6d1a8dd3" +checksum = "5a0ecca7a71b1f88e63d19e2d9397ce56949d3dd3484fd73c73d0077dc5c93d4" dependencies = [ "alloy-consensus", "alloy-eips", @@ -195,9 +197,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609515c1955b33af3d78d26357540f68c5551a90ef58fd53def04f2aa074ec43" +checksum = "7473a19f02b25f8e1e8c69d35f02c07245694d11bd91bfe00e9190ac106b3838" dependencies = [ "alloy-eip2124", "alloy-eip2930", @@ -215,9 +217,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dfec8348d97bd624901c6a4b22bb4c24df8a3128fc3d5e42d24f7b79dfa8588" +checksum = "17b2c29f25098bfa4cd3d9ec7806e1506716931e188c7c0843284123831c2cf1" dependencies = [ "alloy-eips", "alloy-primitives", @@ -253,12 +255,13 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3994ab6ff6bdeb5aebe65381a8f6a47534789817570111555e8ac413e242ce06" +checksum = "7a4d1f49fdf9780b60e52c20ffcc1e352d8d27885cc8890620eb584978265dd9" dependencies = [ "alloy-primitives", "alloy-sol-types", + "http 1.3.1", "serde", "serde_json", "thiserror 2.0.16", @@ -267,9 +270,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be3aa020a6d3aa7601185b4c1a7d6f3a5228cb5424352db63064b29a455c891" +checksum = "2991c432e149babfd996194f8f558f85d7326ac4cf52c55732d32078ff0282d4" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -293,9 +296,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498f2ee2eef38a6db0fc810c7bf7daebdf5f2fa8d04adb8bd53e54e91ddbdea3" +checksum = "1d540d962ddbc3e95153bafe56ccefeb16dfbffa52c5f7bdd66cd29ec8f52259" dependencies = [ "alloy-consensus", "alloy-eips", @@ -306,9 +309,9 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60dd250ffe9514728daf5e84cac7193e221b85feffe3bea7d45f2b9fcbe6b885" +checksum = "05975c1090ae96b204ec6ac5e21ebca0c27da8fdd9dcf712cd173d7e31ae9865" dependencies = [ "alloy-genesis", "alloy-hardforks", @@ -354,9 +357,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6ba76d476f475668925f858cc4db51781f12abdaa4e0274eb57a09f574e869" +checksum = "7e96d8084a1cf96be2df6219ac407275ac20c1136fa01f911535eb489aa006e8" dependencies = [ "alloy-chains", "alloy-consensus", @@ -414,15 +417,13 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6a6985b48a536b47aa0aece56e6a0f49240ce5d33a7f0c94f1b312eda79aa1" +checksum = "194ff51cd1d2e65c66b98425e0ca7eb559ca1a579725834c986d84faf8e224c0" dependencies = [ "alloy-json-rpc", "alloy-primitives", "alloy-transport", - "alloy-transport-http", - "async-stream", "futures", "pin-project", "serde", @@ -431,15 +432,14 @@ dependencies = [ "tokio-stream", "tower 0.5.2", "tracing", - "tracing-futures", "wasmtimer", ] [[package]] name = "alloy-rpc-types-any" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1a40595b927dfb07218459037837dbc8de8500a26024bb6ff0548dd2ccc13e0" +checksum = "124b742619519d5932e586631f11050028b29c30e3e195f2bb04228c886253d6" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -448,19 +448,20 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05525519bd7f37f98875354f0b3693d3ad3c7a7f067e3b8946777920be15cb5b" +checksum = "1c6a6c8ae298c2739706ee3cd996c220b0ea406e6841a4e4290c7336edd5f811" dependencies = [ "alloy-primitives", + "derive_more 2.0.1", "serde", ] [[package]] name = "alloy-rpc-types-eth" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2a9f64e0f69cfb6029e2a044519a1bdd44ce9fc334d5315a7b9837f7a6748e5" +checksum = "781d4d5020bea8f020e164f5593101c2e2f790d66d04a0727839d03bc4411ed7" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -473,14 +474,15 @@ dependencies = [ "itertools 0.13.0", "serde", "serde_json", + "serde_with", "thiserror 2.0.16", ] [[package]] name = "alloy-rpc-types-trace" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bccbe4594eaa2d69d21fa0b558c44e36202e599eb209da70b405415cb37a354" +checksum = "719e5eb9c15e21dab3dee2cac53505500e5e701f25d556734279c5f02154022a" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -492,9 +494,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4dba6ff08916bc0a9cbba121ce21f67c0b554c39cf174bc7b9df6c651bd3c3b" +checksum = "30be84f45d4f687b00efaba1e6290cbf53ccc8f6b8fbb54e4c2f9d2a0474ce95" dependencies = [ "alloy-primitives", "serde", @@ -503,9 +505,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c580da7f00f3999e44e327223044d6732358627f93043e22d92c583f6583556" +checksum = "fa8c24b883fe56395db64afcd665fca32dcdef670a59e5338de6892c2e38d7e9" dependencies = [ "alloy-primitives", "async-trait", @@ -518,9 +520,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00f0f07862bd8f6bc66c953660693c5903062c2c9d308485b2a6eee411089e7" +checksum = "05724615fd2ec3417f5cd07cab908300cbb3aae5badc1b805ca70c555b26775f" dependencies = [ "alloy-consensus", "alloy-network", @@ -615,11 +617,13 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.14.0" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1f1a55f9ff9a48aa0b4a8c616803754620010fbb266edae2f4548f4304373b" +checksum = "20b7f8b6c540b55e858f958d3a92223494cf83c4fb43ff9b26491edbeb3a3b71" dependencies = [ "alloy-json-rpc", + "alloy-primitives", + "auto_impl", "base64 0.22.1", "derive_more 2.0.1", "futures", @@ -635,21 +639,11 @@ dependencies = [ "wasmtimer", ] -[[package]] -name = "alloy-transport-http" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171b3d8824b6697d6c8325373ec410d230b6c59ce552edfbfabe4e7b8a26aac3" -dependencies = [ - "alloy-transport", - "url", -] - [[package]] name = "alloy-trie" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983d99aa81f586cef9dae38443245e585840fcf0fc58b09aee0b1f27aed1d500" +checksum = "e3412d52bb97c6c6cc27ccc28d4e6e8cf605469101193b50b0bd5813b1f990b5" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -661,6 +655,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "alloy-tx-macros" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e29436068f836727d4e7c819ae6bf6f9c9e19a32e96fc23e814709a277f23a" +dependencies = [ + "alloy-primitives", + "darling", + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -717,11 +724,11 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1158,9 +1165,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" +checksum = "19634d6336019ef220f09fd31168ce5c184b295cbf80345437cc36094ef223ca" dependencies = [ "async-lock", "cfg-if", @@ -1169,10 +1176,9 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix", + "rustix 1.0.8", "slab", - "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1283,6 +1289,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + [[package]] name = "backtrace" version = "0.3.75" @@ -3040,17 +3052,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "enumn" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.106", -] - [[package]] name = "env_logger" version = "0.10.2" @@ -3083,7 +3084,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -3125,9 +3126,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ "event-listener 5.4.1", "pin-project-lite", @@ -3241,9 +3242,9 @@ dependencies = [ [[package]] name = "finality-grandpa" -version = "0.16.3" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f8f43dc520133541781ec03a8cab158ae8b7f7169cdf22e9050aa6cf0fbdfc" +checksum = "36530797b9bf31cd4ff126dcfee8170f86b00cfdcea3269d73133cc0415945c3" dependencies = [ "either", "futures", @@ -3889,8 +3890,18 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.10", + "regex-syntax 0.8.6", +] + +[[package]] +name = "gmp-mpfr-sys" +version = "1.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a636fb6a653382a379ee1e5593dacdc628667994167024c143214cafd40c1a86" +dependencies = [ + "libc", + "windows-sys 0.60.2", ] [[package]] @@ -4008,9 +4019,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hex" @@ -4218,7 +4229,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.8", "tokio", "tower-service", "tracing", @@ -4594,9 +4605,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jobserver" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ "getrandom 0.3.2", "libc", @@ -4703,8 +4714,7 @@ dependencies = [ [[package]] name = "k256" version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +source = "git+https://github.com/kayabaNerve/elliptic-curves?rev=fc92333e222b7f0cbe268d2ca92ed572f71f3e1d#fc92333e222b7f0cbe268d2ca92ed572f71f3e1d" dependencies = [ "cfg-if", "ecdsa", @@ -5718,6 +5728,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + [[package]] name = "lock_api" version = "0.4.13" @@ -5915,7 +5931,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix", + "rustix 0.38.44", ] [[package]] @@ -6649,9 +6665,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" dependencies = [ "hermit-abi", "libc", @@ -6673,6 +6689,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 2.0.106", @@ -6680,13 +6697,14 @@ dependencies = [ [[package]] name = "nybbles" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8983bb634df7248924ee0c4c3a749609b5abcb082c28fffe3254b3eb3602b307" +checksum = "63cb50036b1ad148038105af40aaa70ff24d8a14fbc44ae5c914e1348533d12e" dependencies = [ "alloy-rlp", - "const-hex", + "cfg-if", "proptest", + "ruint", "serde", "smallvec", ] @@ -6961,14 +6979,14 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.7.4" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.106", + "syn 1.0.109", ] [[package]] @@ -7210,17 +7228,16 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "polling" -version = "3.7.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645493cf344456ef24219d02a768cf1fb92ddf8c92161679ae3d91b91a637be3" +checksum = "b5bd19146350fe804f7cb2669c851c03d69da628803dab0d98018142aaa5d829" dependencies = [ "cfg-if", "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix", - "tracing", - "windows-sys 0.52.0", + "rustix 1.0.8", + "windows-sys 0.60.2", ] [[package]] @@ -7254,9 +7271,9 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] @@ -7471,7 +7488,7 @@ dependencies = [ "rand 0.9.2", "rand_chacha 0.9.0", "rand_xorshift", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", "rusty-fork", "tempfile", "unarray", @@ -7679,7 +7696,7 @@ dependencies = [ "once_cell", "socket2 0.5.8", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -7898,14 +7915,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.10", + "regex-syntax 0.8.6", ] [[package]] @@ -7919,13 +7936,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", ] [[package]] @@ -7936,9 +7953,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" [[package]] name = "resolv-conf" @@ -7948,9 +7965,9 @@ checksum = "95325155c684b1c89f7765e30bc1c42e4a6da51ca513615660cb8a62ef9a88e3" [[package]] name = "revm" -version = "22.0.1" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5378e95ffe5c8377002dafeb6f7d370a55517cef7d6d6c16fc552253af3b123" +checksum = "0c278b6ee9bba9e25043e3fae648fdce632d1944d3ba16f5203069b43bddd57f" dependencies = [ "revm-bytecode", "revm-context", @@ -7967,9 +7984,9 @@ dependencies = [ [[package]] name = "revm-bytecode" -version = "3.0.0" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63e138d520c5c5bc25ecc82506e9e4e6e85a811809fc5251c594378dccabfc6" +checksum = "66c52031b73cae95d84cd1b07725808b5fd1500da3e5e24574a3b2dc13d9f16d" dependencies = [ "bitvec", "phf", @@ -7979,10 +7996,11 @@ dependencies = [ [[package]] name = "revm-context" -version = "3.0.1" +version = "9.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9765628dfea4f3686aa8f2a72471c52801e6b38b601939ac16965f49bac66580" +checksum = "0fb02c5dab3b535aa5b18277b1d21c5117a25d42af717e6ce133df0ea56663e1" dependencies = [ + "bitvec", "cfg-if", "derive-where", "revm-bytecode", @@ -7995,13 +8013,14 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "3.0.0" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d74335aa1f14222cc4d3be1f62a029cc7dc03819cc8d080ff17b7e1d76375f" +checksum = "6b8e9311d27cf75fbf819e7ba4ca05abee1ae02e44ff6a17301c7ab41091b259" dependencies = [ "alloy-eip2930", "alloy-eip7702", "auto_impl", + "either", "revm-database-interface", "revm-primitives", "revm-state", @@ -8010,9 +8029,9 @@ dependencies = [ [[package]] name = "revm-database" -version = "3.0.0" +version = "7.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5c80c5a2fd605f2119ee32a63fb3be941fb6a81ced8cdb3397abca28317224" +checksum = "39a276ed142b4718dcf64bc9624f474373ed82ef20611025045c3fb23edbef9c" dependencies = [ "alloy-eips", "revm-bytecode", @@ -8024,11 +8043,12 @@ dependencies = [ [[package]] name = "revm-database-interface" -version = "3.0.0" +version = "7.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0e4dfbc734b1ea67b5e8f8b3c7dc4283e2210d978cdaf6c7a45e97be5ea53b3" +checksum = "8c523c77e74eeedbac5d6f7c092e3851dbe9c7fec6f418b85992bd79229db361" dependencies = [ "auto_impl", + "either", "revm-primitives", "revm-state", "serde", @@ -8036,11 +8056,12 @@ dependencies = [ [[package]] name = "revm-handler" -version = "3.0.1" +version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8676379521c7bf179c31b685c5126ce7800eab5844122aef3231b97026d41a10" +checksum = "528d2d81cc918d311b8231c35330fac5fba8b69766ddc538833e2b5593ee016e" dependencies = [ "auto_impl", + "derive-where", "revm-bytecode", "revm-context", "revm-context-interface", @@ -8054,11 +8075,12 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "3.0.1" +version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfed4ecf999a3f6ae776ae2d160478c5dca986a8c2d02168e04066b1e34c789e" +checksum = "bf443b664075999a14916b50c5ae9e35a7d71186873b8f8302943d50a672e5e0" dependencies = [ "auto_impl", + "either", "revm-context", "revm-database-interface", "revm-handler", @@ -8071,9 +8093,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "18.0.0" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb20260342003cfb791536e678ef5bbea1bfd1f8178b170e8885ff821985473" +checksum = "53d6406b711fac73b4f13120f359ed8e65964380dd6182bd12c4c09ad0d4641f" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -8083,44 +8105,46 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "19.0.0" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418e95eba68c9806c74f3e36cd5d2259170b61e90ac608b17ff8c435038ddace" +checksum = "25b57d4bd9e6b5fe469da5452a8a137bc2d030a3cd47c46908efc615bbc699da" dependencies = [ "ark-bls12-381", "ark-bn254", "ark-ec", "ark-ff 0.5.0", "ark-serialize 0.5.0", + "arrayref", "aurora-engine-modexp", "c-kzg", "cfg-if", "k256", "libsecp256k1", - "once_cell", "p256", "revm-primitives", "ripemd", - "secp256k1 0.30.0", + "rug", + "secp256k1 0.31.1", "sha2 0.10.9", ] [[package]] name = "revm-primitives" -version = "18.0.0" +version = "20.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc2283ff87358ec7501956c5dd8724a6c2be959c619c4861395ae5e0054575f" +checksum = "5aa29d9da06fe03b249b6419b33968ecdf92ad6428e2f012dc57bcd619b5d94e" dependencies = [ "alloy-primitives", - "enumn", + "num_enum", + "once_cell", "serde", ] [[package]] name = "revm-state" -version = "3.0.0" +version = "7.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09dd121f6e66d75ab111fb51b4712f129511569bc3e41e6067ae760861418bd8" +checksum = "1f64fbacb86008394aaebd3454f9643b7d5a782bd251135e17c5b33da592d84d" dependencies = [ "bitflags 2.9.3", "revm-bytecode", @@ -8190,14 +8214,14 @@ dependencies = [ name = "rocksdb" version = "0.21.0" dependencies = [ - "rocksdb 0.23.0", + "rocksdb 0.24.0", ] [[package]] name = "rocksdb" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26ec73b20525cb235bad420f911473b69f9fe27cc856c5461bccd7e4af037f43" +checksum = "ddb7af00d2b17dbd07d82c0063e25411959748ff03e8d4f96134c2ff41fce34f" dependencies = [ "libc", "librocksdb-sys", @@ -8242,6 +8266,18 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rug" +version = "1.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ad2e973fe3c3214251a840a621812a4f40468da814b1a3d6947d433c2af11f" +dependencies = [ + "az", + "gmp-mpfr-sys", + "libc", + "libm", +] + [[package]] name = "ruint" version = "1.16.0" @@ -8328,15 +8364,28 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.42" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ "bitflags 2.9.3", "errno", "libc", - "linux-raw-sys", - "windows-sys 0.59.0", + "linux-raw-sys 0.4.14", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustix" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +dependencies = [ + "bitflags 2.9.3", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys 0.52.0", ] [[package]] @@ -8839,7 +8888,7 @@ dependencies = [ "cfg-if", "libc", "log", - "rustix", + "rustix 0.38.44", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -9517,7 +9566,7 @@ checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ "bitcoin_hashes", "rand 0.8.5", - "secp256k1-sys", + "secp256k1-sys 0.10.1", "serde", ] @@ -9529,7 +9578,19 @@ checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252" dependencies = [ "bitcoin_hashes", "rand 0.8.5", - "secp256k1-sys", + "secp256k1-sys 0.10.1", + "serde", +] + +[[package]] +name = "secp256k1" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3c81b43dc2d8877c216a3fccf76677ee1ebccd429566d3e67447290d0c42b2" +dependencies = [ + "bitcoin_hashes", + "rand 0.9.2", + "secp256k1-sys 0.11.0", ] [[package]] @@ -9541,6 +9602,15 @@ dependencies = [ "cc", ] +[[package]] +name = "secp256k1-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb913707158fadaf0d8702c2db0e857de66eb003ccfdda5924b5f5ac98efb38" +dependencies = [ + "cc", +] + [[package]] name = "secq256k1" version = "0.1.0" @@ -9672,6 +9742,7 @@ dependencies = [ "bitcoin-serai", "borsh", "ciphersuite 0.4.2", + "ciphersuite-kp256", "dkg-evrf", "hex", "log", @@ -9703,6 +9774,7 @@ dependencies = [ "blake2", "borsh", "ciphersuite 0.4.2", + "ciphersuite-kp256", "dalek-ff-group", "dkg-musig", "dockertest", @@ -9855,6 +9927,7 @@ dependencies = [ "blake2", "borsh", "ciphersuite 0.4.2", + "dalek-ff-group", "dkg", "log", "parity-scale-codec", @@ -9890,7 +9963,7 @@ name = "serai-db" version = "0.1.1" dependencies = [ "parity-db", - "rocksdb 0.23.0", + "rocksdb 0.24.0", ] [[package]] @@ -9984,6 +10057,7 @@ dependencies = [ "alloy-transport", "borsh", "ciphersuite 0.4.2", + "ciphersuite-kp256", "const-hex", "dkg-evrf", "ethereum-schnorr-contract", @@ -10138,6 +10212,7 @@ name = "serai-message-queue-tests" version = "0.1.0" dependencies = [ "ciphersuite 0.4.2", + "dalek-ff-group", "dockertest", "hex", "rand_core 0.6.4", @@ -10201,8 +10276,10 @@ version = "0.1.0" dependencies = [ "bitcoin-serai", "ciphersuite 0.4.2", + "ciphersuite-kp256", "clap", "curve25519-dalek", + "dalek-ff-group", "embedwards25519", "frame-benchmarking", "futures-util", @@ -10411,9 +10488,7 @@ dependencies = [ "blake2", "borsh", "ciphersuite 0.4.2", - "dalek-ff-group", "dkg-evrf", - "ec-divisors", "flexible-transcript", "log", "parity-scale-codec", @@ -10493,6 +10568,7 @@ dependencies = [ "blake2", "borsh", "ciphersuite 0.4.2", + "dalek-ff-group", "frost-schnorrkel", "log", "modular-frost", @@ -10670,6 +10746,8 @@ version = "0.1.0" dependencies = [ "bitvec", "ciphersuite 0.4.2", + "dalek-ff-group", + "dkg-musig", "frame-support", "frame-system", "frost-schnorrkel", @@ -12048,16 +12126,15 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.17.0" +version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40f762a77d2afa88c2d919489e390a12bdd261ed568e60cfa7e48d4e20f0d33" +checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e" dependencies = [ - "cfg-if", "fastrand", "getrandom 0.3.2", "once_cell", - "rustix", - "windows-sys 0.59.0", + "rustix 1.0.8", + "windows-sys 0.52.0", ] [[package]] @@ -12437,8 +12514,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "futures", - "futures-task", "pin-project", "tracing", ] @@ -12522,6 +12597,7 @@ version = "0.1.0" dependencies = [ "blake2", "ciphersuite 0.4.2", + "dalek-ff-group", "flexible-transcript", "futures-channel", "futures-util", @@ -13065,7 +13141,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix", + "rustix 0.38.44", "serde", "sha2 0.10.9", "toml 0.5.11", @@ -13147,7 +13223,7 @@ dependencies = [ "log", "object 0.31.1", "rustc-demangle", - "rustix", + "rustix 0.38.44", "serde", "target-lexicon", "wasmtime-environ", @@ -13165,7 +13241,7 @@ checksum = "aef27ea6c34ef888030d15560037fe7ef27a5609fbbba8e1e3e41dc4245f5bb2" dependencies = [ "object 0.31.1", "once_cell", - "rustix", + "rustix 0.38.44", "wasmtime-versioned-export-macros", ] @@ -13197,7 +13273,7 @@ dependencies = [ "memoffset", "paste", "rand 0.8.5", - "rustix", + "rustix 0.38.44", "sptr", "wasm-encoder", "wasmtime-asm-macros", @@ -13279,7 +13355,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.44", ] [[package]] @@ -13393,6 +13469,12 @@ dependencies = [ "syn 2.0.106", ] +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-result" version = "0.2.0" @@ -13439,6 +13521,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.3", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -13463,13 +13554,30 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -13482,6 +13590,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -13494,6 +13608,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -13506,12 +13626,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -13524,6 +13656,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -13536,6 +13674,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -13548,6 +13692,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -13560,6 +13710,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "winnow" version = "0.5.40" @@ -13717,19 +13873,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 624225ba..a298b77a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -205,6 +205,9 @@ matches = { path = "patches/matches" } option-ext = { path = "patches/option-ext" } directories-next = { path = "patches/directories-next" } +# Patch to include `FromUniformBytes<64>` over Scalar +k256 = { git = "https://github.com/kayabaNerve/elliptic-curves", rev = "fc92333e222b7f0cbe268d2ca92ed572f71f3e1d" } + [workspace.lints.clippy] unwrap_or_default = "allow" map_unwrap_or = "allow" diff --git a/common/db/Cargo.toml b/common/db/Cargo.toml index 53ff012a..acf31601 100644 --- a/common/db/Cargo.toml +++ b/common/db/Cargo.toml @@ -18,7 +18,7 @@ workspace = true [dependencies] parity-db = { version = "0.4", default-features = false, optional = true } -rocksdb = { version = "0.23", default-features = false, features = ["zstd"], optional = true } +rocksdb = { version = "0.24", default-features = false, features = ["zstd"], optional = true } [features] parity-db = ["dep:parity-db"] diff --git a/coordinator/Cargo.toml b/coordinator/Cargo.toml index 15417582..417b17cf 100644 --- a/coordinator/Cargo.toml +++ b/coordinator/Cargo.toml @@ -29,7 +29,7 @@ transcript = { package = "flexible-transcript", path = "../crypto/transcript", d dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] } ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] } schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std", "aggregate"] } -dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] } +dkg = { package = "dkg-musig", path = "../crypto/dkg/musig", default-features = false, features = ["std"] } frost = { package = "modular-frost", path = "../crypto/frost" } frost-schnorrkel = { path = "../crypto/schnorrkel" } diff --git a/coordinator/cosign/src/intend.rs b/coordinator/cosign/src/intend.rs index 08643aad..231850cc 100644 --- a/coordinator/cosign/src/intend.rs +++ b/coordinator/cosign/src/intend.rs @@ -155,7 +155,7 @@ impl ContinuallyRan for CosignIntendTask { // Tell each set of their expectation to cosign this block for set in global_session_info.sets { - log::debug!("{:?} will be cosigning block #{block_number}", set); + log::debug!("{set:?} will be cosigning block #{block_number}"); IntendedCosigns::send( &mut txn, set, diff --git a/coordinator/src/dkg_confirmation.rs b/coordinator/src/dkg_confirmation.rs index a28fb40f..fac044e0 100644 --- a/coordinator/src/dkg_confirmation.rs +++ b/coordinator/src/dkg_confirmation.rs @@ -3,13 +3,11 @@ use std::{boxed::Box, collections::HashMap}; use zeroize::Zeroizing; use rand_core::OsRng; -use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; +use ciphersuite::{group::GroupEncoding, Ciphersuite}; +use dalek_ff_group::Ristretto; +use dkg::{Participant, musig}; use frost_schnorrkel::{ - frost::{ - dkg::{Participant, musig::musig}, - FrostError, - sign::*, - }, + frost::{FrostError, sign::*}, Schnorrkel, }; @@ -155,16 +153,15 @@ impl ConfirmDkgTask { db: &mut CD, set: ExternalValidatorSet, attempt: u32, - key: &Zeroizing<::F>, + key: Zeroizing<::F>, signer: &mut Option, ) { // Perform the preprocess + let public_key = Ristretto::generator() * key.deref(); let (machine, preprocess) = AlgorithmMachine::new( schnorrkel(), // We use a 1-of-1 Musig here as we don't know who will actually be in this Musig yet - musig(&musig_context(set.into()), key, &[Ristretto::generator() * key.deref()]) - .unwrap() - .into(), + musig(musig_context(set.into()), key, &[public_key]).unwrap(), ) .preprocess(&mut OsRng); // We take the preprocess so we can use it in a distinct machine with the actual Musig @@ -199,7 +196,7 @@ impl ContinuallyRan for ConfirmDkgTask { // If we were sent a key to set, create the signer for it if self.signer.is_none() && KeysToConfirm::get(&self.db, self.set.set).is_some() { // Create and publish the initial preprocess - Self::preprocess(&mut self.db, self.set.set, 0, &self.key, &mut self.signer); + Self::preprocess(&mut self.db, self.set.set, 0, self.key.clone(), &mut self.signer); made_progress = true; } @@ -219,7 +216,13 @@ impl ContinuallyRan for ConfirmDkgTask { id: messages::sign::SignId { attempt, .. }, } => { // Create and publish the preprocess for the specified attempt - Self::preprocess(&mut self.db, self.set.set, attempt, &self.key, &mut self.signer); + Self::preprocess( + &mut self.db, + self.set.set, + attempt, + self.key.clone(), + &mut self.signer, + ); } messages::sign::CoordinatorMessage::Preprocesses { id: messages::sign::SignId { attempt, .. }, @@ -258,9 +261,9 @@ impl ContinuallyRan for ConfirmDkgTask { }) .collect::>(); - let keys = musig(&musig_context(self.set.set.into()), &self.key, &musig_public_keys) - .unwrap() - .into(); + let keys = + musig(musig_context(self.set.set.into()), self.key.clone(), &musig_public_keys) + .unwrap(); // Rebuild the machine let (machine, preprocess_from_cache) = diff --git a/coordinator/src/main.rs b/coordinator/src/main.rs index e5c9c0e7..39a2b91e 100644 --- a/coordinator/src/main.rs +++ b/coordinator/src/main.rs @@ -6,10 +6,7 @@ use rand_core::{RngCore, OsRng}; use dalek_ff_group::Ristretto; use ciphersuite::{ - group::{ - ff::{Field, PrimeField}, - GroupEncoding, - }, + group::{ff::PrimeField, GroupEncoding}, Ciphersuite, }; diff --git a/coordinator/src/substrate.rs b/coordinator/src/substrate.rs index 4a70ee6b..ad8b890b 100644 --- a/coordinator/src/substrate.rs +++ b/coordinator/src/substrate.rs @@ -3,7 +3,8 @@ use std::sync::Arc; use zeroize::Zeroizing; -use ciphersuite::{Ciphersuite, Ristretto}; +use ciphersuite::Ciphersuite; +use dalek_ff_group::Ristretto; use tokio::sync::mpsc; diff --git a/coordinator/src/tributary.rs b/coordinator/src/tributary.rs index 7f45797d..c5ecdf5b 100644 --- a/coordinator/src/tributary.rs +++ b/coordinator/src/tributary.rs @@ -4,7 +4,8 @@ use std::sync::Arc; use zeroize::Zeroizing; use rand_core::OsRng; use blake2::{digest::typenum::U32, Digest, Blake2s}; -use ciphersuite::{Ciphersuite, Ristretto}; +use ciphersuite::Ciphersuite; +use dalek_ff_group::Ristretto; use tokio::sync::mpsc; @@ -67,9 +68,7 @@ async fn provide_transaction( // advancing Err(ProvidedError::LocalMismatchesOnChain) => loop { log::error!( - "Tributary {:?} was supposed to provide {:?} but peers disagree, halting Tributary", - set, - tx, + "Tributary {set:?} was supposed to provide {tx:?} but peers disagree, halting Tributary", ); // Print this every five minutes as this does need to be handled tokio::time::sleep(Duration::from_secs(5 * 60)).await; diff --git a/coordinator/tributary-sdk/Cargo.toml b/coordinator/tributary-sdk/Cargo.toml index 385836b2..2406d0d7 100644 --- a/coordinator/tributary-sdk/Cargo.toml +++ b/coordinator/tributary-sdk/Cargo.toml @@ -27,7 +27,8 @@ rand_chacha = { version = "0.3", default-features = false, features = ["std"] } blake2 = { version = "0.10", default-features = false, features = ["std"] } transcript = { package = "flexible-transcript", path = "../../crypto/transcript", version = "0.3", default-features = false, features = ["std", "recommended"] } -ciphersuite = { package = "ciphersuite", path = "../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["std"] } +ciphersuite = { path = "../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", version = "0.5", default-features = false, features = ["std", "aggregate"] } hex = { version = "0.4", default-features = false, features = ["std"] } diff --git a/coordinator/tributary-sdk/src/lib.rs b/coordinator/tributary-sdk/src/lib.rs index 2e4a6115..0f45482e 100644 --- a/coordinator/tributary-sdk/src/lib.rs +++ b/coordinator/tributary-sdk/src/lib.rs @@ -3,7 +3,8 @@ use std::{sync::Arc, io}; use zeroize::Zeroizing; -use ciphersuite::{Ciphersuite, Ristretto}; +use ciphersuite::Ciphersuite; +use dalek_ff_group::Ristretto; use scale::Decode; use futures_channel::mpsc::UnboundedReceiver; diff --git a/coordinator/tributary-sdk/src/tendermint/mod.rs b/coordinator/tributary-sdk/src/tendermint/mod.rs index 9225dcb5..373aacff 100644 --- a/coordinator/tributary-sdk/src/tendermint/mod.rs +++ b/coordinator/tributary-sdk/src/tendermint/mod.rs @@ -9,7 +9,6 @@ use rand_chacha::ChaCha12Rng; use transcript::{Transcript, RecommendedTranscript}; -use dalek_ff_group::Ristretto; use ciphersuite::{ group::{ GroupEncoding, @@ -17,6 +16,7 @@ use ciphersuite::{ }, Ciphersuite, }; +use dalek_ff_group::Ristretto; use schnorr::{ SchnorrSignature, aggregate::{SchnorrAggregator, SchnorrAggregate}, @@ -164,7 +164,6 @@ impl SignatureScheme for Validators { type AggregateSignature = Vec; type Signer = Arc; - #[must_use] fn verify(&self, validator: Self::ValidatorId, msg: &[u8], sig: &Self::Signature) -> bool { if !self.weights.contains_key(&validator) { return false; @@ -197,7 +196,6 @@ impl SignatureScheme for Validators { aggregate.serialize() } - #[must_use] fn verify_aggregate( &self, signers: &[Self::ValidatorId], diff --git a/coordinator/tributary-sdk/src/transaction.rs b/coordinator/tributary-sdk/src/transaction.rs index d7ff4092..36adef11 100644 --- a/coordinator/tributary-sdk/src/transaction.rs +++ b/coordinator/tributary-sdk/src/transaction.rs @@ -8,8 +8,9 @@ use blake2::{Digest, Blake2b512}; use ciphersuite::{ group::{Group, GroupEncoding}, - Ciphersuite, Ristretto, + Ciphersuite, }; +use dalek_ff_group::Ristretto; use schnorr::SchnorrSignature; use crate::{TRANSACTION_SIZE_LIMIT, ReadWrite}; diff --git a/coordinator/tributary-sdk/tendermint/src/ext.rs b/coordinator/tributary-sdk/tendermint/src/ext.rs index 67b8b07d..3e3460b4 100644 --- a/coordinator/tributary-sdk/tendermint/src/ext.rs +++ b/coordinator/tributary-sdk/tendermint/src/ext.rs @@ -114,7 +114,6 @@ impl SignatureScheme for Arc { self.as_ref().aggregate(validators, msg, sigs) } - #[must_use] fn verify_aggregate( &self, signers: &[Self::ValidatorId], diff --git a/coordinator/tributary-sdk/tendermint/tests/ext.rs b/coordinator/tributary-sdk/tendermint/tests/ext.rs index 58a5d468..d6da9b38 100644 --- a/coordinator/tributary-sdk/tendermint/tests/ext.rs +++ b/coordinator/tributary-sdk/tendermint/tests/ext.rs @@ -46,7 +46,6 @@ impl SignatureScheme for TestSignatureScheme { type AggregateSignature = Vec<[u8; 32]>; type Signer = TestSigner; - #[must_use] fn verify(&self, validator: u16, msg: &[u8], sig: &[u8; 32]) -> bool { (sig[.. 2] == validator.to_le_bytes()) && (sig[2 ..] == [msg, &[0; 30]].concat()[.. 30]) } @@ -60,7 +59,6 @@ impl SignatureScheme for TestSignatureScheme { sigs.to_vec() } - #[must_use] fn verify_aggregate( &self, signers: &[TestValidatorId], diff --git a/coordinator/tributary/Cargo.toml b/coordinator/tributary/Cargo.toml index 431dae3c..8ebb9b10 100644 --- a/coordinator/tributary/Cargo.toml +++ b/coordinator/tributary/Cargo.toml @@ -26,6 +26,7 @@ borsh = { version = "1", default-features = false, features = ["std", "derive", blake2 = { version = "0.10", default-features = false, features = ["std"] } ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] } schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", default-features = false, features = ["std"] } diff --git a/coordinator/tributary/src/lib.rs b/coordinator/tributary/src/lib.rs index 1c82d5b9..a4fd3f2f 100644 --- a/coordinator/tributary/src/lib.rs +++ b/coordinator/tributary/src/lib.rs @@ -253,7 +253,7 @@ impl ScanBlock<'_, TD, TDT, P> { let signer = signer(signed); // Check the participant voted to be removed actually exists - if !self.validators.iter().any(|validator| *validator == participant) { + if !self.validators.contains(&participant) { TributaryDb::fatal_slash( self.tributary_txn, self.set.set, diff --git a/coordinator/tributary/src/transaction.rs b/coordinator/tributary/src/transaction.rs index a2f629e3..11f77d7c 100644 --- a/coordinator/tributary/src/transaction.rs +++ b/coordinator/tributary/src/transaction.rs @@ -5,11 +5,11 @@ use zeroize::Zeroizing; use rand_core::{RngCore, CryptoRng}; use blake2::{digest::typenum::U32, Digest, Blake2b}; -use dalek_ff_group::Ristretto; use ciphersuite::{ - group::{Group, GroupEncoding}, + group::{ff::Field, Group, GroupEncoding}, Ciphersuite, }; +use dalek_ff_group::Ristretto; use schnorr::SchnorrSignature; use scale::Encode; diff --git a/crypto/ciphersuite/kp256/src/lib.rs b/crypto/ciphersuite/kp256/src/lib.rs index bfe480a7..8736b2e6 100644 --- a/crypto/ciphersuite/kp256/src/lib.rs +++ b/crypto/ciphersuite/kp256/src/lib.rs @@ -13,6 +13,9 @@ use elliptic_curve::{ use ciphersuite::{group::ff::PrimeField, Ciphersuite}; +pub use k256; +pub use p256; + macro_rules! kp_curve { ( $feature: literal, diff --git a/crypto/dkg/evrf/src/curves.rs b/crypto/dkg/evrf/src/curves.rs index debbe581..4ab6165c 100644 --- a/crypto/dkg/evrf/src/curves.rs +++ b/crypto/dkg/evrf/src/curves.rs @@ -76,7 +76,6 @@ impl Generators { } } -/* TODO /// Secp256k1, and an elliptic curve defined over its scalar field (secq256k1). #[cfg(feature = "secp256k1")] pub struct Secp256k1; @@ -86,7 +85,6 @@ impl Curves for Secp256k1 { type EmbeddedCurve = secq256k1::Secq256k1; type EmbeddedCurveParameters = secq256k1::Secq256k1; } -*/ /// Ed25519, and an elliptic curve defined over its scalar field (embedwards25519). #[cfg(feature = "ed25519")] diff --git a/crypto/dkg/evrf/src/lib.rs b/crypto/dkg/evrf/src/lib.rs index a32b964f..1c3b21c1 100644 --- a/crypto/dkg/evrf/src/lib.rs +++ b/crypto/dkg/evrf/src/lib.rs @@ -47,12 +47,12 @@ mod tests; /// `Participation` is meant to be broadcast to all other participants over an authenticated, /// reliable broadcast channel. #[derive(Clone, PartialEq, Eq, Debug)] -pub struct Participation { +pub struct Participation { proof: Vec, - encrypted_secret_shares: HashMap, + encrypted_secret_shares: HashMap::F>, } -impl Participation { +impl Participation { pub fn read(reader: &mut R, n: u16) -> io::Result { // Ban <32-bit platforms, allowing us to assume `u32` -> `usize` works const _NO_16_BIT_PLATFORMS: [(); (usize::BITS - u32::BITS) as usize] = [(); _]; @@ -79,7 +79,7 @@ impl Participation { let mut encrypted_secret_shares = HashMap::with_capacity(usize::from(n)); for i in Participant::iter().take(usize::from(n)) { - encrypted_secret_shares.insert(i, C::read_F(reader)?); + encrypted_secret_shares.insert(i, ::read_F(reader)?); } Ok(Self { proof, encrypted_secret_shares }) @@ -190,7 +190,7 @@ impl Dkg { t: u16, evrf_public_keys: &[::G], evrf_private_key: &Zeroizing<::F>, - ) -> Result, Error> { + ) -> Result, Error> { let Ok(n) = u16::try_from(evrf_public_keys.len()) else { Err(Error::TooManyParticipants { provided: evrf_public_keys.len() })? }; @@ -311,7 +311,7 @@ impl Dkg { context: [u8; 32], t: u16, evrf_public_keys: &[::G], - participations: &HashMap>, + participations: &HashMap>, ) -> Result, Error> { let Ok(n) = u16::try_from(evrf_public_keys.len()) else { Err(Error::TooManyParticipants { provided: evrf_public_keys.len() })? diff --git a/crypto/frost/src/algorithm.rs b/crypto/frost/src/algorithm.rs index 7e4d6167..7c0dc37e 100644 --- a/crypto/frost/src/algorithm.rs +++ b/crypto/frost/src/algorithm.rs @@ -210,7 +210,6 @@ impl> Algorithm fo SchnorrSignature::::sign(params.secret_share(), nonces.swap_remove(0), c).s } - #[must_use] fn verify(&self, group_key: C::G, nonces: &[Vec], sum: C::F) -> Option { let sig = SchnorrSignature { R: nonces[0][0], s: sum }; Some(sig).filter(|sig| sig.verify(group_key, self.c.unwrap())) diff --git a/crypto/frost/src/tests/nonces.rs b/crypto/frost/src/tests/nonces.rs index c37d618f..a28c7dea 100644 --- a/crypto/frost/src/tests/nonces.rs +++ b/crypto/frost/src/tests/nonces.rs @@ -121,7 +121,6 @@ impl Algorithm for MultiNonce { res } - #[must_use] fn verify(&self, _: C::G, nonces: &[Vec], sum: C::F) -> Option { verify_nonces::(nonces); assert_eq!(&self.nonces.clone().unwrap(), nonces); diff --git a/crypto/schnorrkel/src/lib.rs b/crypto/schnorrkel/src/lib.rs index a5a0418b..5d657196 100644 --- a/crypto/schnorrkel/src/lib.rs +++ b/crypto/schnorrkel/src/lib.rs @@ -128,7 +128,6 @@ impl Algorithm for Schnorrkel { ) } - #[must_use] fn verify( &self, group_key: RistrettoPoint, diff --git a/deny.toml b/deny.toml index 066722d9..0be67806 100644 --- a/deny.toml +++ b/deny.toml @@ -132,6 +132,7 @@ unknown-git = "deny" allow-registry = ["https://github.com/rust-lang/crates.io-index"] allow-git = [ "https://github.com/rust-lang-nursery/lazy-static.rs", + "https://github.com/kayabaNerve/elliptic-curves", "https://github.com/kayabaNerve/pasta_curves", "https://github.com/kayabaNerve/monero-oxide", "https://github.com/serai-dex/substrate-bip39", diff --git a/message-queue/src/main.rs b/message-queue/src/main.rs index 73ad990f..2b9d6b8f 100644 --- a/message-queue/src/main.rs +++ b/message-queue/src/main.rs @@ -146,7 +146,7 @@ pub(crate) fn ack_message(from: Service, to: Service, id: u64, sig: SchnorrSigna // It's the second if we acknowledge messages before saving them as acknowledged // TODO: Check only a proper message is being acked - log::info!("Acknowledging From: {:?} To: {:?} ID: {}", from, to, id); + log::info!("Acknowledging From: {from:?} To: {to:?} ID: {id}"); QUEUES.read().unwrap()[&(from, to)].write().unwrap().ack_message(id) } diff --git a/networks/bitcoin/src/crypto.rs b/networks/bitcoin/src/crypto.rs index 36f85f29..a5b316b5 100644 --- a/networks/bitcoin/src/crypto.rs +++ b/networks/bitcoin/src/crypto.rs @@ -135,7 +135,6 @@ mod frost_crypto { self.0.sign_share(params, nonce_sums, nonces, msg) } - #[must_use] fn verify( &self, group_key: ProjectivePoint, diff --git a/networks/ethereum/alloy-simple-request-transport/Cargo.toml b/networks/ethereum/alloy-simple-request-transport/Cargo.toml index b3b7b3dd..33d7cc5e 100644 --- a/networks/ethereum/alloy-simple-request-transport/Cargo.toml +++ b/networks/ethereum/alloy-simple-request-transport/Cargo.toml @@ -21,8 +21,8 @@ tower = "0.5" serde_json = { version = "1", default-features = false } simple-request = { path = "../../../common/request", version = "0.1", default-features = false } -alloy-json-rpc = { version = "0.14", default-features = false } -alloy-transport = { version = "0.14", default-features = false } +alloy-json-rpc = { version = "1", default-features = false } +alloy-transport = { version = "1", default-features = false } [features] default = ["tls"] diff --git a/networks/ethereum/schnorr/Cargo.toml b/networks/ethereum/schnorr/Cargo.toml index 040ff479..7904ef6a 100644 --- a/networks/ethereum/schnorr/Cargo.toml +++ b/networks/ethereum/schnorr/Cargo.toml @@ -32,11 +32,11 @@ k256 = { version = "^0.13.1", default-features = false, features = ["ecdsa"] } alloy-core = { version = "1", default-features = false } alloy-sol-types = { version = "1", default-features = false } -alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false } -alloy-rpc-types-eth = { version = "0.14", default-features = false } -alloy-rpc-client = { version = "0.14", default-features = false } -alloy-provider = { version = "0.14", default-features = false } +alloy-simple-request-transport = { path = "../alloy-simple-request-transport", default-features = false } +alloy-rpc-types-eth = { version = "1", default-features = false } +alloy-rpc-client = { version = "1", default-features = false } +alloy-provider = { version = "1", default-features = false } -alloy-node-bindings = { version = "0.14", default-features = false } +alloy-node-bindings = { version = "1", default-features = false } tokio = { version = "1", default-features = false, features = ["macros"] } diff --git a/patches/ciphersuite/src/lib.rs b/patches/ciphersuite/src/lib.rs index ce4f6dc9..679ea363 100644 --- a/patches/ciphersuite/src/lib.rs +++ b/patches/ciphersuite/src/lib.rs @@ -2,4 +2,4 @@ pub use ciphersuite::*; #[cfg(feature = "ed25519")] -use dalek_ff_group::Ed25519; +pub use dalek_ff_group::Ed25519; diff --git a/patches/rocksdb/Cargo.toml b/patches/rocksdb/Cargo.toml index 6622694a..748ffb7e 100644 --- a/patches/rocksdb/Cargo.toml +++ b/patches/rocksdb/Cargo.toml @@ -13,7 +13,7 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -rocksdb = { version = "0.23", default-features = false, features = ["bindgen-runtime"] } +rocksdb = { version = "0.24", default-features = false, features = ["bindgen-runtime"] } [features] jemalloc = [] # Dropped as this causes a compilation failure on windows diff --git a/processor/bin/src/lib.rs b/processor/bin/src/lib.rs index 5109dcbc..73a0e374 100644 --- a/processor/bin/src/lib.rs +++ b/processor/bin/src/lib.rs @@ -4,9 +4,9 @@ use zeroize::{Zeroize, Zeroizing}; use ciphersuite::{ group::{ff::PrimeField, GroupEncoding}, - Ciphersuite, Ristretto, + Ciphersuite, }; -use dkg::evrf::EvrfCurve; +use dkg::{Curves, Ristretto}; use serai_client::validator_sets::primitives::Session; @@ -100,8 +100,8 @@ fn key_gen() -> KeyGen { res } KeyGen::new( - read_key_from_env::<::EmbeddedCurve>("SUBSTRATE_EVRF_KEY"), - read_key_from_env::<::EmbeddedCurve>( + read_key_from_env::<::EmbeddedCurve>("SUBSTRATE_EVRF_KEY"), + read_key_from_env::<::EmbeddedCurve>( "NETWORK_EVRF_KEY", ), ) @@ -170,11 +170,13 @@ impl Hooks for () { pub async fn main_loop< H: Hooks, S: ScannerFeed, - K: KeyGenParams>>, + K: KeyGenParams>>>, Sch: Clone + Scheduler< S, - SignableTransaction: SignableTransaction, + SignableTransaction: SignableTransaction< + Ciphersuite = ::ToweringCurve, + >, >, >( mut db: Db, diff --git a/processor/bitcoin/Cargo.toml b/processor/bitcoin/Cargo.toml index f7194e5c..97ce58d0 100644 --- a/processor/bitcoin/Cargo.toml +++ b/processor/bitcoin/Cargo.toml @@ -25,6 +25,7 @@ scale = { package = "parity-scale-codec", version = "3", default-features = fals borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] } ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } +ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] } dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "secp256k1"] } frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false } diff --git a/processor/bitcoin/src/key_gen.rs b/processor/bitcoin/src/key_gen.rs index 41544134..afbfc7ac 100644 --- a/processor/bitcoin/src/key_gen.rs +++ b/processor/bitcoin/src/key_gen.rs @@ -1,5 +1,5 @@ -use ciphersuite::{group::GroupEncoding, Ciphersuite, Secp256k1}; -use frost::ThresholdKeys; +use ciphersuite::{group::GroupEncoding, Ciphersuite}; +use dkg::{ThresholdKeys, Curves, Secp256k1}; use crate::{primitives::x_coord_to_even_point, scan::scanner}; @@ -9,20 +9,26 @@ impl key_gen::KeyGenParams for KeyGenParams { type ExternalNetworkCiphersuite = Secp256k1; - fn tweak_keys(keys: &mut ThresholdKeys) { - *keys = bitcoin_serai::wallet::tweak_keys(keys); + fn tweak_keys( + keys: &mut ThresholdKeys<::ToweringCurve>, + ) { + *keys = bitcoin_serai::wallet::tweak_keys(keys.clone()); // Also create a scanner to assert these keys, and all expected paths, are usable scanner(keys.group_key()); } - fn encode_key(key: ::G) -> Vec { + fn encode_key( + key: <::ToweringCurve as Ciphersuite>::G, + ) -> Vec { let key = key.to_bytes(); let key: &[u8] = key.as_ref(); // Skip the parity encoding as we know this key is even key[1 ..].to_vec() } - fn decode_key(key: &[u8]) -> Option<::G> { + fn decode_key( + key: &[u8], + ) -> Option<<::ToweringCurve as Ciphersuite>::G> { x_coord_to_even_point(key) } } diff --git a/processor/bitcoin/src/primitives/block.rs b/processor/bitcoin/src/primitives/block.rs index 02b8e595..057c5799 100644 --- a/processor/bitcoin/src/primitives/block.rs +++ b/processor/bitcoin/src/primitives/block.rs @@ -1,7 +1,8 @@ use core::fmt; use std::collections::HashMap; -use ciphersuite::{Ciphersuite, Secp256k1}; +use ciphersuite::Ciphersuite; +use ciphersuite_kp256::Secp256k1; use bitcoin_serai::bitcoin::block::{Header, Block as BBlock}; diff --git a/processor/bitcoin/src/primitives/mod.rs b/processor/bitcoin/src/primitives/mod.rs index e089c623..e11d9203 100644 --- a/processor/bitcoin/src/primitives/mod.rs +++ b/processor/bitcoin/src/primitives/mod.rs @@ -1,4 +1,5 @@ -use ciphersuite::{Ciphersuite, Secp256k1}; +use ciphersuite::Ciphersuite; +use ciphersuite_kp256::Secp256k1; use bitcoin_serai::bitcoin::key::{Parity, XOnlyPublicKey}; diff --git a/processor/bitcoin/src/primitives/output.rs b/processor/bitcoin/src/primitives/output.rs index 44f422c2..bd9ec8a7 100644 --- a/processor/bitcoin/src/primitives/output.rs +++ b/processor/bitcoin/src/primitives/output.rs @@ -1,6 +1,7 @@ use std::io; -use ciphersuite::{Ciphersuite, Secp256k1}; +use ciphersuite::Ciphersuite; +use ciphersuite_kp256::Secp256k1; use bitcoin_serai::{ bitcoin::{ diff --git a/processor/bitcoin/src/primitives/transaction.rs b/processor/bitcoin/src/primitives/transaction.rs index 9b81d2f0..bfb8ad23 100644 --- a/processor/bitcoin/src/primitives/transaction.rs +++ b/processor/bitcoin/src/primitives/transaction.rs @@ -2,7 +2,7 @@ use std::io; use rand_core::{RngCore, CryptoRng}; -use ciphersuite::Secp256k1; +use ciphersuite_kp256::Secp256k1; use frost::{dkg::ThresholdKeys, sign::PreprocessMachine}; use bitcoin_serai::{ diff --git a/processor/bitcoin/src/scan.rs b/processor/bitcoin/src/scan.rs index 6d7fab88..3c884d93 100644 --- a/processor/bitcoin/src/scan.rs +++ b/processor/bitcoin/src/scan.rs @@ -1,6 +1,7 @@ use std::{sync::LazyLock, collections::HashMap}; -use ciphersuite::{Ciphersuite, Secp256k1}; +use ciphersuite::Ciphersuite; +use ciphersuite_kp256::Secp256k1; use bitcoin_serai::{ bitcoin::{ diff --git a/processor/bitcoin/src/scheduler.rs b/processor/bitcoin/src/scheduler.rs index 00f4a072..2799f883 100644 --- a/processor/bitcoin/src/scheduler.rs +++ b/processor/bitcoin/src/scheduler.rs @@ -1,6 +1,7 @@ use core::future::Future; -use ciphersuite::{Ciphersuite, Secp256k1}; +use ciphersuite::Ciphersuite; +use ciphersuite_kp256::Secp256k1; use bitcoin_serai::{ bitcoin::ScriptBuf, diff --git a/processor/ethereum/Cargo.toml b/processor/ethereum/Cargo.toml index dd207f71..140ab274 100644 --- a/processor/ethereum/Cargo.toml +++ b/processor/ethereum/Cargo.toml @@ -26,6 +26,7 @@ scale = { package = "parity-scale-codec", version = "3", default-features = fals borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] } ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } +ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] } dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "secp256k1"] } frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false, features = ["secp256k1"] } @@ -34,11 +35,11 @@ k256 = { version = "^0.13.1", default-features = false, features = ["std"] } alloy-core = { version = "1", default-features = false } alloy-rlp = { version = "0.3", default-features = false } -alloy-rpc-types-eth = { version = "0.14", default-features = false } -alloy-transport = { version = "0.14", default-features = false } +alloy-rpc-types-eth = { version = "1", default-features = false } +alloy-transport = { version = "1", default-features = false } alloy-simple-request-transport = { path = "../../networks/ethereum/alloy-simple-request-transport", default-features = false } -alloy-rpc-client = { version = "0.14", default-features = false } -alloy-provider = { version = "0.14", default-features = false } +alloy-rpc-client = { version = "1", default-features = false } +alloy-provider = { version = "1", default-features = false } serai-client = { path = "../../substrate/client", default-features = false, features = ["ethereum"] } diff --git a/processor/ethereum/TODO/old_processor.rs b/processor/ethereum/TODO/old_processor.rs deleted file mode 100644 index f95b8225..00000000 --- a/processor/ethereum/TODO/old_processor.rs +++ /dev/null @@ -1,164 +0,0 @@ -TODO - - async fn publish_completion( - &self, - completion: &::Completion, - ) -> Result<(), NetworkError> { - // Publish this to the dedicated TX server for a solver to actually publish - #[cfg(not(test))] - { - } - - // Publish this using a dummy account we fund with magic RPC commands - #[cfg(test)] - { - let router = self.router().await; - let router = router.as_ref().unwrap(); - - let mut tx = match completion.command() { - RouterCommand::UpdateSeraiKey { key, .. } => { - router.update_serai_key(key, completion.signature()) - } - RouterCommand::Execute { outs, .. } => router.execute( - &outs.iter().cloned().map(Into::into).collect::>(), - completion.signature(), - ), - }; - tx.gas_limit = 1_000_000u64.into(); - tx.gas_price = 1_000_000_000u64.into(); - let tx = ethereum_serai::crypto::deterministically_sign(tx); - - if self.provider.get_transaction_by_hash(*tx.hash()).await.unwrap().is_none() { - self - .provider - .raw_request::<_, ()>( - "anvil_setBalance".into(), - [ - tx.recover_signer().unwrap().to_string(), - (U256::from(tx.tx().gas_limit) * U256::from(tx.tx().gas_price)).to_string(), - ], - ) - .await - .unwrap(); - - let (tx, sig, _) = tx.into_parts(); - let mut bytes = vec![]; - tx.encode_with_signature_fields(&sig, &mut bytes); - let pending_tx = self.provider.send_raw_transaction(&bytes).await.unwrap(); - self.mine_block().await; - assert!(pending_tx.get_receipt().await.unwrap().status()); - } - - Ok(()) - } - } - - #[cfg(test)] - async fn get_transaction_by_eventuality( - &self, - block: usize, - eventuality: &Self::Eventuality, - ) -> Self::Transaction { - // We mine 96 blocks to ensure the 32 blocks relevant are finalized - // Back-check the prior two epochs in response to this - // TODO: Review why this is sub(3) and not sub(2) - for block in block.saturating_sub(3) ..= block { - match eventuality.1 { - RouterCommand::UpdateSeraiKey { nonce, .. } | RouterCommand::Execute { nonce, .. } => { - let router = self.router().await; - let router = router.as_ref().unwrap(); - - let block = u64::try_from(block).unwrap(); - let filter = router - .key_updated_filter() - .from_block(block * 32) - .to_block(((block + 1) * 32) - 1) - .topic1(nonce); - let logs = self.provider.get_logs(&filter).await.unwrap(); - if let Some(log) = logs.first() { - return self - .provider - .get_transaction_by_hash(log.clone().transaction_hash.unwrap()) - .await - .unwrap() - .unwrap(); - }; - - let filter = router - .executed_filter() - .from_block(block * 32) - .to_block(((block + 1) * 32) - 1) - .topic1(nonce); - let logs = self.provider.get_logs(&filter).await.unwrap(); - if logs.is_empty() { - continue; - } - return self - .provider - .get_transaction_by_hash(logs[0].transaction_hash.unwrap()) - .await - .unwrap() - .unwrap(); - } - } - } - panic!("couldn't find completion in any three of checked blocks"); - } - - #[cfg(test)] - async fn mine_block(&self) { - self.provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap(); - } - - #[cfg(test)] - async fn test_send(&self, send_to: Self::Address) -> Self::Block { - use rand_core::OsRng; - use ciphersuite::group::ff::Field; - use ethereum_serai::alloy::sol_types::SolCall; - - let key = ::F::random(&mut OsRng); - let address = ethereum_serai::crypto::address(&(Secp256k1::generator() * key)); - - // Set a 1.1 ETH balance - self - .provider - .raw_request::<_, ()>( - "anvil_setBalance".into(), - [Address(address).to_string(), "1100000000000000000".into()], - ) - .await - .unwrap(); - - let value = U256::from_str_radix("1000000000000000000", 10).unwrap(); - let tx = ethereum_serai::alloy::consensus::TxLegacy { - chain_id: None, - nonce: 0, - gas_price: 1_000_000_000u128, - gas_limit: 200_000u128, - to: ethereum_serai::alloy::primitives::TxKind::Call(send_to.0.into()), - // 1 ETH - value, - input: ethereum_serai::router::abi::inInstructionCall::new(( - [0; 20].into(), - value, - vec![].into(), - )) - .abi_encode() - .into(), - }; - - use ethereum_serai::alloy::{primitives::Signature, consensus::SignableTransaction}; - let sig = k256::ecdsa::SigningKey::from(k256::elliptic_curve::NonZeroScalar::new(key).unwrap()) - .sign_prehash_recoverable(tx.signature_hash().as_ref()) - .unwrap(); - - let mut bytes = vec![]; - tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes); - let pending_tx = self.provider.send_raw_transaction(&bytes).await.ok().unwrap(); - - // Mine an epoch containing this TX - self.mine_block().await; - assert!(pending_tx.get_receipt().await.unwrap().status()); - // Yield the freshly mined block - self.get_block(self.get_latest_block_number().await.unwrap()).await.unwrap() - } diff --git a/processor/ethereum/TODO/tests/crypto.rs b/processor/ethereum/TODO/tests/crypto.rs deleted file mode 100644 index 20ba40b8..00000000 --- a/processor/ethereum/TODO/tests/crypto.rs +++ /dev/null @@ -1,31 +0,0 @@ -// TODO - -use rand_core::OsRng; - -use group::ff::{Field, PrimeField}; -use k256::{ - ecdsa::{ - self, hazmat::SignPrimitive, signature::hazmat::PrehashVerifier, SigningKey, VerifyingKey, - }, - Scalar, ProjectivePoint, -}; - -use frost::{ - curve::{Ciphersuite, Secp256k1}, - algorithm::{Hram, IetfSchnorr}, - tests::{algorithm_machines, sign}, -}; - -use crate::{crypto::*, tests::key_gen}; - -// Run the sign test with the EthereumHram -#[test] -fn test_signing() { - let (keys, _) = key_gen(); - - const MESSAGE: &[u8] = b"Hello, World!"; - - let algo = IetfSchnorr::::ietf(); - let _sig = - sign(&mut OsRng, &algo, keys.clone(), algorithm_machines(&mut OsRng, &algo, &keys), MESSAGE); -} diff --git a/processor/ethereum/TODO/tests/mod.rs b/processor/ethereum/TODO/tests/mod.rs deleted file mode 100644 index 2e3e22b1..00000000 --- a/processor/ethereum/TODO/tests/mod.rs +++ /dev/null @@ -1,45 +0,0 @@ -// TODO - -use std::{sync::Arc, collections::HashMap}; - -use rand_core::OsRng; - -use k256::{Scalar, ProjectivePoint}; -use frost::{curve::Secp256k1, Participant, ThresholdKeys, tests::key_gen as frost_key_gen}; - -use alloy_core::{ - primitives::{Address, U256, Bytes, Signature, TxKind}, - hex::FromHex, -}; -use alloy_consensus::{SignableTransaction, TxLegacy}; - -use alloy_rpc_types_eth::TransactionReceipt; -use alloy_simple_request_transport::SimpleRequest; -use alloy_provider::{Provider, RootProvider}; - -use crate::crypto::{address, deterministically_sign, PublicKey}; - -#[cfg(test)] -mod crypto; - -#[cfg(test)] -use contracts::tests as abi; -#[cfg(test)] -mod router; - -pub fn key_gen() -> (HashMap>, PublicKey) { - let mut keys = frost_key_gen::<_, Secp256k1>(&mut OsRng); - let mut group_key = keys[&Participant::new(1).unwrap()].group_key(); - - let mut offset = Scalar::ZERO; - while PublicKey::new(group_key).is_none() { - offset += Scalar::ONE; - group_key += ProjectivePoint::GENERATOR; - } - for keys in keys.values_mut() { - *keys = keys.offset(offset); - } - let public_key = PublicKey::new(group_key).unwrap(); - - (keys, public_key) -} diff --git a/processor/ethereum/deployer/Cargo.toml b/processor/ethereum/deployer/Cargo.toml index 30843fc4..98feab32 100644 --- a/processor/ethereum/deployer/Cargo.toml +++ b/processor/ethereum/deployer/Cargo.toml @@ -22,11 +22,11 @@ alloy-core = { version = "1", default-features = false } alloy-sol-types = { version = "1", default-features = false } alloy-sol-macro = { version = "1", default-features = false } -alloy-consensus = { version = "0.14", default-features = false } +alloy-consensus = { version = "1", default-features = false } -alloy-rpc-types-eth = { version = "0.14", default-features = false } -alloy-transport = { version = "0.14", default-features = false } -alloy-provider = { version = "0.14", default-features = false } +alloy-rpc-types-eth = { version = "1", default-features = false } +alloy-transport = { version = "1", default-features = false } +alloy-provider = { version = "1", default-features = false } ethereum-primitives = { package = "serai-processor-ethereum-primitives", path = "../primitives", default-features = false } @@ -35,9 +35,9 @@ build-solidity-contracts = { path = "../../../networks/ethereum/build-contracts" [dev-dependencies] alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false } -alloy-rpc-client = { version = "0.14", default-features = false } -alloy-node-bindings = { version = "0.14", default-features = false } +alloy-rpc-client = { version = "1", default-features = false } +alloy-node-bindings = { version = "1", default-features = false } -tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "macros"] } +tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros"] } ethereum-test-primitives = { package = "serai-ethereum-test-primitives", path = "../test-primitives" } diff --git a/processor/ethereum/erc20/Cargo.toml b/processor/ethereum/erc20/Cargo.toml index 4a5a45e8..58f54737 100644 --- a/processor/ethereum/erc20/Cargo.toml +++ b/processor/ethereum/erc20/Cargo.toml @@ -22,9 +22,9 @@ alloy-core = { version = "1", default-features = false } alloy-sol-types = { version = "1", default-features = false } alloy-sol-macro = { version = "1", default-features = false } -alloy-rpc-types-eth = { version = "0.14", default-features = false } -alloy-transport = { version = "0.14", default-features = false } -alloy-provider = { version = "0.14", default-features = false } +alloy-rpc-types-eth = { version = "1", default-features = false } +alloy-transport = { version = "1", default-features = false } +alloy-provider = { version = "1", default-features = false } ethereum-primitives = { package = "serai-processor-ethereum-primitives", path = "../primitives", default-features = false } diff --git a/processor/ethereum/primitives/Cargo.toml b/processor/ethereum/primitives/Cargo.toml index 0235b68d..58af4ad6 100644 --- a/processor/ethereum/primitives/Cargo.toml +++ b/processor/ethereum/primitives/Cargo.toml @@ -23,4 +23,4 @@ group = { version = "0.13", default-features = false } k256 = { version = "^0.13.1", default-features = false, features = ["std", "arithmetic"] } alloy-primitives = { version = "1", default-features = false } -alloy-consensus = { version = "0.14", default-features = false, features = ["k256"] } +alloy-consensus = { version = "1", default-features = false, features = ["k256"] } diff --git a/processor/ethereum/router/Cargo.toml b/processor/ethereum/router/Cargo.toml index 320a1e33..bc3c329a 100644 --- a/processor/ethereum/router/Cargo.toml +++ b/processor/ethereum/router/Cargo.toml @@ -27,13 +27,13 @@ alloy-core = { version = "1", default-features = false } alloy-sol-types = { version = "1", default-features = false } alloy-sol-macro = { version = "1", default-features = false } -alloy-consensus = { version = "0.14", default-features = false } +alloy-consensus = { version = "1", default-features = false } -alloy-rpc-types-eth = { version = "0.14", default-features = false } -alloy-transport = { version = "0.14", default-features = false } -alloy-provider = { version = "0.14", default-features = false } +alloy-rpc-types-eth = { version = "1", default-features = false } +alloy-transport = { version = "1", default-features = false } +alloy-provider = { version = "1", default-features = false } -revm = { version = "22", default-features = false, features = ["std"] } +revm = { version = "29", default-features = false, features = ["std"] } ethereum-schnorr = { package = "ethereum-schnorr-contract", path = "../../../networks/ethereum/schnorr", default-features = false } @@ -61,10 +61,10 @@ rand_core = { version = "0.6", default-features = false, features = ["std"] } k256 = { version = "0.13", default-features = false, features = ["std"] } alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false } -alloy-provider = { version = "0.14", default-features = false, features = ["debug-api", "trace-api"] } -alloy-rpc-client = { version = "0.14", default-features = false } -alloy-node-bindings = { version = "0.14", default-features = false } +alloy-provider = { version = "1", default-features = false, features = ["debug-api", "trace-api"] } +alloy-rpc-client = { version = "1", default-features = false } +alloy-node-bindings = { version = "1", default-features = false } -tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "macros"] } +tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros"] } ethereum-test-primitives = { package = "serai-ethereum-test-primitives", path = "../test-primitives" } diff --git a/processor/ethereum/router/src/gas.rs b/processor/ethereum/router/src/gas.rs index 58819560..4a1982d7 100644 --- a/processor/ethereum/router/src/gas.rs +++ b/processor/ethereum/router/src/gas.rs @@ -21,8 +21,8 @@ use revm::{ }, context::{ result::{EVMError, InvalidTransaction, ExecutionResult}, - evm::{EvmData, Evm}, context::Context, + evm::Evm, *, }, inspector::{Inspector, InspectorHandler}, @@ -124,6 +124,7 @@ pub(crate) type GasEstimator = Evm< WorstCaseCallInspector, EthInstructions, EthPrecompiles, + EthFrame, >; impl Router { @@ -218,26 +219,24 @@ impl Router { db }; - Evm { - data: EvmData { - ctx: RevmContext::new(db, SPEC_ID) - .modify_cfg_chained(|cfg| { - cfg.chain_id = CHAIN_ID.try_into().unwrap(); - }) - .modify_tx_chained(|tx: &mut TxEnv| { - tx.gas_limit = u64::MAX; - tx.kind = self.address.into(); - }), - inspector: WorstCaseCallInspector { - erc20, - call_depth: 0, - unused_gas: 0, - override_immediate_call_return_value: false, - }, + Evm::new_with_inspector( + RevmContext::new(db, SPEC_ID) + .modify_cfg_chained(|cfg| { + cfg.chain_id = CHAIN_ID.try_into().unwrap(); + }) + .modify_tx_chained(|tx: &mut TxEnv| { + tx.gas_limit = u64::MAX; + tx.kind = self.address.into(); + }), + WorstCaseCallInspector { + erc20, + call_depth: 0, + unused_gas: 0, + override_immediate_call_return_value: false, }, - instruction: EthInstructions::default(), - precompiles: precompiles(), - } + EthInstructions::default(), + precompiles(), + ) } /// The worst-case gas cost for a legacy transaction which executes this batch. @@ -262,7 +261,7 @@ impl Router { let fee = if fee_per_gas == U256::ZERO { U256::ZERO } else { U256::ONE }; // Set a balance of the amount sent out to ensure we don't error on that premise - gas_estimator.data.ctx.modify_db(|db| { + gas_estimator.ctx.modify_db(|db| { let account = db.load_account(self.address).unwrap(); account.info.balance = fee + outs.0.iter().map(|out| out.amount).sum::(); }); @@ -290,7 +289,7 @@ impl Router { consistent use of nonce #1 shows storage read/writes aren't being persisted. They're solely returned upon execution in a `state` field we ignore. */ - gas_estimator.data.ctx.modify_tx(|tx| { + gas_estimator.ctx.modify_tx(|tx| { tx.caller = Address::from({ /* We assume the transaction sender is not the destination of any `OutInstruction`, making @@ -317,21 +316,17 @@ impl Router { }); // Execute the transaction - let mut gas = match MainnetHandler::< - _, - EVMError, - EthFrame<_, _, _>, - >::default() - .inspect_run(&mut gas_estimator) - .unwrap() - .result - { - ExecutionResult::Success { gas_used, gas_refunded, .. } => { - assert_eq!(gas_refunded, 0); - gas_used - } - res => panic!("estimated execute transaction failed: {res:?}"), - }; + let mut gas = + match MainnetHandler::<_, EVMError, EthFrame<_>>::default() + .inspect_run(&mut gas_estimator) + .unwrap() + { + ExecutionResult::Success { gas_used, gas_refunded, .. } => { + assert_eq!(gas_refunded, 0); + gas_used + } + res => panic!("estimated execute transaction failed: {res:?}"), + }; gas += gas_estimator.into_inspector().unused_gas; /* diff --git a/processor/ethereum/src/key_gen.rs b/processor/ethereum/src/key_gen.rs index 581684ef..34cedc15 100644 --- a/processor/ethereum/src/key_gen.rs +++ b/processor/ethereum/src/key_gen.rs @@ -1,5 +1,5 @@ -use ciphersuite::{Ciphersuite, Secp256k1}; -use dkg::ThresholdKeys; +use ciphersuite::Ciphersuite; +use dkg::{ThresholdKeys, Curves, Secp256k1}; use ethereum_schnorr::PublicKey; @@ -9,17 +9,23 @@ impl key_gen::KeyGenParams for KeyGenParams { type ExternalNetworkCiphersuite = Secp256k1; - fn tweak_keys(keys: &mut ThresholdKeys) { + fn tweak_keys( + keys: &mut ThresholdKeys<::ToweringCurve>, + ) { while PublicKey::new(keys.group_key()).is_none() { - *keys = keys.offset(::F::ONE); + *keys = keys.clone().offset(<::ToweringCurve as Ciphersuite>::F::ONE); } } - fn encode_key(key: ::G) -> Vec { + fn encode_key( + key: <::ToweringCurve as Ciphersuite>::G, + ) -> Vec { PublicKey::new(key).unwrap().eth_repr().to_vec() } - fn decode_key(key: &[u8]) -> Option<::G> { + fn decode_key( + key: &[u8], + ) -> Option<<::ToweringCurve as Ciphersuite>::G> { PublicKey::from_eth_repr(key.try_into().ok()?).map(|key| key.point()) } } diff --git a/processor/ethereum/src/primitives/block.rs b/processor/ethereum/src/primitives/block.rs index 9d4a8a2d..cf25a6bb 100644 --- a/processor/ethereum/src/primitives/block.rs +++ b/processor/ethereum/src/primitives/block.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; -use ciphersuite::{Ciphersuite, Secp256k1}; +use ciphersuite::Ciphersuite; +use ciphersuite_kp256::Secp256k1; use serai_client::networks::ethereum::Address; diff --git a/processor/ethereum/src/primitives/machine.rs b/processor/ethereum/src/primitives/machine.rs index e3252f30..55e65fb8 100644 --- a/processor/ethereum/src/primitives/machine.rs +++ b/processor/ethereum/src/primitives/machine.rs @@ -2,7 +2,8 @@ use std::{io, collections::HashMap}; use rand_core::{RngCore, CryptoRng}; -use ciphersuite::{Ciphersuite, Secp256k1}; +use ciphersuite::Ciphersuite; +use ciphersuite_kp256::Secp256k1; use frost::{ dkg::{Participant, ThresholdKeys}, FrostError, diff --git a/processor/ethereum/src/primitives/output.rs b/processor/ethereum/src/primitives/output.rs index 797b528d..9fe2ba60 100644 --- a/processor/ethereum/src/primitives/output.rs +++ b/processor/ethereum/src/primitives/output.rs @@ -1,6 +1,7 @@ use std::io; -use ciphersuite::{group::GroupEncoding, Ciphersuite, Secp256k1}; +use ciphersuite::{group::GroupEncoding, Ciphersuite}; +use ciphersuite_kp256::Secp256k1; use alloy_core::primitives::U256; diff --git a/processor/ethereum/src/primitives/transaction.rs b/processor/ethereum/src/primitives/transaction.rs index 3bee4c59..931815db 100644 --- a/processor/ethereum/src/primitives/transaction.rs +++ b/processor/ethereum/src/primitives/transaction.rs @@ -1,6 +1,6 @@ use std::io; -use ciphersuite::Secp256k1; +use ciphersuite_kp256::Secp256k1; use frost::dkg::ThresholdKeys; use alloy_core::primitives::{U256, Address as EthereumAddress}; diff --git a/processor/ethereum/test-primitives/Cargo.toml b/processor/ethereum/test-primitives/Cargo.toml index 2efb6b1e..06000ce1 100644 --- a/processor/ethereum/test-primitives/Cargo.toml +++ b/processor/ethereum/test-primitives/Cargo.toml @@ -20,9 +20,9 @@ workspace = true k256 = { version = "0.13", default-features = false, features = ["std"] } alloy-core = { version = "1", default-features = false } -alloy-consensus = { version = "0.14", default-features = false, features = ["std"] } +alloy-consensus = { version = "1", default-features = false, features = ["std"] } -alloy-rpc-types-eth = { version = "0.14", default-features = false } -alloy-provider = { version = "0.14", default-features = false } +alloy-rpc-types-eth = { version = "1", default-features = false } +alloy-provider = { version = "1", default-features = false } ethereum-primitives = { package = "serai-processor-ethereum-primitives", path = "../primitives", default-features = false } diff --git a/processor/key-gen/Cargo.toml b/processor/key-gen/Cargo.toml index ea2eb16b..c263e0e3 100644 --- a/processor/key-gen/Cargo.toml +++ b/processor/key-gen/Cargo.toml @@ -31,9 +31,7 @@ rand_chacha = { version = "0.3", default-features = false, features = ["std"] } # Cryptography blake2 = { version = "0.10", default-features = false, features = ["std"] } transcript = { package = "flexible-transcript", path = "../../crypto/transcript", default-features = false, features = ["std"] } -ec-divisors = { git = "https://github.com/kayabaNerve/monero-oxide", rev = "54da48f27a05fa8656014942919da1dfbab4d8e3", default-features = false } ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } -dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "ristretto"] } # Substrate diff --git a/processor/key-gen/src/db.rs b/processor/key-gen/src/db.rs index 149fe1a2..4496a9c6 100644 --- a/processor/key-gen/src/db.rs +++ b/processor/key-gen/src/db.rs @@ -3,8 +3,8 @@ use std::collections::HashMap; use zeroize::Zeroizing; -use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; -use dkg::{Participant, ThresholdCore, ThresholdKeys, evrf::EvrfCurve}; +use ciphersuite::{group::GroupEncoding, Ciphersuite}; +use dkg::*; use serai_validator_sets_primitives::Session; @@ -17,9 +17,9 @@ pub(crate) struct Params { pub(crate) t: u16, pub(crate) n: u16, pub(crate) substrate_evrf_public_keys: - Vec<<::EmbeddedCurve as Ciphersuite>::G>, + Vec<<::EmbeddedCurve as Ciphersuite>::G>, pub(crate) network_evrf_public_keys: - Vec<<::EmbeddedCurve as Ciphersuite>::G>, + Vec<<::EmbeddedCurve as Ciphersuite>::G>, } #[derive(BorshSerialize, BorshDeserialize)] @@ -85,7 +85,7 @@ impl KeyGenDb

{ .substrate_evrf_public_keys .into_iter() .map(|key| { - <::EmbeddedCurve as Ciphersuite>::read_G(&mut key.as_slice()) + <::EmbeddedCurve as Ciphersuite>::read_G(&mut key.as_slice()) .unwrap() }) .collect(), @@ -93,7 +93,7 @@ impl KeyGenDb

{ .network_evrf_public_keys .into_iter() .map(|key| { - <::EmbeddedCurve as Ciphersuite>::read_G::< + <::EmbeddedCurve as Ciphersuite>::read_G::< &[u8], >(&mut key.as_ref()) .unwrap() @@ -117,8 +117,8 @@ impl KeyGenDb

{ pub(crate) fn set_key_shares( txn: &mut impl DbTxn, session: Session, - substrate_keys: &[ThresholdKeys], - network_keys: &[ThresholdKeys], + substrate_keys: &[ThresholdKeys<::ToweringCurve>], + network_keys: &[ThresholdKeys<::ToweringCurve>], ) { assert_eq!(substrate_keys.len(), network_keys.len()); @@ -134,16 +134,18 @@ impl KeyGenDb

{ pub(crate) fn key_shares( getter: &impl Get, session: Session, - ) -> Option<(Vec>, Vec>)> - { + ) -> Option<( + Vec::ToweringCurve>>, + Vec::ToweringCurve>>, + )> { let keys = _db::KeyShares::get(getter, &session)?; let mut keys: &[u8] = keys.as_ref(); let mut substrate_keys = vec![]; let mut network_keys = vec![]; while !keys.is_empty() { - substrate_keys.push(ThresholdKeys::new(ThresholdCore::read(&mut keys).unwrap())); - let mut these_network_keys = ThresholdKeys::new(ThresholdCore::read(&mut keys).unwrap()); + substrate_keys.push(ThresholdKeys::read(&mut keys).unwrap()); + let mut these_network_keys = ThresholdKeys::read(&mut keys).unwrap(); P::tweak_keys(&mut these_network_keys); network_keys.push(these_network_keys); } diff --git a/processor/key-gen/src/generators.rs b/processor/key-gen/src/generators.rs index cff9c2f1..fa65f9fd 100644 --- a/processor/key-gen/src/generators.rs +++ b/processor/key-gen/src/generators.rs @@ -4,7 +4,7 @@ use std::{ collections::HashMap, }; -use dkg::evrf::*; +use dkg::*; use serai_validator_sets_primitives::MAX_KEY_SHARES_PER_SET; @@ -21,14 +21,14 @@ use serai_validator_sets_primitives::MAX_KEY_SHARES_PER_SET; static GENERATORS: LazyLock>> = LazyLock::new(|| Mutex::new(HashMap::new())); -pub(crate) fn generators() -> &'static EvrfGenerators { +pub(crate) fn generators() -> &'static Generators { GENERATORS .lock() .unwrap() .entry(TypeId::of::()) .or_insert_with(|| { // If we haven't prior needed generators for this Ciphersuite, generate new ones - Box::leak(Box::new(EvrfGenerators::::new( + Box::leak(Box::new(Generators::::new( (MAX_KEY_SHARES_PER_SET * 2 / 3) + 1, MAX_KEY_SHARES_PER_SET, ))) diff --git a/processor/key-gen/src/lib.rs b/processor/key-gen/src/lib.rs index 4db87b20..c605b791 100644 --- a/processor/key-gen/src/lib.rs +++ b/processor/key-gen/src/lib.rs @@ -13,9 +13,9 @@ use blake2::{Digest, Blake2s256}; use transcript::{Transcript, RecommendedTranscript}; use ciphersuite::{ group::{Group, GroupEncoding}, - Ciphersuite, Ristretto, + Ciphersuite, }; -use dkg::{Participant, ThresholdKeys, evrf::*}; +use dkg::*; use serai_validator_sets_primitives::Session; use messages::key_gen::*; @@ -34,33 +34,36 @@ pub trait KeyGenParams { const ID: &'static str; /// The curve used for the external network. - type ExternalNetworkCiphersuite: EvrfCurve< - EmbeddedCurve: Ciphersuite< - G: ec_divisors::DivisorCurve< - FieldElement = ::F, - >, - >, - >; + type ExternalNetworkCiphersuite: 'static + Curves; /// Tweaks keys as necessary/beneficial. /// /// A default implementation which doesn't perform any tweaking is provided. - fn tweak_keys(keys: &mut ThresholdKeys) { + fn tweak_keys( + keys: &mut ThresholdKeys<::ToweringCurve>, + ) { let _ = keys; } /// Encode keys as optimal. /// /// A default implementation is provided which calls the traditional `to_bytes`. - fn encode_key(key: ::G) -> Vec { + fn encode_key( + key: <::ToweringCurve as Ciphersuite>::G, + ) -> Vec { key.to_bytes().as_ref().to_vec() } /// Decode keys from their optimal encoding. /// /// A default implementation is provided which calls the traditional `from_bytes`. - fn decode_key(mut key: &[u8]) -> Option<::G> { - let res = ::read_G(&mut key).ok()?; + fn decode_key( + mut key: &[u8], + ) -> Option<<::ToweringCurve as Ciphersuite>::G> { + let res = <::ToweringCurve as Ciphersuite>::read_G( + &mut key, + ) + .ok()?; if !key.is_empty() { None?; } @@ -96,10 +99,10 @@ pub trait KeyGenParams { Returns the coerced keys and faulty participants. */ -fn coerce_keys( +fn coerce_keys( key_bytes: &[impl AsRef<[u8]>], ) -> (Vec<::G>, Vec) { - fn evrf_key(key: &[u8]) -> Option<::G> { + fn evrf_key(key: &[u8]) -> Option<::G> { let mut repr = <::G as GroupEncoding>::Repr::default(); if repr.as_ref().len() != key.len() { None?; @@ -146,21 +149,18 @@ fn coerce_keys( /// An instance of the Serai key generation protocol. #[derive(Debug)] pub struct KeyGen { - substrate_evrf_private_key: - Zeroizing<<::EmbeddedCurve as Ciphersuite>::F>, + substrate_evrf_private_key: Zeroizing<<::EmbeddedCurve as Ciphersuite>::F>, network_evrf_private_key: - Zeroizing<<::EmbeddedCurve as Ciphersuite>::F>, + Zeroizing<<::EmbeddedCurve as Ciphersuite>::F>, } impl KeyGen

{ /// Create a new key generation instance. #[allow(clippy::new_ret_no_self)] pub fn new( - substrate_evrf_private_key: Zeroizing< - <::EmbeddedCurve as Ciphersuite>::F, - >, + substrate_evrf_private_key: Zeroizing<<::EmbeddedCurve as Ciphersuite>::F>, network_evrf_private_key: Zeroizing< - <::EmbeddedCurve as Ciphersuite>::F, + <::EmbeddedCurve as Ciphersuite>::F, >, ) -> KeyGen

{ KeyGen { substrate_evrf_private_key, network_evrf_private_key } @@ -171,8 +171,10 @@ impl KeyGen

{ pub fn key_shares( getter: &impl Get, session: Session, - ) -> Option<(Vec>, Vec>)> - { + ) -> Option<( + Vec::ToweringCurve>>, + Vec::ToweringCurve>>, + )> { // This is safe, despite not having a txn, since it's a static value // It doesn't change over time/in relation to other operations // It is solely set or unset @@ -209,14 +211,14 @@ impl KeyGen

{ faulty.extend(additional_faulty); // Participate for both Substrate and the network - fn participate( + fn participate( context: [u8; 32], threshold: u16, evrf_public_keys: &[::G], evrf_private_key: &Zeroizing<::F>, output: &mut impl io::Write, ) { - let participation = EvrfDkg::::participate( + let participation = Dkg::::participate( &mut OsRng, generators(), context, @@ -270,7 +272,7 @@ impl KeyGen

{ } CoordinatorMessage::Participation { session, participant, participation } => { - log::debug!("received participation from {:?} for {:?}", participant, session); + log::debug!("received participation from {participant:?} for {session:?}"); let Params { t: threshold, n, substrate_evrf_public_keys, network_evrf_public_keys } = KeyGenDb::

::params(txn, session).unwrap(); @@ -305,9 +307,9 @@ impl KeyGen

{ // participations and continue. We solely have to verify them, as to identify malicious // participants and prevent DoSs, before returning if Self::key_shares(txn, session).is_some() { - log::debug!("already finished generating a key for {:?}", session); + log::debug!("already finished generating a key for {session:?}"); - match EvrfDkg::::verify( + match Dkg::::verify( &mut OsRng, generators(), context::

(session, SUBSTRATE_KEY_CONTEXT), @@ -324,7 +326,7 @@ impl KeyGen

{ } } - match EvrfDkg::::verify( + match Dkg::::verify( &mut OsRng, generators(), context::

(session, NETWORK_KEY_CONTEXT), @@ -404,7 +406,7 @@ impl KeyGen

{ } // If we now have the threshold participating, verify their `Participation`s - fn verify_dkg( + fn verify_dkg( txn: &mut impl DbTxn, session: Session, true_if_substrate_false_if_network: bool, @@ -412,7 +414,7 @@ impl KeyGen

{ evrf_public_keys: &[::G], substrate_participations: &mut HashMap>, network_participations: &mut HashMap>, - ) -> Result, Vec> { + ) -> Result, Vec> { // Parse the `Participation`s let participations = (if true_if_substrate_false_if_network { &*substrate_participations @@ -433,7 +435,7 @@ impl KeyGen

{ .collect(); // Actually call verify on the DKG - match EvrfDkg::::verify( + match Dkg::::verify( &mut OsRng, generators(), context::

( diff --git a/processor/monero/Cargo.toml b/processor/monero/Cargo.toml index 7a3313c2..29c5af7e 100644 --- a/processor/monero/Cargo.toml +++ b/processor/monero/Cargo.toml @@ -25,8 +25,8 @@ zeroize = { version = "1", default-features = false, features = ["std"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["std"] } borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] } -dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "ed25519"] } frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false } diff --git a/processor/monero/src/key_gen.rs b/processor/monero/src/key_gen.rs index 6e30d7bf..c3699070 100644 --- a/processor/monero/src/key_gen.rs +++ b/processor/monero/src/key_gen.rs @@ -1,4 +1,4 @@ -use ciphersuite::Ed25519; +use dkg::Ed25519; pub(crate) struct KeyGenParams; impl key_gen::KeyGenParams for KeyGenParams { diff --git a/processor/monero/src/primitives/block.rs b/processor/monero/src/primitives/block.rs index 6afae429..e00b6ff2 100644 --- a/processor/monero/src/primitives/block.rs +++ b/processor/monero/src/primitives/block.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; -use ciphersuite::{Ciphersuite, Ed25519}; +use ciphersuite::Ciphersuite; +use dalek_ff_group::Ed25519; use monero_wallet::{ block::Block as MBlock, rpc::ScannableBlock as MScannableBlock, ScanError, GuaranteedScanner, diff --git a/processor/monero/src/primitives/mod.rs b/processor/monero/src/primitives/mod.rs index 317cae28..8428da4c 100644 --- a/processor/monero/src/primitives/mod.rs +++ b/processor/monero/src/primitives/mod.rs @@ -1,6 +1,7 @@ use zeroize::Zeroizing; -use ciphersuite::{Ciphersuite, Ed25519}; +use ciphersuite::Ciphersuite; +use dalek_ff_group::Ed25519; use monero_wallet::{address::SubaddressIndex, ViewPairError, GuaranteedViewPair}; diff --git a/processor/monero/src/primitives/output.rs b/processor/monero/src/primitives/output.rs index b2b87a5c..f26ed01c 100644 --- a/processor/monero/src/primitives/output.rs +++ b/processor/monero/src/primitives/output.rs @@ -1,6 +1,7 @@ use std::io; -use ciphersuite::{group::Group, Ciphersuite, Ed25519}; +use ciphersuite::{group::Group, Ciphersuite}; +use dalek_ff_group::Ed25519; use monero_wallet::WalletOutput; diff --git a/processor/monero/src/primitives/transaction.rs b/processor/monero/src/primitives/transaction.rs index eeeef81d..78ef7a9f 100644 --- a/processor/monero/src/primitives/transaction.rs +++ b/processor/monero/src/primitives/transaction.rs @@ -2,7 +2,7 @@ use std::io; use rand_core::{RngCore, CryptoRng}; -use ciphersuite::Ed25519; +use dalek_ff_group::Ed25519; use frost::{dkg::ThresholdKeys, sign::PreprocessMachine}; use monero_wallet::{ diff --git a/processor/monero/src/scheduler.rs b/processor/monero/src/scheduler.rs index 9043f888..45b837a0 100644 --- a/processor/monero/src/scheduler.rs +++ b/processor/monero/src/scheduler.rs @@ -4,7 +4,8 @@ use zeroize::Zeroizing; use rand_core::SeedableRng; use rand_chacha::ChaCha20Rng; -use ciphersuite::{Ciphersuite, Ed25519}; +use ciphersuite::Ciphersuite; +use dalek_ff_group::Ed25519; use monero_wallet::rpc::{FeeRate, RpcError}; @@ -200,6 +201,9 @@ impl TransactionPlanner for Planner { Err(SendError::TooLargeTransaction) => { panic!("too large transaction despite MAX_INPUTS/MAX_OUTPUTS") } + Err(SendError::AmountsUnrepresentable { .. }) => { + panic!("monero-wallet AmountsUnrepresentable") + } Err( SendError::WrongPrivateKey | SendError::MaliciousSerialization | @@ -255,6 +259,9 @@ impl TransactionPlanner for Planner { Err(SendError::TooLargeTransaction) => { panic!("too large transaction despite MAX_INPUTS/MAX_OUTPUTS") } + Err(SendError::AmountsUnrepresentable { .. }) => { + panic!("monero-wallet AmountsUnrepresentable") + } Err( SendError::WrongPrivateKey | SendError::MaliciousSerialization | diff --git a/processor/scanner/src/index/mod.rs b/processor/scanner/src/index/mod.rs index 50032bae..ace46267 100644 --- a/processor/scanner/src/index/mod.rs +++ b/processor/scanner/src/index/mod.rs @@ -70,12 +70,13 @@ impl ContinuallyRan for IndexTask { Err(e) => Err(format!("couldn't fetch the latest finalized block number: {e:?}"))?, }; + #[allow(clippy::uninlined_format_args)] if latest_finalized < our_latest_finalized { // Explicitly log this as an error as returned ephemeral errors are logged with debug // This doesn't panic as the node should sync along our indexed chain, and if it doesn't, // we'll panic at that point in time log::error!( - "node is out of sync, latest finalized {} is behind our indexed {}", + "node is out of sync, latest finalized ({}) is behind our indexed ({})", latest_finalized, our_latest_finalized ); diff --git a/processor/signers/Cargo.toml b/processor/signers/Cargo.toml index ecf588d4..feaa9a30 100644 --- a/processor/signers/Cargo.toml +++ b/processor/signers/Cargo.toml @@ -26,6 +26,7 @@ zeroize = { version = "1", default-features = false, features = ["std"] } blake2 = { version = "0.10", default-features = false, features = ["std"] } ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false } frost-schnorrkel = { path = "../../crypto/schnorrkel", default-features = false } diff --git a/processor/signers/src/batch/mod.rs b/processor/signers/src/batch/mod.rs index f38666a8..695ce4e0 100644 --- a/processor/signers/src/batch/mod.rs +++ b/processor/signers/src/batch/mod.rs @@ -2,7 +2,8 @@ use core::future::Future; use std::collections::HashSet; use blake2::{digest::typenum::U32, Digest, Blake2b}; -use ciphersuite::{group::GroupEncoding, Ristretto}; +use ciphersuite::group::GroupEncoding; +use dalek_ff_group::Ristretto; use frost::dkg::ThresholdKeys; use scale::Encode; diff --git a/processor/signers/src/cosign/mod.rs b/processor/signers/src/cosign/mod.rs index ddf6c490..2dc16c31 100644 --- a/processor/signers/src/cosign/mod.rs +++ b/processor/signers/src/cosign/mod.rs @@ -1,6 +1,6 @@ use core::future::Future; -use ciphersuite::Ristretto; +use dalek_ff_group::Ristretto; use frost::dkg::ThresholdKeys; use scale::Encode; diff --git a/processor/signers/src/lib.rs b/processor/signers/src/lib.rs index 2f5a4a04..79b152ab 100644 --- a/processor/signers/src/lib.rs +++ b/processor/signers/src/lib.rs @@ -7,8 +7,9 @@ use std::collections::HashMap; use zeroize::Zeroizing; -use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; -use frost::dkg::{ThresholdCore, ThresholdKeys}; +use ciphersuite::{group::GroupEncoding, Ciphersuite}; +use dalek_ff_group::Ristretto; +use frost::dkg::ThresholdKeys; use serai_primitives::Signature; use serai_validator_sets_primitives::{Session, SlashReport}; @@ -262,11 +263,8 @@ impl< let mut substrate_keys = vec![]; let mut external_keys = vec![]; while !buf.is_empty() { - substrate_keys - .push(ThresholdKeys::from(ThresholdCore::::read(&mut buf).unwrap())); - external_keys.push(ThresholdKeys::from( - ThresholdCore::>::read(&mut buf).unwrap(), - )); + substrate_keys.push(ThresholdKeys::::read(&mut buf).unwrap()); + external_keys.push(ThresholdKeys::>::read(&mut buf).unwrap()); } tasks.insert( diff --git a/processor/signers/src/slash_report.rs b/processor/signers/src/slash_report.rs index 14437a74..25448401 100644 --- a/processor/signers/src/slash_report.rs +++ b/processor/signers/src/slash_report.rs @@ -1,6 +1,6 @@ use core::{marker::PhantomData, future::Future}; -use ciphersuite::Ristretto; +use dalek_ff_group::Ristretto; use frost::dkg::ThresholdKeys; use serai_primitives::Signature; diff --git a/processor/signers/src/wrapped_schnorrkel.rs b/processor/signers/src/wrapped_schnorrkel.rs index a84b8d43..52a09d24 100644 --- a/processor/signers/src/wrapped_schnorrkel.rs +++ b/processor/signers/src/wrapped_schnorrkel.rs @@ -5,7 +5,7 @@ use std::{ use rand_core::{RngCore, CryptoRng}; -use ciphersuite::Ristretto; +use dalek_ff_group::Ristretto; use frost::{ dkg::{Participant, ThresholdKeys}, FrostError, diff --git a/substrate/client/Cargo.toml b/substrate/client/Cargo.toml index c1a589c6..2e5b417f 100644 --- a/substrate/client/Cargo.toml +++ b/substrate/client/Cargo.toml @@ -51,8 +51,9 @@ hex = "0.4" blake2 = "0.10" -dalek-ff-group = { path = "../../crypto/dalek-ff-group" } ciphersuite = { path = "../../crypto/ciphersuite" } +dalek-ff-group = { path = "../../crypto/dalek-ff-group" } +ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256" } dkg-musig = { path = "../../crypto/dkg/musig" } frost = { package = "modular-frost", path = "../../crypto/frost", features = ["tests"] } schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" } diff --git a/substrate/client/src/networks/monero.rs b/substrate/client/src/networks/monero.rs index 68d9ad70..5e8f6ddc 100644 --- a/substrate/client/src/networks/monero.rs +++ b/substrate/client/src/networks/monero.rs @@ -1,7 +1,5 @@ use core::{str::FromStr, fmt}; -use scale::{Encode, Decode}; - use dalek_ff_group::Ed25519; use ciphersuite::Ciphersuite; diff --git a/substrate/client/src/serai/mod.rs b/substrate/client/src/serai/mod.rs index 25f8f998..61bde40b 100644 --- a/substrate/client/src/serai/mod.rs +++ b/substrate/client/src/serai/mod.rs @@ -301,13 +301,13 @@ impl Serai { /// /// The binding occurs at time of call. This does not track the latest finalized block and update /// itself. - pub async fn as_of_latest_finalized_block(&self) -> Result { + pub async fn as_of_latest_finalized_block(&self) -> Result, SeraiError> { let latest = self.latest_finalized_block_hash().await?; Ok(TemporalSerai { serai: self, block: latest, events: RwLock::new(None) }) } /// Returns a TemporalSerai able to retrieve state as of the specified block. - pub fn as_of(&self, block: [u8; 32]) -> TemporalSerai { + pub fn as_of(&self, block: [u8; 32]) -> TemporalSerai<'_> { TemporalSerai { serai: self, block, events: RwLock::new(None) } } @@ -424,11 +424,11 @@ impl TemporalSerai<'_> { SeraiValidatorSets(self) } - pub fn genesis_liquidity(&self) -> SeraiGenesisLiquidity { + pub fn genesis_liquidity(&self) -> SeraiGenesisLiquidity<'_> { SeraiGenesisLiquidity(self) } - pub fn liquidity_tokens(&self) -> SeraiLiquidityTokens { + pub fn liquidity_tokens(&self) -> SeraiLiquidityTokens<'_> { SeraiLiquidityTokens(self) } } diff --git a/substrate/client/tests/common/genesis_liquidity.rs b/substrate/client/tests/common/genesis_liquidity.rs index c14ac609..2e799602 100644 --- a/substrate/client/tests/common/genesis_liquidity.rs +++ b/substrate/client/tests/common/genesis_liquidity.rs @@ -111,7 +111,7 @@ async fn set_values(serai: &Serai, values: &Values) { frost::tests::algorithm_machines( &mut OsRng, &Schnorrkel::new(b"substrate"), - &HashMap::from([(threshold_keys.params().i(), threshold_keys.into())]), + &HashMap::from([(threshold_keys.params().i(), threshold_keys)]), ), &oraclize_values_message(&set, values), ); diff --git a/substrate/client/tests/common/validator_sets.rs b/substrate/client/tests/common/validator_sets.rs index 388fb8b5..666ea379 100644 --- a/substrate/client/tests/common/validator_sets.rs +++ b/substrate/client/tests/common/validator_sets.rs @@ -55,8 +55,8 @@ pub async fn set_keys( } let mut musig_keys = HashMap::new(); - for tk in threshold_keys { - musig_keys.insert(tk.params().i(), tk.into()); + for threshold_keys in threshold_keys { + musig_keys.insert(threshold_keys.params().i(), threshold_keys); } let sig = frost::tests::sign_without_caching( diff --git a/substrate/client/tests/serai-rpc.rs b/substrate/client/tests/serai-rpc.rs index 53148644..91aa2061 100644 --- a/substrate/client/tests/serai-rpc.rs +++ b/substrate/client/tests/serai-rpc.rs @@ -5,8 +5,10 @@ use zeroize::Zeroizing; use ciphersuite::{ group::{ff::Field, GroupEncoding}, - Ciphersuite, Ed25519, Secp256k1, + Ciphersuite, }; +use dalek_ff_group::Ed25519; +use ciphersuite_kp256::Secp256k1; use sp_core::{ Pair as PairTrait, @@ -67,7 +69,7 @@ async fn test_external_address(serai: Serai) { set_network_keys::( &serai, ExternalValidatorSet { session: Session(0), network }, - &[pair.clone()], + core::slice::from_ref(&pair), ) .await; diff --git a/substrate/dex/pallet/src/tests.rs b/substrate/dex/pallet/src/tests.rs index 8770b517..1a23a7a2 100644 --- a/substrate/dex/pallet/src/tests.rs +++ b/substrate/dex/pallet/src/tests.rs @@ -1298,7 +1298,7 @@ fn cannot_block_pool_creation() { )); // Then, the attacker creates 14 tokens and sends one of each to the pool account // skip the coin1 and coin2 coins. - for coin in coins().into_iter().filter(|c| (*c != coin1 && *c != coin2)) { + for coin in coins().into_iter().filter(|c| (*c != coin1) && (*c != coin2)) { assert_ok!(CoinsPallet::::mint(attacker, Balance { coin, amount: Amount(1000) })); assert_ok!(CoinsPallet::::transfer_internal( attacker, diff --git a/substrate/node/Cargo.toml b/substrate/node/Cargo.toml index c6a7b50e..b0d9d858 100644 --- a/substrate/node/Cargo.toml +++ b/substrate/node/Cargo.toml @@ -28,6 +28,8 @@ log = "0.4" schnorrkel = "0.11" ciphersuite = { path = "../../crypto/ciphersuite" } +ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256" } +dalek-ff-group = { path = "../../crypto/dalek-ff-group" } embedwards25519 = { path = "../../crypto/evrf/embedwards25519" } secq256k1 = { path = "../../crypto/evrf/secq256k1" } diff --git a/substrate/node/src/main.rs b/substrate/node/src/main.rs index 5f33b51b..5dcd0e47 100644 --- a/substrate/node/src/main.rs +++ b/substrate/node/src/main.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + mod keystore; mod chain_spec; diff --git a/substrate/node/src/rpc.rs b/substrate/node/src/rpc.rs index f098238b..7ef8bbef 100644 --- a/substrate/node/src/rpc.rs +++ b/substrate/node/src/rpc.rs @@ -50,8 +50,10 @@ where { use substrate_frame_rpc_system::{System, SystemApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; - use ciphersuite::{Ciphersuite, Ed25519, Secp256k1}; - use bitcoin_serai::{bitcoin, crypto::x_only}; + use ciphersuite::Ciphersuite; + use ciphersuite_kp256::{k256::elliptic_curve::point::AffineCoordinates, Secp256k1}; + use dalek_ff_group::Ed25519; + use bitcoin_serai::bitcoin; let mut module = RpcModule::new(()); let FullDeps { id, client, pool, deny_unsafe, authority_discovery } = deps; @@ -128,7 +130,11 @@ where .map_err(|_| Error::Custom("invalid key stored in db".to_string()))?; let addr = bitcoin::Address::p2tr_tweaked( - bitcoin::key::TweakedPublicKey::dangerous_assume_tweaked(x_only(&key)), + bitcoin::key::TweakedPublicKey::dangerous_assume_tweaked( + bitcoin::key::XOnlyPublicKey::from_slice(key.to_affine().x().as_slice()).map_err( + |_| Error::Custom("x-coordinate for Bitcoin key was invalid".to_string()), + )?, + ), bitcoin::address::KnownHrp::Mainnet, ); diff --git a/substrate/validator-sets/pallet/Cargo.toml b/substrate/validator-sets/pallet/Cargo.toml index 03a4f65f..bdf0a87a 100644 --- a/substrate/validator-sets/pallet/Cargo.toml +++ b/substrate/validator-sets/pallet/Cargo.toml @@ -49,7 +49,9 @@ pallet-timestamp = { git = "https://github.com/serai-dex/substrate", default-fea sp-consensus-babe = { git = "https://github.com/serai-dex/substrate", default-features = false } -ciphersuite = { path = "../../../crypto/ciphersuite", features = ["std"] } +ciphersuite = { path = "../../../crypto/ciphersuite", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../../crypto/dalek-ff-group", default-features = false, features = ["std"] } +dkg-musig = { path = "../../../crypto/dkg/musig", default-features = false, features = ["std"] } frost = { package = "modular-frost", path = "../../../crypto/frost", features = ["tests"] } schnorrkel = { path = "../../../crypto/schnorrkel", package = "frost-schnorrkel" } diff --git a/substrate/validator-sets/pallet/src/tests.rs b/substrate/validator-sets/pallet/src/tests.rs index 84b5f14c..4fa35a51 100644 --- a/substrate/validator-sets/pallet/src/tests.rs +++ b/substrate/validator-sets/pallet/src/tests.rs @@ -2,8 +2,9 @@ use crate::{mock::*, primitives::*}; use std::collections::HashMap; -use ciphersuite::{Ciphersuite, Ristretto}; -use frost::dkg::musig::musig; +use ciphersuite::Ciphersuite; +use dalek_ff_group::Ristretto; +use dkg_musig::musig; use schnorrkel::Schnorrkel; use zeroize::Zeroizing; @@ -87,14 +88,14 @@ fn set_keys_signature(set: &ExternalValidatorSet, key_pair: &KeyPair, pairs: &[P assert_eq!(Ristretto::generator() * secret_key, pub_keys[i]); threshold_keys.push( - musig::(&musig_context((*set).into()), &Zeroizing::new(secret_key), &pub_keys) + musig::(musig_context((*set).into()), Zeroizing::new(secret_key), &pub_keys) .unwrap(), ); } let mut musig_keys = HashMap::new(); - for tk in threshold_keys { - musig_keys.insert(tk.params().i(), tk.into()); + for threshold_keys in threshold_keys { + musig_keys.insert(threshold_keys.params().i(), threshold_keys); } let sig = frost::tests::sign_without_caching( diff --git a/tests/coordinator/Cargo.toml b/tests/coordinator/Cargo.toml index 8600b440..cdd6d4f2 100644 --- a/tests/coordinator/Cargo.toml +++ b/tests/coordinator/Cargo.toml @@ -25,6 +25,8 @@ rand_core = { version = "0.6", default-features = false } blake2 = "0.10" ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } +ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } embedwards25519 = { path = "../../crypto/evrf/embedwards25519" } secq256k1 = { path = "../../crypto/evrf/secq256k1" } diff --git a/tests/coordinator/src/lib.rs b/tests/coordinator/src/lib.rs index e8a5b2fc..8f432b51 100644 --- a/tests/coordinator/src/lib.rs +++ b/tests/coordinator/src/lib.rs @@ -16,8 +16,9 @@ use zeroize::Zeroizing; use ciphersuite::{ group::{ff::PrimeField, GroupEncoding}, - Ciphersuite, Ristretto, + Ciphersuite, }; +use dalek_ff_group::Ristretto; use embedwards25519::Embedwards25519; use secq256k1::Secq256k1; diff --git a/tests/coordinator/src/tests/batch.rs b/tests/coordinator/src/tests/batch.rs index 4fb5e858..d1d1c9bc 100644 --- a/tests/coordinator/src/tests/batch.rs +++ b/tests/coordinator/src/tests/batch.rs @@ -10,7 +10,9 @@ use blake2::{ digest::{consts::U32, Digest}, Blake2b, }; -use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto, Secp256k1}; +use ciphersuite::{group::GroupEncoding, Ciphersuite} +use ciphersuite_kp256::Secp256k1; +use dalek_ff_group::Ristretto; use dkg::Participant; use scale::Encode; diff --git a/tests/coordinator/src/tests/key_gen.rs b/tests/coordinator/src/tests/key_gen.rs index 8b57f4da..2b033d30 100644 --- a/tests/coordinator/src/tests/key_gen.rs +++ b/tests/coordinator/src/tests/key_gen.rs @@ -5,8 +5,10 @@ use rand_core::OsRng; use ciphersuite::{ group::{ff::Field, GroupEncoding}, - Ciphersuite, Ristretto, Secp256k1, + Ciphersuite, }; +use ciphersuite_kp256::Secq256k1; +use dalek_ff_group::Ristretto; use dkg::Participant; use serai_client::{ diff --git a/tests/message-queue/Cargo.toml b/tests/message-queue/Cargo.toml index 0feb9e45..e12b08c3 100644 --- a/tests/message-queue/Cargo.toml +++ b/tests/message-queue/Cargo.toml @@ -23,6 +23,7 @@ zeroize = { version = "1", default-features = false } rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } serai-primitives = { path = "../../substrate/primitives" } serai-message-queue = { path = "../../message-queue" } diff --git a/tests/message-queue/src/lib.rs b/tests/message-queue/src/lib.rs index a2eab627..6f7a4139 100644 --- a/tests/message-queue/src/lib.rs +++ b/tests/message-queue/src/lib.rs @@ -4,8 +4,9 @@ use rand_core::OsRng; use ciphersuite::{ group::{ff::Field, GroupEncoding}, - Ciphersuite, Ristretto, + Ciphersuite, }; +use dalek_ff_group::Ristretto; use serai_primitives::{ExternalNetworkId, EXTERNAL_NETWORKS}; diff --git a/tests/processor/Cargo.toml b/tests/processor/Cargo.toml index 9c4bf986..16644f15 100644 --- a/tests/processor/Cargo.toml +++ b/tests/processor/Cargo.toml @@ -24,7 +24,9 @@ rand_core = { version = "0.6", default-features = false, features = ["getrandom" curve25519-dalek = "4" ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] } -dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] } +ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] } +dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] } +dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std"] } bitcoin-serai = { path = "../../networks/bitcoin" } diff --git a/tests/processor/src/lib.rs b/tests/processor/src/lib.rs index 66f2779d..aa8faaf8 100644 --- a/tests/processor/src/lib.rs +++ b/tests/processor/src/lib.rs @@ -6,9 +6,11 @@ use zeroize::Zeroizing; use ciphersuite::{ group::{ff::PrimeField, GroupEncoding}, - Ciphersuite, Secp256k1, Ed25519, Ristretto, + Ciphersuite, }; -use dkg::evrf::*; +use ciphersuite_kp256::Secp256k1; +use dalek_ff_group::{Ed25519, Ristretto}; +use dkg::*; use serai_client::primitives::{ExternalNetworkId, insecure_arbitrary_key_from_name}; use messages::{ProcessorMessage, CoordinatorMessage};