roast

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 9a2944b0a4aee8a8e2cba3beaf868ee4a9da7525
parent 317ca1c257763e1307b3cfaab47d07c96cd41ab3
Author: nickfarrow <nick@nickfarrow.com>
Date:   Wed, 28 Sep 2022 14:16:46 +1000

roast notes and use coordinator

Diffstat:
MCargo.lock | 711+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MCargo.toml | 6++++--
AREADME.md | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Droast.md | 39---------------------------------------
Msrc/main.rs | 333+++++++++++++++++++++++++++++++++++++++----------------------------------------
5 files changed, 938 insertions(+), 210 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -3,6 +3,77 @@ version = 3 [[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "async-stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atoi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c897df197d57c25b37df9d8fa2f93ddbfeee9ebd2264350ac79c8ec4b795885" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] name = "block-buffer" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -12,12 +83,51 @@ dependencies = [ ] [[package]] +name = "bumpalo" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" + +[[package]] +name = "bytes" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" + +[[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] +name = "chrono" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +dependencies = [ + "iana-time-zone", + "num-integer", + "num-traits", + "winapi", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] name = "clightningrpc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -29,6 +139,12 @@ dependencies = [ ] [[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] name = "cpufeatures" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -64,6 +180,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] +name = "futures-core" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" + +[[package]] name = "generic-array" version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -85,24 +207,241 @@ dependencies = [ ] [[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] name = "itoa" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] name = "libc" version = "0.2.133" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" [[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "mini-redis" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528890a6b63c88c9bda173867128abe62c0f5050dd959f067aeea09e90439f33" +dependencies = [ + "async-stream", + "atoi", + "bytes", + "structopt", + "tokio", + "tokio-stream", + "tracing", + "tracing-futures", + "tracing-subscriber", +] + +[[package]] +name = "mio" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] name = "ppv-lite86" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] name = "proc-macro2" version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -198,6 +537,39 @@ dependencies = [ ] [[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] name = "rng" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -211,11 +583,13 @@ name = "roast" version = "0.1.0" dependencies = [ "clightningrpc", + "mini-redis", "rand 0.8.5", "rng", "schnorr_fun", "secp256kfun", "sha2", + "tokio", ] [[package]] @@ -232,6 +606,12 @@ dependencies = [ ] [[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] name = "secp256kfun" version = "0.7.1" dependencies = [ @@ -284,6 +664,70 @@ dependencies = [ ] [[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "structopt" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" +dependencies = [ + "clap", + "lazy_static", + "structopt-derive", +] + +[[package]] +name = "structopt-derive" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "subtle-ng" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -301,6 +745,152 @@ dependencies = [ ] [[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tokio" +version = "1.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-stream" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] name = "typenum" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -313,6 +903,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" [[package]] +name = "unicode-segmentation" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -325,6 +939,60 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -345,3 +1013,46 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" diff --git a/Cargo.toml b/Cargo.toml @@ -11,4 +11,6 @@ secp256kfun = { path = "../secp256kfun/secp256kfun" } rand = "0.8.5" sha2 = "0.10" rng = "0.1.0" -clightningrpc = "0.2.0" -\ No newline at end of file +clightningrpc = "0.2.0" +tokio = { version = "1", features = ["full"] } +mini-redis = "0.4" +\ No newline at end of file diff --git a/README.md b/README.md @@ -0,0 +1,59 @@ +## ROAST Paper Notes +[paper](https://eprint.iacr.org/2022/550.pdf) + +Roast is a simple wrapper that turns a given threshold signature scheme into a scheme with a robust and asynchronous signing protocol, as long as the underlying signing protocol is semi-interactive (i.e. has one preprocessing round and one actual signing round), proviceds identifiable aborts, and is unforgable under concurrent signing sessions. + + +Robustness is the guarentee that t honest signers are able to obtain a valid signature even in the presence of other malicious signers who try to disrupt the protocol. + + +FROST provides identifiable aborts (IA): if signing session fails, then honest signers can identify at least one malicious signer responsible for the failure. + +We cant run every combination of signers n choose t, too computationally expensive -> ROAST tackles this problem. +>an algorithmic approach to choosing signer sets based on past behaviour? + + + + +### Security of Threshold Signatures + +Identifiable aborts: + - Ensures that ShareVal reliably identifies disruptive signers who send wrong shares. The IA-CMA (identifiable abort, chosen message attack) game: A controls all but one signer and can ask the remaining honest signer to take part in arbitrary number of concurrent sign sessions. Wins if the malicious signers all submit presignature or signature shares that somehow pass validation but lead to an output of an invalid signature (break of accountability). Or A wins if the honest signer outputs a presignatures and signature shares that will not pass validation. + + +Unforgability: a threshold signature scheme is existentially unforgable under CMA and concurrent sessions if no adversary A which controls t-1 signers during keygen and signing and can ask the remaining n-t+1 honest signers to take part in arbitrarily many concurrent signing sessions on messages of its choice, + +-> ie.e for every honest signer, A has oracles simulating PreRound(PK) and SignRound(sk_i, PK, State_i_sid) on an already preprocessed but unfinished session sid of its choice.can + +can produce a valid signature on a message that was never used in a signing session and A never asked in any query round. + +FROST3 -> PreAgg (nonce agg) -> Aggregate two presignature products D=prod(d_i), and E=prod(e_i) for i in T. Whereas FROST2 the aggregated presignature is not really aggregated, just the set {(D_i, E_i) for i in T}. The SignRound algorightm takes care of computing the products, as before. Other FROST versions include 2-BTZ and 2-CKM. + +### FROSTLAND +A majority of t of 15 council members is needed to sign a bill for it to pass. + +Each counci member has its own twatermark and a bill is only vaild if it carries the watermarks of all signers (and no others). + +Find a majority of council members, use thier watermarks to create the paper, then collect their signatures. However if one of them fail to sign at the final step, then the process talls. It is not possible to ask anyone else since the watermark on the page corresponds to the disruptive signer. So we must start the signing process from scratch. + +From time to time, members try to disrupt the signing process in an attempt to prevent other members from passing the bill and refuse to sign even though they indicated support. + +The solution process is the following procedure: +In the beginning, all the council members that signal support for the bill are asked to gather. The secretary maintains a slist of all these members and whenever there are at least 9 members on the list, they call a group of 9 members to their office and strikes out their names on the list. + +He then obtains paper with the watermarks of those 9 members, writes a copy of the bill and askes them each to sign. Whenever a council member has completed signing the copy they leave the office and the secretary adds their name back to the list. + +If at least 9 council members behave honestly then they will eventually sign their assigned copy and be readded to the list. WIll this procedure we know that these 9 members will be on the list at some point in the future and so the signing procedure will not get stuck. Since members are assigned a new copy each time, a member can at most hold up the singing of at most one copy at a time. The naximum n-t 1= 15-9 = 6 disruptive council members can hold up 6 copies at most. + +### Robust Asychronous Threshold Signatures + +The coordinators task is to maintain a set of responsive signers who have responded to all previous signing requests. As soon as R contains t, C initiates a new signing session. + +Along with each signature share, each signer is also required to provide a fresh presignature share (nonce) in preparation for a poosible next signing session. "A pipeline of signing sessions" + + +### Eliminating the Trusted Coordinator +A simple method to eliminate the need for semi-strusted coordinator is to let the signers run enough instances of the coordinator process: the n signers choose among themselves any set n-t+1 coordinators and start s-t+1 concurrent runs of roast. Note that one of these sessions will have t honest signers. + +The concurrent runs of ROAST do not need to be started simultaneously - e.g. honest signers can resend their reply in the run with coorinator_2 only after d seconds and only if they have not obtained a valid signature from any other run (is that a concern?) + diff --git a/roast.md b/roast.md @@ -1,38 +0,0 @@ -Roast is a simple wrapper that turns a given threshold signature scheme into a scheme with a robust and asynchronous signing protocol, as long as the underlying signing protocol is semi-interactive (i.e. has one preprocessing round and one actual signing round), proviceds identifiable aborts, and is unforgable under concurrent signing sessions. - - -Robustness is the guarentee that t honest signers are able to obtain a valid signature even in the presence of other malicious signers who try to disrupt the protocol. - - -FROST provides identifiable aborts (IA): if signing session fails, then honest signers can identify at least one malicious signer responsible for the failure. - -We cant run every combination of signers n choose t, too computationally expensive -> ROAST tackles this problem. ->an algorithmic approach to choosing signer sets based on past behaviour? - - - - -Security of Threshold Signatures - -Identifiable aborts: - - Ensures that ShareVal reliably identifies disruptive signers who send wrong shares. The IA-CMA (identifiable abort, chosen message attack) game: A controls all but one signer and can ask the remaining honest signer to take part in arbitrary number of concurrent sign sessions. Wins if the malicious signers all submit presignature or signature shares that somehow pass validation but lead to an output of an invalid signature (break of accountability). Or A wins if the honest signer outputs a presignatures and signature shares that will not pass validation. - - -Unforgability: a threshold signature scheme is existentially unforgable under CMA and concurrent sessions if no adversary A which controls t-1 signers during keygen and signing and can ask the remaining n-t+1 honest signers to take part in arbitrarily many concurrent signing sessions on messages of its choice, - --> ie.e for every honest signer, A has oracles simulating PreRound(PK) and SignRound(sk_i, PK, State_i_sid) on an already preprocessed but unfinished session sid of its choice.can - -can produce a valid signature on a message that was never used in a signing session and A never asked in any query round. - -FROST3 -> PreAgg (nonce agg) -> Aggregate two presignature products D=prod(d_i), and E=prod(e_i) for i in T. Whereas FROST2 the aggregated presignature is not really aggregated, just the set {(D_i, E_i) for i in T}. The SignRound algorightm takes care of computing the products, as before. Other FROST versions include 2-BTZ and 2-CKM. - -FROSTLAND -A majority of t of 15 council members is needed to sign a bill for it to pass. - -Each counci member has its own twatermark and a bill is only vaild if it carries the watermarks of all signers (and no others). - -Find a majority of council members, use thier watermarks to create the paper, then collect their signatures. However if one of them fail to sign at the final step, then the process talls. It is not possible to ask anyone else since the watermark on the page corresponds to the disruptive signer. So we must start the signing process from scratch. - - - -The signing process is -\ No newline at end of file diff --git a/src/main.rs b/src/main.rs @@ -62,7 +62,7 @@ impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG> Roast<'a, H, NG> { }; } - pub fn mark_malicious(&self, index: &usize) { + pub async fn mark_malicious(&self, index: &usize) { let mut roast_state = self.state.lock().expect("got lock"); roast_state.malicious_signers.insert(*index); if roast_state.malicious_signers.len() >= self.frost_key.threshold() { @@ -70,43 +70,49 @@ impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG> Roast<'a, H, NG> { } } - pub fn create_signature( - self, - secret_share: &Scalar, - secret_nonce: NonceKeyPair, - my_index: usize, - nonces: Vec<(usize, Nonce)>, - message: Message<'_>, - ) -> Scalar<Public, Zero> { - let session = self - .frost - .start_sign_session(&self.frost_key, nonces, message); - self.frost.sign( - &self.frost_key, - &session, - my_index, - secret_share, - secret_nonce, - ) - } - + /// Running roast as a signer + // pub fn create_signature( + // self, + // secret_share: &Scalar, + // secret_nonce: NonceKeyPair, + // my_index: usize, + // nonces: Vec<(usize, Nonce)>, + // message: Message<'_>, + // ) -> Scalar<Public, Zero> { + // let session = self + // .frost + // .start_sign_session(&self.frost_key, nonces, message); + // self.frost.sign( + // &self.frost_key, + // &session, + // my_index, + // secret_share, + // secret_nonce, + // ) + // } + + // Main body of the ROAST coordinator algorithm pub async fn recieve_signature( &self, index: usize, - signature_share: Scalar<Public, Zero>, + signature_share: Option<Scalar<Public, Zero>>, new_nonce: Nonce, - ) -> Option<Signature> { + ) -> (Option<Signature>, Option<Vec<(usize, Nonce)>>) { let mut roast_state = self.state.lock().expect("got lock"); - // if index is malicious then return if roast_state.malicious_signers.contains(&index) { - return None; + println!("Malicious signer tried to send signature! {}", index); + return (None, None); } - // if this was an unsolicited reply mark malicious + dbg!(roast_state.responsive_signers.clone()); if roast_state.responsive_signers.contains(&index) { - self.mark_malicious(&index); - return None; + println!( + "Unsolicited reply from signer {}, marking malicious.", + index + ); + self.mark_malicious(&index).await; + return (None, None); } // If this is not the inital message from S_i @@ -124,26 +130,33 @@ impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG> Roast<'a, H, NG> { roast_state.message, ); - if !self - .frost - .verify_signature_share(&self.frost_key, &session, index, signature_share) - { - self.mark_malicious(&index); - return None; + if !self.frost.verify_signature_share( + &self.frost_key, + &session, + index, + signature_share.expect("party provided None signature share"), + ) { + println!("Invalid signature, marking {} malicious.", index); + self.mark_malicious(&index).await; + return (None, None); } // Store valid signature - roast_session.sig_shares.push(signature_share); + roast_session + .sig_shares + .push(signature_share.expect("party provided None signature share")); + println!("New signature from party {}", index); // if we have t-of-n, combine! if roast_session.sig_shares.len() >= self.frost_key.threshold() { + println!("We have the threshold number of signatures, combining!"); let combined_sig = self.frost.combine_signature_shares( &self.frost_key, &session, roast_session.sig_shares.clone(), ); // return combined signature - return Some(combined_sig); + return (Some(combined_sig), None); } } @@ -155,6 +168,7 @@ impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG> Roast<'a, H, NG> { // if we now have t responsive signers: if roast_state.responsive_signers.len() >= self.frost_key.threshold() { + println!("We now have threshold number of responsive signers!"); roast_state.session_counter += 1; // build the presignature (aggregate the nonces). let r_signers = roast_state.responsive_signers.clone(); @@ -184,22 +198,33 @@ impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG> Roast<'a, H, NG> { sig_shares: vec![], })), ); - // SEND NONCES AND R - // (if we are running ourselves then we sign too after communicating!) + let nonces = roast_state + .latest_nonces + .iter() + .map(|(i, nonce)| (*i, *nonce)) + .collect(); + println!("Responding with nonces:"); + // DO THIS FOR EVERY S_i...>!>!> need async + + // OPEN MANY THREADS AND THEN AWAIT COLLECTION + return (None, Some(nonces)); } } // Return None if we get to here? // Better API would be return the number of remaining signatures or th remaining signature if complete. // Non complex RecieveSigResponse Result - None + (None, None) } } -fn main() { +// use mini_redis::{client, Result}; + +#[tokio::main] +async fn main() { // Do frost keygen for 9-of-15 - let threshold: usize = 9; - let n_parties: usize = 15; + let threshold: usize = 2; + let n_parties: usize = 3; let frost = Frost::new(Schnorr::<Sha256, Deterministic<Sha256>>::new( Deterministic::<Sha256>::default(), @@ -267,148 +292,118 @@ fn main() { .unzip(); println!("Finished keygen!"); - // Now time for ROAST - let message = Message::plain("test", b"test"); - let roast1 = Roast::new(frost.clone(), frost_keys[0].clone(), message); - let roast2 = Roast::new(frost.clone(), frost_keys[1].clone(), message); + // use a boolean mask for which t participants are signers + let mut signer_mask = vec![true; threshold]; + signer_mask.append(&mut vec![false; n_parties - threshold]); + // shuffle the mask for random signers + + let signer_indexes: Vec<_> = signer_mask + .iter() + .enumerate() + .filter(|(_, is_signer)| **is_signer) + .map(|(i, _)| i) + .collect(); + + println!("Preparing for signing session..."); - let verification_shares_bytes: Vec<_> = frost_keys[0] + let verification_shares_bytes: Vec<_> = frost_keys[signer_indexes[0]] .verification_shares() .map(|share| share.to_bytes()) .collect(); let sid = [ - frost_keys[0].public_key().to_xonly_bytes().as_slice(), + frost_keys[signer_indexes[0]] + .public_key() + .to_xonly_bytes() + .as_slice(), verification_shares_bytes.concat().as_slice(), b"frost-prop-test".as_slice(), ] .concat(); - let nonces: Vec<NonceKeyPair> = (0..n_parties) + let mut nonces: Vec<NonceKeyPair> = signer_indexes + .iter() .map(|i| { - let nonce = frost.gen_nonce( - &secret_shares[i], - &sid, - Some(frost_keys[i].public_key().normalize()), + frost.gen_nonce( + &secret_shares[*i], + &[sid.as_slice(), [*i as u8].as_slice()].concat(), + Some(frost_keys[signer_indexes[0]].public_key().normalize()), None, - ); - - nonce + ) }) .collect(); - let pub_nonces: Vec<_> = nonces - .iter() - .enumerate() - .map(|(i, nonce)| (i, nonce.public())) - .collect(); + let mut recieved_nonces: Vec<_> = vec![]; + for (i, nonce) in signer_indexes.iter().zip(nonces.clone()) { + recieved_nonces.push((*i, nonce.public())); + } + println!("Recieved nonces.."); + + // Now time for ROAST - let sig1 = roast1.create_signature( - &secret_shares[0], - nonces[0].clone(), - 0, - pub_nonces.clone(), - message, - ); - - let next_nonce = frost.gen_nonce( - &secret_shares[0], - &sid, - Some(frost_keys[0].public_key().normalize()), - None, - ); - roast1.recieve_signature(0, sig1, next_nonce).await; - // let sig2 = - // roast2.create_signature(&secret_shares[1], nonces[1].clone(), 1, pub_nonces, message); + // Test roast being run by 1 external party -> frost_key contains public data + let message = Message::plain("test", b"test"); + let roast = Roast::new(frost.clone(), frost_keys[0].clone(), message); + + let mut counter = 0; + loop { + for i in 0..signer_indexes.len() { + let current_nonce = nonces[i].clone(); + let next_nonce = frost.gen_nonce( + &secret_shares[i], + &[sid.clone(), [counter].to_vec()].concat(), + Some(frost_keys[i].public_key().normalize()), + None, + ); + nonces[i] = next_nonce.clone(); + + let (sig, new_nonces) = if counter == 0 { + // Initial sending empty sig with nonces + roast.recieve_signature(i, None, next_nonce.public()).await + } else { + println!("Signing for participant {}", signer_indexes[i]); + let signer_index = signer_indexes[i]; + let session = frost.start_sign_session( + &frost_keys[signer_index], + recieved_nonces.clone(), + Message::plain("test", b"test"), + ); + let sig = frost.sign( + &frost_keys[signer_index], + &session, + signer_index, + &secret_shares[signer_index], + current_nonce.clone(), + ); + roast + .recieve_signature(i, Some(sig), next_nonce.public()) + .await + }; + + // Hangs if you always send same index + match sig { + Some(combined_sig) => { + assert!(frost.schnorr.verify( + &frost_keys[signer_indexes[i]].public_key(), + Message::<Public>::plain("test", b"test"), + &combined_sig + )); + println!("Signed via roast!"); + break; + } + None => { + println!("Sent partial signature {} to roast..", i) + } + }; + match new_nonces { + Some(nonces) => { + recieved_nonces = nonces.clone(); + println!("Got new nonces {:?}", nonces); + } + None => println!("No new nonces!?"), + } + println!("Current nonces {:?}", recieved_nonces.clone()); + } + counter += 1; + } } -// println!("selecting signers..."); - -// // use a boolean mask for which t participants are signers -// let mut signer_mask = vec![true; threshold]; -// signer_mask.append(&mut vec![false; n_parties - threshold]); -// // shuffle the mask for random signers - -// let signer_indexes: Vec<_> = signer_mask -// .iter() -// .enumerate() -// .filter(|(_, is_signer)| **is_signer) -// .map(|(i, _)| i) -// .collect(); - -// println!("Preparing for signing session..."); - -// let verification_shares_bytes: Vec<_> = frost_keys[signer_indexes[0]] -// .verification_shares() -// .map(|share| share.to_bytes()) -// .collect(); - -// let sid = [ -// frost_keys[signer_indexes[0]] -// .public_key() -// .to_xonly_bytes() -// .as_slice(), -// verification_shares_bytes.concat().as_slice(), -// b"frost-prop-test".as_slice(), -// ] -// .concat(); -// let nonces: Vec<NonceKeyPair> = signer_indexes -// .iter() -// .map(|i| { -// frost.gen_nonce( -// &secret_shares[*i], -// &[sid.as_slice(), [*i as u8].as_slice()].concat(), -// Some(frost_keys[signer_indexes[0]].public_key().normalize()), -// None, -// ) -// }) -// .collect(); - -// let mut recieved_nonces: Vec<_> = vec![]; -// for (i, nonce) in signer_indexes.iter().zip(nonces.clone()) { -// recieved_nonces.push((*i, nonce.public())); -// } -// println!("Recieved nonces.."); - -// // Create Frost signing session -// let signing_session = frost.start_sign_session( -// &frost_keys[signer_indexes[0]], -// recieved_nonces.clone(), -// Message::plain("test", b"test"), -// ); - -// let mut signatures = vec![]; -// for i in 0..signer_indexes.len() { -// println!("Signing for participant {}", signer_indexes[i]); -// let signer_index = signer_indexes[i]; -// let session = frost.start_sign_session( -// &frost_keys[signer_index], -// recieved_nonces.clone(), -// Message::plain("test", b"test"), -// ); -// let sig = frost.sign( -// &frost_keys[signer_index], -// &session, -// signer_index, -// &secret_shares[signer_index], -// nonces[i].clone(), -// ); -// assert!(frost.verify_signature_share( -// &frost_keys[signer_index], -// &session, -// signer_index, -// sig -// )); -// signatures.push(sig); -// } -// let combined_sig = frost.combine_signature_shares( -// &frost_keys[signer_indexes[0]], -// &signing_session, -// signatures, -// ); - -// assert!(frost.schnorr.verify( -// &frost_keys[signer_indexes[0]].public_key(), -// Message::<Public>::plain("test", b"test"), -// &combined_sig -// )); -// }