diff --git a/.gitignore b/.gitignore index 088ba6b..f2e972d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,5 @@ # will have compiled files and executables /target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - # These are backup files generated by rustfmt **/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..9fe57e4 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3883 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "abnf" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47feb9fbcef700639ef28e04ca2a87eab8161a01a075ee227b15c90143805462" +dependencies = [ + "nom 5.1.2", +] + +[[package]] +name = "abnf_to_pest" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "372baaa5d3a422d8816b513bcdb2c120078c8614f7ecbcc3baf34a1634bbbe2e" +dependencies = [ + "abnf", + "indexmap", + "itertools 0.9.0", + "pretty 0.5.2", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "annotate-snippets" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c96c3d1062ea7101741480185a6a1275eab01cbe8b20e378d1311bc056d2e08" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "anyhow" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" + +[[package]] +name = "arbitrary" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db55d72333851e17d572bec876e390cd3b11eb1ef53ae821dd9f3b653d2b4569" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "ascii-canvas" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff8eb72df928aafb99fe5d37b383f2fe25bd2a765e3e5f7c365916b6f2463a29" +dependencies = [ + "term", +] + +[[package]] +name = "async-trait" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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 = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "base32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "beef" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6736e2428df2ca2848d846c43e88745121a6654696e349ce0054a420815a7409" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bitvec" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2b_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "bstr" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byte-unit" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415301c9de11005d4b92193c0eb7ac7adc37e5a49e0ac9bed0a42343512744b8" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "candid" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65f05b872d010281c905c4e6ff2079c1341d1e527e05f3bfab88d49ea3269def" +dependencies = [ + "arbitrary", + "byteorder", + "candid_derive", + "codespan-reporting", + "fake", + "hex", + "ic-types 0.1.3", + "lalrpop", + "lalrpop-util", + "leb128", + "logos", + "num-bigint 0.3.2", + "num-traits", + "num_enum", + "paste", + "pretty 0.10.0", + "rand 0.8.3", + "serde", + "serde_bytes", + "serde_dhall", + "thiserror", +] + +[[package]] +name = "candid_derive" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d7232a5dd836d83ae9ffd79061b42d729afab6f11bfaba7dc2a82575b686ae2" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cc" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + +[[package]] +name = "clap" +version = "3.0.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142" +dependencies = [ + "atty", + "bitflags", + "clap_derive", + "indexmap", + "lazy_static", + "os_str_bytes", + "strsim", + "termcolor", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "clap_derive" +version = "3.0.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "codespan-reporting" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0762455306b1ed42bc651ef6a2197aabda5e1d4a43c34d5eab5c1a3634e81d" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "core-foundation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" + +[[package]] +name = "cpufeatures" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-mac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +dependencies = [ + "generic-array 0.12.4", + "subtle 1.0.0", +] + +[[package]] +name = "csv" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +dependencies = [ + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +dependencies = [ + "memchr", +] + +[[package]] +name = "curve25519-dalek" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "639891fde0dbea823fc3d798a0fdf9d2f9440a42d64a78ab3488b0ca025117b3" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle 2.4.0", + "zeroize", +] + +[[package]] +name = "cvt" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ac344c7efccb80cd25bc61b2170aec26f2f693fd40e765a539a1243db48c71" +dependencies = [ + "cfg-if 0.1.10", +] + +[[package]] +name = "darling" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "data-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" + +[[package]] +name = "der-oid-macro" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4cccf60bb98c0fca115a581f894aed0e43fa55bf289fdac5599bec440bb4fd6" +dependencies = [ + "nom 6.1.2", + "num-bigint 0.4.0", + "num-traits", + "syn", +] + +[[package]] +name = "der-parser" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120842c2385dea19347e2f6e31caa5dced5ba8afdfacaac16c59465fdd1168f2" +dependencies = [ + "der-oid-macro", + "nom 6.1.2", + "num-bigint 0.4.0", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_more" +version = "0.99.8-alpha.0" +source = "git+https://github.com/dfinity-lab/derive_more?branch=master#9f1b894e6fde640da4e9ea71a8fc0e4dd98d01da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dfn_candid" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "dfn_core", + "ic-base-types", + "on_wire", + "serde", +] + +[[package]] +name = "dfn_core" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "byteorder", + "cfg-if 0.1.10", + "futures", + "hex", + "ic-base-types", + "on_wire", + "rustversion", +] + +[[package]] +name = "dfn_http" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "dfn_candid", + "dfn_core", + "serde", + "serde_bytes", +] + +[[package]] +name = "dfn_protobuf" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "dfn_core", + "ic-base-types", + "on_wire", + "prost", + "prost-types", +] + +[[package]] +name = "dhall" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7d7b648a24d2edd4ba9f31fe42c831080522d1cf35bca3522887ba0d802745" +dependencies = [ + "abnf_to_pest", + "annotate-snippets", + "elsa", + "hex", + "itertools 0.9.0", + "lazy_static", + "once_cell 1.7.2", + "percent-encoding", + "pest", + "pest_consume", + "pest_generator", + "quote", + "reqwest", + "serde", + "serde_cbor", + "sha2 0.9.5", + "url", +] + +[[package]] +name = "dhall_proc_macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64ba6f41d9b223e2e1d7c97a1145a1aa03e57d65e1c9c2baa29f194caf322c9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diff" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "dirs" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "ed25519" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d0860415b12243916284c67a9be413e044ee6668247b99ba26d94b2bc06c8f6" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand 0.7.3", + "serde", + "sha2 0.9.5", + "zeroize", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "elsa" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "848344296205756adc00ab3bec02658da0f72eaa1461474aa2d51d64311876a5" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "ena" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" +dependencies = [ + "log", +] + +[[package]] +name = "encoding_rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "erased-serde" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b36e6f2295f393f44894c6031f67df4d185b984cd54d08f768ce678007efcd" +dependencies = [ + "serde", +] + +[[package]] +name = "fake" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704749d52f737f28d7a632d4608db4005822efbb5a1c673c159f1193c9e63832" +dependencies = [ + "rand 0.8.3", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "features" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83072b3c84e55f9d0c0ff36a4575d0fd2e543ae4a56e04e7f5a9222188d574e3" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ff" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4530da57967e140ee0b44e0143aa66b5cb42bd9c503dbe316a15d5b0be65713e" +dependencies = [ + "byteorder", + "ff_derive", + "rand_core 0.5.1", +] + +[[package]] +name = "ff_derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5796e7d62ca01a00ed3a649b0da1ffa1ac8f06bcad40339df09dbdd69a05ba9" +dependencies = [ + "num-bigint 0.2.6", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "fixedbitset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + +[[package]] +name = "futures" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" + +[[package]] +name = "futures-executor" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" + +[[package]] +name = "futures-macro" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +dependencies = [ + "autocfg 1.0.1", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" + +[[package]] +name = "futures-task" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" + +[[package]] +name = "futures-util" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +dependencies = [ + "autocfg 1.0.1", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "garcon" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83fb8961dcd3c26123863998521ae4d07e5e5aa8fb50b503380448f2e0ea069" +dependencies = [ + "futures-util", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", +] + +[[package]] +name = "group" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cbdfc48f95bef47e3daf3b9d552a1dde6311e3a5fefa43e16c59f651d56fe5b" +dependencies = [ + "ff", + "rand 0.7.3", + "rand_xorshift 0.2.0", +] + +[[package]] +name = "h2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" + +[[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.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hmac" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +dependencies = [ + "crypto-mac", + "digest 0.8.1", +] + +[[package]] +name = "hmac-drbg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" +dependencies = [ + "digest 0.8.1", + "generic-array 0.12.4", + "hmac", +] + +[[package]] +name = "http" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" + +[[package]] +name = "httpdate" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" + +[[package]] +name = "humanize-rs" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016b02deb8b0c415d8d56a6f0ab265e50c22df61194e37f9be75ed3a722de8a6" + +[[package]] +name = "hyper" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3f71a7eea53a3f8257a7b4795373ff886397178cd634430ea94e12d7fe4fe34" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +dependencies = [ + "futures-util", + "hyper", + "log", + "rustls", + "tokio", + "tokio-rustls", + "webpki", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "ic-agent" +version = "0.5.0" +source = "git+https://github.com/dfinity/agent-rs.git?branch=pshahi/lookup_read_state_response#54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" +dependencies = [ + "async-trait", + "base32", + "base64 0.12.3", + "byteorder", + "garcon", + "hex", + "http", + "ic-types 0.1.3", + "leb128", + "mime", + "openssl", + "pem", + "rand 0.7.3", + "reqwest", + "ring", + "rustls", + "serde", + "serde_bytes", + "serde_cbor", + "simple_asn1 0.5.3", + "thiserror", + "url", + "webpki-roots 0.20.0", +] + +[[package]] +name = "ic-base-types" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "base32", + "byte-unit", + "bytes", + "candid", + "crc32fast", + "ic-crypto-sha256", + "ic-protobuf", + "phantom_newtype", + "prost", + "prost-build", + "serde", + "strum 0.18.0", + "strum_macros 0.18.0", +] + +[[package]] +name = "ic-crypto-internal-basic-sig-der-utils" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "hex", + "simple_asn1 0.4.1", +] + +[[package]] +name = "ic-crypto-internal-basic-sig-ed25519" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "base64 0.11.0", + "curve25519-dalek", + "ed25519-dalek", + "hex", + "ic-crypto-internal-basic-sig-der-utils", + "ic-crypto-internal-types", + "ic-protobuf", + "ic-types 0.8.0", + "rand 0.7.3", + "rand_chacha 0.2.2", + "serde", + "simple_asn1 0.4.1", + "zeroize", +] + +[[package]] +name = "ic-crypto-internal-bls12381-common" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "ff", + "group", + "hex", + "ic-crypto-internal-types", + "ic-crypto-sha256", + "miracl_core_bls12381", + "pairing", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rand_core 0.5.1", +] + +[[package]] +name = "ic-crypto-internal-bls12381-serde-miracl" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "ic-crypto-internal-types", + "miracl_core_bls12381", +] + +[[package]] +name = "ic-crypto-internal-fs-ni-dkg" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "hex", + "ic-crypto-internal-bls12381-common", + "ic-crypto-internal-bls12381-serde-miracl", + "ic-crypto-internal-types", + "ic-crypto-sha256", + "miracl_core_bls12381", + "rand_chacha 0.2.2", + "zeroize", +] + +[[package]] +name = "ic-crypto-internal-multi-sig-bls12381" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "base64 0.11.0", + "ff", + "group", + "hex", + "ic-crypto-internal-bls12381-common", + "ic-crypto-internal-types", + "ic-protobuf", + "ic-types 0.8.0", + "pairing", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "serde", + "zeroize", +] + +[[package]] +name = "ic-crypto-internal-threshold-sig-bls12381" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "arrayvec", + "base64 0.11.0", + "ff", + "group", + "ic-crypto-internal-bls12381-common", + "ic-crypto-internal-bls12381-serde-miracl", + "ic-crypto-internal-fs-ni-dkg", + "ic-crypto-internal-types", + "ic-crypto-sha256", + "ic-types 0.8.0", + "lazy_static", + "libsecp256k1", + "miracl_core_bls12381", + "pairing", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "serde", + "serde_bytes", + "serde_cbor", + "serde_json", + "simple_asn1 0.4.1", + "strum_macros 0.18.0", + "zeroize", +] + +[[package]] +name = "ic-crypto-internal-types" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "arrayvec", + "base64 0.11.0", + "hex", + "ic-protobuf", + "phantom_newtype", + "serde", + "serde_cbor", + "strum 0.18.0", + "strum_macros 0.18.0", + "thiserror", + "zeroize", +] + +[[package]] +name = "ic-crypto-key-validation" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "chrono", + "dfn_core", + "hex", + "ic-base-types", + "ic-crypto-internal-basic-sig-ed25519", + "ic-crypto-internal-fs-ni-dkg", + "ic-crypto-internal-multi-sig-bls12381", + "ic-crypto-internal-threshold-sig-bls12381", + "ic-crypto-internal-types", + "ic-protobuf", + "ic-types 0.8.0", + "x509-parser", +] + +[[package]] +name = "ic-crypto-sha256" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "openssl", + "sha2 0.9.5", +] + +[[package]] +name = "ic-crypto-tree-hash" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "ic-crypto-internal-types", + "ic-crypto-sha256", + "ic-protobuf", + "serde", + "serde_bytes", +] + +[[package]] +name = "ic-error-types" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "ic-protobuf", + "serde", + "strum 0.20.0", + "strum_macros 0.20.1", +] + +[[package]] +name = "ic-ic00-types" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "ic-base-types", + "ic-error-types", + "ic-protobuf", + "num-traits", + "serde", + "serde_bytes", + "serde_cbor", + "strum 0.18.0", + "strum_macros 0.18.0", +] + +[[package]] +name = "ic-identity-hsm" +version = "0.3.1" +source = "git+https://github.com/dfinity/agent-rs.git?branch=pshahi/lookup_read_state_response#54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" +dependencies = [ + "hex", + "ic-agent", + "ic-types 0.1.3", + "num-bigint 0.3.2", + "openssl", + "pkcs11", + "simple_asn1 0.5.3", + "thiserror", +] + +[[package]] +name = "ic-nns-common" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "dfn_core", + "ic-base-types", + "ic-crypto-sha256", + "ic-nns-constants", + "ic-protobuf", + "ic-registry-keys", + "ic-registry-transport", + "ic-types 0.8.0", + "lazy_static", + "on_wire", + "prost", + "prost-build", + "prost-types", + "serde", + "sha2 0.9.5", +] + +[[package]] +name = "ic-nns-constants" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "ed25519-dalek", + "ic-base-types", + "ic-types 0.8.0", + "lazy_static", + "rand_chacha 0.2.2", + "rand_core 0.5.1", +] + +[[package]] +name = "ic-nns-governance" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "async-trait", + "bytes", + "candid", + "clap", + "csv", + "dfn_candid", + "dfn_core", + "dfn_protobuf", + "futures", + "ic-base-types", + "ic-crypto-sha256", + "ic-nns-common", + "ic-nns-constants", + "itertools 0.10.0", + "ledger-canister", + "on_wire", + "prost", + "prost-build", + "rand 0.7.3", + "rand_core 0.5.1", + "registry-canister", + "serde", +] + +[[package]] +name = "ic-protobuf" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "bincode", + "erased-serde", + "prost", + "prost-build", + "serde", + "serde_json", + "slog", +] + +[[package]] +name = "ic-registry-keys" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "ic-base-types", + "ic-types 0.8.0", +] + +[[package]] +name = "ic-registry-routing-table" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "ic-base-types", + "ic-ic00-types", + "ic-protobuf", + "serde", +] + +[[package]] +name = "ic-registry-subnet-type" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "ic-protobuf", + "serde", + "strum 0.18.0", + "strum_macros 0.18.0", +] + +[[package]] +name = "ic-registry-transport" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "bytes", + "candid", + "ic-protobuf", + "prost", + "prost-build", + "prost-types", + "serde", +] + +[[package]] +name = "ic-types" +version = "0.1.3" +source = "git+https://github.com/dfinity/agent-rs.git?branch=pshahi/lookup_read_state_response#54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" +dependencies = [ + "base32", + "crc32fast", + "hex", + "serde", + "serde_bytes", + "sha2 0.9.5", + "thiserror", +] + +[[package]] +name = "ic-types" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "base32", + "base64 0.11.0", + "bincode", + "byte-unit", + "candid", + "chrono", + "derive_more", + "hex", + "ic-base-types", + "ic-crypto-internal-types", + "ic-crypto-sha256", + "ic-crypto-tree-hash", + "ic-error-types", + "ic-ic00-types", + "ic-protobuf", + "ic-registry-transport", + "ic-utils 0.8.0", + "maplit", + "num-traits", + "once_cell 1.4.0-alpha.0", + "phantom_newtype", + "prost", + "serde", + "serde_bytes", + "serde_cbor", + "serde_json", + "serde_with", + "strum 0.18.0", + "strum_macros 0.18.0", + "thiserror", + "url", +] + +[[package]] +name = "ic-utils" +version = "0.3.1" +source = "git+https://github.com/dfinity/agent-rs.git?branch=pshahi/lookup_read_state_response#54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" +dependencies = [ + "async-trait", + "candid", + "garcon", + "ic-agent", + "ic-types 0.1.3", + "serde", + "serde_bytes", + "strum 0.20.0", + "strum_macros 0.20.1", + "thiserror", +] + +[[package]] +name = "ic-utils" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "bitflags", + "cvt", + "features", + "hex", + "libc", + "rand 0.8.3", +] + +[[package]] +name = "icx-nns" +version = "0.1.0" +dependencies = [ + "anyhow", + "candid", + "chrono", + "clap", + "garcon", + "hex", + "humanize-rs", + "ic-agent", + "ic-base-types", + "ic-identity-hsm", + "ic-nns-common", + "ic-nns-constants", + "ic-nns-governance", + "ic-types 0.1.3", + "ic-utils 0.3.1", + "ledger-canister", + "num-derive", + "num-traits", + "openssl", + "ring", + "rust_decimal", + "serde", + "serde_cbor", + "serde_json", + "strum 0.20.0", + "strum_macros 0.20.1", + "thiserror", + "tokio", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +dependencies = [ + "autocfg 1.0.1", + "hashbrown", +] + +[[package]] +name = "intmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e50930385956f6c4a0b99f3dd654adcc40788456c36e17c5b20e1d1ceb523ec6" + +[[package]] +name = "ipnet" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" + +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "js-sys" +version = "0.3.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lalrpop" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46962a8c71b91c3524b117dfdd70844d4265a173c4c9109f98171aebdcf1195f" +dependencies = [ + "ascii-canvas", + "atty", + "bit-set", + "diff", + "ena", + "itertools 0.10.0", + "lalrpop-util", + "petgraph", + "pico-args", + "regex", + "regex-syntax", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a708007b751af124d09e9c5d97515257902bc6b486a56b40bcafd939e8ff467" +dependencies = [ + "regex", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "leb128" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" + +[[package]] +name = "ledger-canister" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "byteorder", + "candid", + "crc32fast", + "dfn_candid", + "dfn_core", + "dfn_http", + "dfn_protobuf", + "digest 0.9.0", + "hex", + "ic-base-types", + "ic-crypto-sha256", + "ic-nns-constants", + "ic-types 0.8.0", + "intmap", + "lazy_static", + "on_wire", + "phantom_newtype", + "prost", + "prost-build", + "prost-derive", + "serde", + "serde_bytes", + "serde_cbor", + "yansi", +] + +[[package]] +name = "lexical-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +dependencies = [ + "arrayvec", + "bitflags", + "cfg-if 1.0.0", + "ryu", + "static_assertions", +] + +[[package]] +name = "libc" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36" + +[[package]] +name = "libloading" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +dependencies = [ + "cc", + "winapi", +] + +[[package]] +name = "libsecp256k1" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" +dependencies = [ + "arrayref", + "crunchy", + "digest 0.8.1", + "hmac-drbg", + "rand 0.7.3", + "sha2 0.8.2", + "subtle 2.4.0", + "typenum", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "logos" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427e2abca5be13136da9afdbf874e6b34ad9001dd70f2b103b083a85daa7b345" +dependencies = [ + "logos-derive", +] + +[[package]] +name = "logos-derive" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56a7d287fd2ac3f75b11f19a1c8a874a7d55744bd91f7a1b3e7cf87d4343c36d" +dependencies = [ + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax", + "syn", + "utf8-ranges", +] + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mio" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "miracl_core_bls12381" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f7f7889f1a842b4c79a1a0bcca95c795f13b275ffbb1e48ff2af87b0d5f115" + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "native-tls" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nom" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +dependencies = [ + "lexical-core", + "memchr", + "version_check", +] + +[[package]] +name = "nom" +version = "6.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +dependencies = [ + "bitvec", + "funty", + "lexical-core", + "memchr", + "version_check", +] + +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg 1.0.1", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d0a3d5e207573f948a9e5376662aa743a2ea13f7c50a554d7af443a73fbfeba" +dependencies = [ + "autocfg 1.0.1", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d047c1062aa51e256408c560894e5251f08925980e53cf1aa5bd00eec6512" +dependencies = [ + "autocfg 1.0.1", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg 1.0.1", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg 1.0.1", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "oid-registry" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b26c042283b4ecc71edde70de2d6d0ab7e8743b8e7a7cb8467e4d153dfc7ad43" +dependencies = [ + "der-parser", +] + +[[package]] +name = "on_wire" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" + +[[package]] +name = "once_cell" +version = "1.4.0-alpha.0" +source = "git+https://github.com/dfinity-lab/once_cell?branch=master#854095347d356e006ea29b7750637a14a20a6dae" + +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl" +version = "0.10.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell 1.7.2", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" + +[[package]] +name = "openssl-sys" +version = "0.9.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98" +dependencies = [ + "autocfg 1.0.1", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_str_bytes" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" + +[[package]] +name = "pairing" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c40534479a28199cd5109da27fe2fc4a4728e4fc701d9e9c1bded78f3271e4" +dependencies = [ + "byteorder", + "ff", + "group", + "rand_core 0.5.1", +] + +[[package]] +name = "paste" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" + +[[package]] +name = "pem" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" +dependencies = [ + "base64 0.13.0", + "once_cell 1.7.2", + "regex", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pest_consume" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f06d200abe3be440ee3be3dcd2a65518250c0181364a332fa334b35152cb82e" +dependencies = [ + "pest", + "pest_consume_macros", + "pest_derive", + "proc-macro-hack", +] + +[[package]] +name = "pest_consume_macros" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "466dea9184791ec0b5304cc103dcbd3f267b0157aa60b2efc74ea1b1c886ea51" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1", +] + +[[package]] +name = "petgraph" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "phantom_newtype" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "proptest", + "serde", + "slog", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pico-args" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" + +[[package]] +name = "pin-project" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs11" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3aca6d67e4c8613bfe455599d0233d00735f85df2001f6bfd9bb7ac0496b10af" +dependencies = [ + "libloading", + "num-bigint 0.2.6", +] + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "pretty" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60c0d9f6fc88ecdd245d90c1920ff76a430ab34303fc778d33b1d0a4c3bf6d3" +dependencies = [ + "typed-arena 1.7.0", +] + +[[package]] +name = "pretty" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad9940b913ee56ddd94aec2d3cd179dd47068236f42a1a6415ccf9d880ce2a61" +dependencies = [ + "arrayvec", + "typed-arena 2.0.1", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[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-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "proptest" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c477819b845fe023d33583ebf10c9f62518c8d79a0960ba5c36d6ac8a55a5b" +dependencies = [ + "bit-set", + "bitflags", + "byteorder", + "lazy_static", + "num-traits", + "quick-error", + "rand 0.6.5", + "rand_chacha 0.1.1", + "rand_xorshift 0.1.1", + "regex-syntax", + "rusty-fork", + "tempfile", +] + +[[package]] +name = "prost" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" +dependencies = [ + "bytes", + "heck", + "itertools 0.9.0", + "log", + "multimap", + "petgraph", + "prost", + "prost-types", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +dependencies = [ + "anyhow", + "itertools 0.9.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +dependencies = [ + "bytes", + "prost", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" + +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +dependencies = [ + "autocfg 0.1.7", + "libc", + "rand_chacha 0.1.1", + "rand_core 0.4.2", + "rand_hc 0.1.0", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift 0.1.1", + "winapi", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", + "rand_hc 0.3.0", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.7", + "rand_core 0.3.1", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.2", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom 0.2.3", +] + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.2", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc", + "rand_core 0.4.2", + "winapi", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand", + "winapi", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.7", + "rand_core 0.4.2", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_xorshift" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_syscall" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +dependencies = [ + "getrandom 0.1.16", + "redox_syscall 0.1.57", + "rust-argon2", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "registry-canister" +version = "0.8.0" +source = "git+https://github.com/dfinity/ic?rev=779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f#779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" +dependencies = [ + "candid", + "dfn_candid", + "dfn_core", + "ic-base-types", + "ic-crypto-key-validation", + "ic-crypto-tree-hash", + "ic-nns-common", + "ic-nns-constants", + "ic-protobuf", + "ic-registry-keys", + "ic-registry-routing-table", + "ic-registry-subnet-type", + "ic-registry-transport", + "ic-types 0.8.0", + "leb128", + "on_wire", + "prost", + "prost-build", + "serde", + "serde_cbor", + "url", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124" +dependencies = [ + "base64 0.13.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "hyper-rustls", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "rustls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.21.1", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell 1.7.2", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rust-argon2" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" +dependencies = [ + "base64 0.13.0", + "blake2b_simd", + "constant_time_eq", + "crossbeam-utils", +] + +[[package]] +name = "rust_decimal" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52f6513cf330c84095570b1f3ac073d718a50541c8392a98eaac9c6333324bf" +dependencies = [ + "arrayvec", + "num-traits", + "serde", +] + +[[package]] +name = "rusticata-macros" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7390af60e66c44130b4c5ea85f2555b7ace835d73b4b889c704dc3cb4c0468c8" +dependencies = [ + "nom 6.1.2", +] + +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.0", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustversion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" + +[[package]] +name = "rusty-fork" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dd93264e10c577503e926bd1430193eeb5d21b059148910082245309b424fae" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi", +] + +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b239a3d5db51252f6f48f42172c65317f37202f4a21021bf5f9d40a408f4592c" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_cbor" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +dependencies = [ + "half", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_dhall" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1393976875f3080d8cd1ff54083129e2e6a30d7a62582b67c3eb5924789e8e75" +dependencies = [ + "dhall", + "dhall_proc_macros", + "doc-comment", + "serde", + "url", +] + +[[package]] +name = "serde_json" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edeeaecd5445109b937a3a335dc52780ca7779c4b4b7374cc6340dedfe44cfca" +dependencies = [ + "rustversion", + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48b35457e9d855d3dc05ef32a73e0df1e2c0fd72c38796a4ee909160c8eeec2" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "signature" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" + +[[package]] +name = "simple_asn1" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b" +dependencies = [ + "chrono", + "num-bigint 0.2.6", + "num-traits", +] + +[[package]] +name = "simple_asn1" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc31e6cf34ad4321d3a2b8f934949b429e314519f753a77962f16c664dca8e13" +dependencies = [ + "chrono", + "num-bigint 0.4.0", + "num-traits", + "thiserror", +] + +[[package]] +name = "siphasher" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27" + +[[package]] +name = "slab" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" + +[[package]] +name = "slog" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06" +dependencies = [ + "erased-serde", +] + +[[package]] +name = "socket2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ddb1139b5353f96e429e1a5e19fbaf663bddedaa06d1dbd49f82e352601209a" +dependencies = [ + "lazy_static", + "new_debug_unreachable", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" + +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + +[[package]] +name = "strum_macros" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "subtle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" + +[[package]] +name = "subtle" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" + +[[package]] +name = "syn" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "rand 0.8.3", + "redox_syscall 0.2.8", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "term" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" +dependencies = [ + "byteorder", + "dirs", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975" +dependencies = [ + "autocfg 1.0.1", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "pin-project-lite", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-util" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + +[[package]] +name = "tracing" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +dependencies = [ + "cfg-if 1.0.0", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "typed-arena" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" + +[[package]] +name = "typed-arena" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" + +[[package]] +name = "typenum" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unicode-bidi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8-ranges" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" + +[[package]] +name = "vcpkg" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa" + +[[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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +dependencies = [ + "cfg-if 1.0.0", + "serde", + "serde_json", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" + +[[package]] +name = "web-sys" +version = "0.3.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +dependencies = [ + "webpki", +] + +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] + +[[package]] +name = "which" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55551e42cbdf2ce2bedd2203d0cc08dba002c27510f86dab6d0ce304cba3dfe" +dependencies = [ + "either", + "libc", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +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 = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi", +] + +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + +[[package]] +name = "x509-parser" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64abca276c58f8341ddc13fd4bd6ae75993cc669043f5b34813c90f7dff04771" +dependencies = [ + "base64 0.13.0", + "chrono", + "data-encoding", + "der-parser", + "lazy_static", + "nom 6.1.2", + "oid-registry", + "rusticata-macros", + "rustversion", + "thiserror", +] + +[[package]] +name = "yansi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c1e130bebaeab2f23886bf9acbaca14b092408c452543c857f66399cd6dab1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e8ecb36 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,83 @@ +[package] +name = "icx-nns" +version = "0.1.0" +authors = ["DFINITY Team"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow = "1.0.34" +candid = { version = "0.6.20", features = [ "random" ] } +chrono = "0.4.9" +clap = "3.0.0-beta.2" +hex = {version = "0.4.2", features = ["serde"] } +humanize-rs = "0.1.5" +garcon = { version = "0.2", features = ["async"] } +num-traits = "0.2" +num-derive = "0.3" +openssl = "0.10.32" +ring = "0.16.11" +serde = { version = "1.0.101", features = ["derive"] } +serde_cbor = "0.11.1" +serde_json = "1.0.57" +strum = "0.20" +strum_macros = "0.20" +thiserror = "1.0.20" +tokio = { version = "1.2.0", features = [ "fs" ] } +ic-base-types = { git = "https://github.com/dfinity/ic", rev = "779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" } +ic-nns-common = { git = "https://github.com/dfinity/ic", rev = "779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" } +ic-nns-constants = { git = "https://github.com/dfinity/ic", rev = "779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" } +ic-nns-governance = { git = "https://github.com/dfinity/ic", rev = "779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" } +ledger-canister = { git = "https://github.com/dfinity/ic", rev = "779549eccfcf61ac702dfc2ee6d76ffdc2db1f7f" } +rust_decimal = "1.10.3" + +[dependencies.ic-agent] +version = "0.5.0" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" +features = ["reqwest"] + +[dependencies.ic-identity-hsm] +version = "0.3.1" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" + +[dependencies.ic-types] +version = "0.1.3" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" + +[dependencies.ic-utils] +version = "0.3.1" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" + +[patch.crates-io.ic-agent] +version = "0.5.0" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" +features = ["reqwest"] + +[patch.crates-io.ic-identity-hsm] +version = "0.3.1" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" + +[patch.crates-io.ic-types] +version = "0.1.3" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" + +[patch.crates-io.ic-utils] +version = "0.3.1" +git = "https://github.com/dfinity/agent-rs.git" +branch = "pshahi/lookup_read_state_response" +rev = "54400dd8eb1ce6cdb6822b3cc410f15b26dcdeaf" diff --git a/src/commands/governance/get_pending_proposals.rs b/src/commands/governance/get_pending_proposals.rs new file mode 100644 index 0000000..9624310 --- /dev/null +++ b/src/commands/governance/get_pending_proposals.rs @@ -0,0 +1,28 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; + +use candid::{Decode, Encode}; +use clap::Clap; +use ic_nns_governance::pb::v1::ProposalInfo; + +const GET_PENDING_PROPOSALS_METHOD: &str = "get_pending_proposals"; + +/// Call governance canister's get_pending_proposals method +#[derive(Clap)] +pub struct GetPendingProposalsOpts {} + +pub async fn exec(_opts: GetPendingProposalsOpts, env: Env) -> NnsCliResult { + let result = env + .agent + .query(&governance_canister_id(), GET_PENDING_PROPOSALS_METHOD) + .with_arg(Encode!(&())?) + .call() + .await?; + + let proposals = Decode!(&result, Vec)?; + + println!("{:?}", proposals); + + NnsCliResult::Ok(()) +} diff --git a/src/commands/governance/get_proposal_info.rs b/src/commands/governance/get_proposal_info.rs new file mode 100644 index 0000000..c8d76bd --- /dev/null +++ b/src/commands/governance/get_proposal_info.rs @@ -0,0 +1,34 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; + +use candid::{Decode, Encode}; +use clap::Clap; +use ic_nns_governance::pb::v1::ProposalInfo; + +const GET_PROPOSAL_INFO_METHOD: &str = "get_proposal_info"; + +/// Call governance canister's get_proposal_info method +#[derive(Clap)] +pub struct GetProposalInfoOpts { + /// Proposal id + id: u64, +} + +pub async fn exec(opts: GetProposalInfoOpts, env: Env) -> NnsCliResult { + let result = env + .agent + .query(&governance_canister_id(), GET_PROPOSAL_INFO_METHOD) + .with_arg(Encode!(&(opts.id))?) + .call() + .await?; + + let maybe_proposal = Decode!(&result, Option)?; + + match maybe_proposal { + Some(proposal) => println!("{:?}", proposal), + None => println!("No proposal found with id {}", opts.id), + }; + + NnsCliResult::Ok(()) +} diff --git a/src/commands/governance/list_proposals.rs b/src/commands/governance/list_proposals.rs new file mode 100644 index 0000000..d99c4a0 --- /dev/null +++ b/src/commands/governance/list_proposals.rs @@ -0,0 +1,94 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::{ + governance_canister_id, ProposalRewardStatus, ProposalStatus, Topic, +}; +use ic_nns_governance::pb::v1::{ListProposalInfo, ListProposalInfoResponse}; + +use candid::{CandidType, Decode, Encode}; +use clap::Clap; +use num_traits::ToPrimitive; +use std::str::FromStr; + +const LIST_PROPOSALS_METHOD: &str = "list_proposals"; + +/// Call governance canister's list_proposals method +#[derive(CandidType, Clap)] +pub struct ListPropsalOpts { + #[clap(long, + possible_values = &["unspecified", + "accept_votes", "ready_to_settle", + "settled", "ineligible"])] + include_reward_status: Option>, + + #[clap(long)] + before_proposal: Option, + + #[clap(long, default_value = "100")] + limit: u32, + + #[clap(long, + possible_values = &["unspecified", + "neuron_management", "exchange_rate", "network_economics", + "governance", "node_admin", "participant_management", + "subnet_management", "network_canister_management", + "kyc", "node_provider_rewards"])] + exclude_topic: Option>, + + #[clap(long, + possible_values = &["unspecified", + "open", "rejected", "adopted", + "executed", "failed"])] + include_status: Option>, +} + +pub async fn exec(opts: ListPropsalOpts, env: Env) -> NnsCliResult { + let include_reward_status: Vec = match opts.include_reward_status { + Some(vec) => vec + .iter() + .map(|v| ToPrimitive::to_i32(&ProposalRewardStatus::from_str(&v).unwrap()).unwrap()) + .collect(), + None => Vec::::new(), + }; + + let exclude_topic: Vec = match opts.exclude_topic { + Some(vec) => vec + .iter() + .map(|v| ToPrimitive::to_i32(&Topic::from_str(&v).unwrap()).unwrap()) + .collect(), + None => Vec::::new(), + }; + + let include_status: Vec = match opts.include_status { + Some(vec) => vec + .iter() + .map(|v| ToPrimitive::to_i32(&ProposalStatus::from_str(&v).unwrap()).unwrap()) + .collect(), + None => Vec::::new(), + }; + + let before_proposal = opts + .before_proposal + .map(|v| ic_nns_common::pb::v1::ProposalId { id: v }); + let limit = opts.limit; + + let proposal_info = ListProposalInfo { + include_status, + include_reward_status, + exclude_topic, + before_proposal, + limit, + }; + + let result = env + .agent + .query(&governance_canister_id(), LIST_PROPOSALS_METHOD) + .with_arg(Encode!(&proposal_info)?) + .call() + .await?; + + let proposal_info_response = Decode!(&result, ListProposalInfoResponse)?; + println!("{:?}", proposal_info_response); + + NnsCliResult::Ok(()) +} diff --git a/src/commands/governance/mod.rs b/src/commands/governance/mod.rs new file mode 100644 index 0000000..4540180 --- /dev/null +++ b/src/commands/governance/mod.rs @@ -0,0 +1,39 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::segregated_sign_send::sign::SignPayload; + +use clap::Clap; + +mod get_pending_proposals; +mod get_proposal_info; +mod list_proposals; +mod submit_proposal; + +/// Call the governance canister +#[derive(Clap)] +#[clap(name("governance"))] +pub struct GovernanceOpts { + #[clap(subcommand)] + subcmd: SubCommand, +} + +#[derive(Clap)] +enum SubCommand { + GetPendingProposals(get_pending_proposals::GetPendingProposalsOpts), + GetProposalInfo(get_proposal_info::GetProposalInfoOpts), + ListProposals(list_proposals::ListPropsalOpts), + SubmitProposal(submit_proposal::SubmitProposalOpts), +} + +pub async fn exec( + opts: GovernanceOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + match opts.subcmd { + SubCommand::GetPendingProposals(v) => get_pending_proposals::exec(v, env).await, + SubCommand::GetProposalInfo(v) => get_proposal_info::exec(v, env).await, + SubCommand::ListProposals(v) => list_proposals::exec(v, env).await, + SubCommand::SubmitProposal(v) => submit_proposal::exec(v, maybe_sign_payload, env).await, + } +} diff --git a/src/commands/governance/submit_proposal/authorize_to_subnet.rs b/src/commands/governance/submit_proposal/authorize_to_subnet.rs new file mode 100644 index 0000000..19b7252 --- /dev/null +++ b/src/commands/governance/submit_proposal/authorize_to_subnet.rs @@ -0,0 +1,106 @@ +use crate::lib::agent::create_waiter; +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use candid::{CandidType, Decode, Encode}; +use clap::Clap; +use ic_nns_common::pb::v1::NeuronId as NeuronIdProto; +use ic_nns_common::types::NeuronId; +use ic_nns_governance::pb::v1::manage_neuron_response::Command::{Error, MakeProposal}; +use ic_nns_governance::pb::v1::proposal::Action; +use ic_nns_governance::pb::v1::NnsFunction::SetAuthorizedSubnetworks; +use ic_nns_governance::pb::v1::{ + manage_neuron::Command, ExecuteNnsFunction, ManageNeuron, ManageNeuronResponse, Proposal, +}; + +use ic_types::Principal; + +const MANAGE_NEURON_METHOD: &str = "manage_neuron"; + +/// Submit a proposal to authorize a principal to one or more verified application subnetworks +#[derive(Clap, Clone)] +pub struct AuthToSubnetOpts { + /// The principal to be authorized to create canisters using ICPTs. + /// If who is `None`, then the proposal will set the default list of subnets + /// onto which everyone is authorized to create canisters to `subnets` + /// (except those who have a custom list). + #[clap(long)] + who: Option, + + /// The list of subnets that `who` would be authorized to create subnets on. + /// If `subnets` is `None`, then `who` is removed from the list of + /// authorized users. + #[clap(long)] + subnets: Option>, +} + +pub async fn exec( + opts: AuthToSubnetOpts, + proposal_opts: super::SubmitProposalOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + #[derive(CandidType)] + struct SetAuthorizedSubnetworkListArgs { + who: Option, + subnets: Vec, + } + let payload = Encode!(&SetAuthorizedSubnetworkListArgs { + who: opts.who, + subnets: opts.subnets.unwrap_or_default() + })?; + let nns_function = SetAuthorizedSubnetworks as i32; + let execute_nns_function = ExecuteNnsFunction { + nns_function, + payload, + }; + let proposal = Proposal { + summary: proposal_opts.summary, + url: proposal_opts.url, + action: Some(Action::ExecuteNnsFunction(execute_nns_function)), + }; + let id = NeuronId(proposal_opts.neuron_id); + let manage_neuron = ManageNeuron { + id: Some(NeuronIdProto::from(id)), + command: Some(Command::MakeProposal(Box::::new(proposal))), + }; + + let arg = Encode!(&manage_neuron)?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: MANAGE_NEURON_METHOD.to_string(), + is_query: false, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .update(&governance_canister_id(), MANAGE_NEURON_METHOD) + .with_arg(arg) + .call_and_wait(create_waiter()) + .await?; + let manage_neuron_response = Decode!(&result, ManageNeuronResponse)?; + + match manage_neuron_response.command { + Some(Error(gov_err)) => println!("{}", gov_err), + Some(MakeProposal(response)) => match response.proposal_id { + Some(proposal_id) => println!("{:?}", proposal_id), + None => { + eprintln!("Propsal sent but did not receive a proposal id in response.") + } + }, + _ => eprintln!("Received an invalid response."), + }; + } + }; + + NnsCliResult::Ok(()) +} diff --git a/src/commands/governance/submit_proposal/mod.rs b/src/commands/governance/submit_proposal/mod.rs new file mode 100644 index 0000000..0df0f50 --- /dev/null +++ b/src/commands/governance/submit_proposal/mod.rs @@ -0,0 +1,47 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::segregated_sign_send::sign::SignPayload; + +use clap::Clap; + +mod authorize_to_subnet; +mod motion; + +/// Submit a proposal +#[derive(Clap, Clone)] +#[clap(name("governance"))] +pub struct SubmitProposalOpts { + #[clap(subcommand)] + subcmd: SubCommand, + + /// Neuron id + neuron_id: u64, + + /// Summary + #[clap(long)] + summary: String, + + /// Url + #[clap(long)] + url: String, +} + +#[derive(Clap, Clone)] +enum SubCommand { + AuthorizeToSubnet(authorize_to_subnet::AuthToSubnetOpts), + Motion(motion::MotionOpts), +} + +pub async fn exec( + opts: SubmitProposalOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let proposal_opts = opts.clone(); + match opts.subcmd { + SubCommand::AuthorizeToSubnet(v) => { + authorize_to_subnet::exec(v, proposal_opts, maybe_sign_payload, env).await + } + SubCommand::Motion(v) => motion::exec(v, proposal_opts, maybe_sign_payload, env).await, + } +} diff --git a/src/commands/governance/submit_proposal/motion.rs b/src/commands/governance/submit_proposal/motion.rs new file mode 100644 index 0000000..7c3ce16 --- /dev/null +++ b/src/commands/governance/submit_proposal/motion.rs @@ -0,0 +1,80 @@ +use crate::lib::agent::create_waiter; +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use candid::{CandidType, Decode, Encode}; +use clap::Clap; +use ic_nns_common::pb::v1::NeuronId as NeuronIdProto; +use ic_nns_common::types::NeuronId; +use ic_nns_governance::pb::v1::manage_neuron_response::Command::{Error, MakeProposal}; +use ic_nns_governance::pb::v1::proposal::Action; +use ic_nns_governance::pb::v1::{ + manage_neuron::Command, ManageNeuron, ManageNeuronResponse, Motion, Proposal, +}; + +const MANAGE_NEURON_METHOD: &str = "manage_neuron"; + +/// Submit a motion to the IC. +#[derive(CandidType, Clap, Clone)] +pub struct MotionOpts { + /// The text of the motion. + motion_text: String, +} + +pub async fn exec( + opts: MotionOpts, + proposal_opts: super::SubmitProposalOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let proposal = Proposal { + summary: proposal_opts.summary, + url: proposal_opts.url, + action: Some(Action::Motion(Motion { + motion_text: opts.motion_text, + })), + }; + let manage_neuron = ManageNeuron { + id: Some(NeuronIdProto::from(NeuronId(proposal_opts.neuron_id))), + command: Some(Command::MakeProposal(Box::::new(proposal))), + }; + + let arg = Encode!(&manage_neuron)?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: MANAGE_NEURON_METHOD.to_string(), + is_query: false, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .update(&governance_canister_id(), MANAGE_NEURON_METHOD) + .with_arg(arg) + .call_and_wait(create_waiter()) + .await?; + let manage_neuron_response = Decode!(&result, ManageNeuronResponse)?; + + match manage_neuron_response.command { + Some(Error(gov_err)) => println!("{}", gov_err), + Some(MakeProposal(response)) => match response.proposal_id { + Some(proposal_id) => println!("{:?}", proposal_id), + None => { + eprintln!("Propsal sent but did not receive a proposal id in response.") + } + }, + _ => eprintln!("Received an invalid response."), + }; + } + } + + NnsCliResult::Ok(()) +} diff --git a/src/commands/ledger/account_id.rs b/src/commands/ledger/account_id.rs new file mode 100644 index 0000000..d380147 --- /dev/null +++ b/src/commands/ledger/account_id.rs @@ -0,0 +1,19 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; + +use anyhow::anyhow; +use clap::Clap; +use ic_base_types::PrincipalId; +use ledger_canister::AccountIdentifier; +use std::convert::TryFrom; + +/// Prints the selected identity's AccountIdentifier. +#[derive(Clap)] +pub struct AccountIdOpts {} + +pub async fn exec(_opts: AccountIdOpts, env: Env) -> NnsCliResult { + let base_types_principal = + PrincipalId::try_from(env.sender.as_slice()).map_err(|err| anyhow!(err))?; + println!("{}", AccountIdentifier::new(base_types_principal, None)); + NnsCliResult::Ok(()) +} diff --git a/src/commands/ledger/balance.rs b/src/commands/ledger/balance.rs new file mode 100644 index 0000000..6ec0cc8 --- /dev/null +++ b/src/commands/ledger/balance.rs @@ -0,0 +1,68 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::ledger_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use anyhow::anyhow; +use candid::{Decode, Encode}; +use clap::Clap; +use ic_base_types::PrincipalId; +use ledger_canister::{AccountBalanceArgs, AccountIdentifier, ICPTs}; +use std::convert::TryFrom; +use std::str::FromStr; + +const ACCOUNT_BALANCE_METHOD: &str = "account_balance_dfx"; + +/// Prints the account balance of the user +#[derive(Clap)] +pub struct BalanceOpts { + /// Specifies an AccountIdentifier to get the balance of + of: Option, +} + +pub async fn exec( + opts: BalanceOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let base_types_principal = + PrincipalId::try_from(env.sender.as_slice()).map_err(|err| anyhow!(err))?; + let acc_id = opts + .of + .map_or_else( + || Ok(AccountIdentifier::new(base_types_principal, None)), + |v| AccountIdentifier::from_str(&v), + ) + .map_err(|err| anyhow!(err))?; + + let ledger_canister_id = ledger_canister_id(); + + let arg = Encode!(&AccountBalanceArgs { account: acc_id })?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: ledger_canister_id, + method_name: ACCOUNT_BALANCE_METHOD.to_string(), + is_query: true, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .query(&ledger_canister_id, ACCOUNT_BALANCE_METHOD) + .with_arg(arg) + .call() + .await?; + + let balance = Decode!(&result, ICPTs)?; + + println!("{}", balance); + } + }; + + Ok(()) +} diff --git a/src/commands/ledger/mod.rs b/src/commands/ledger/mod.rs new file mode 100644 index 0000000..0322715 --- /dev/null +++ b/src/commands/ledger/mod.rs @@ -0,0 +1,33 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::segregated_sign_send::sign::SignPayload; + +use clap::Clap; + +mod account_id; +mod balance; + +/// Call the ledger canister +#[derive(Clap)] +#[clap(name("ledger"))] +pub struct LedgerOpts { + #[clap(subcommand)] + subcmd: SubCommand, +} + +#[derive(Clap)] +enum SubCommand { + AccountId(account_id::AccountIdOpts), + Balance(balance::BalanceOpts), +} + +pub async fn exec( + opts: LedgerOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + match opts.subcmd { + SubCommand::AccountId(v) => account_id::exec(v, env).await, + SubCommand::Balance(v) => balance::exec(v, maybe_sign_payload, env).await, + } +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs new file mode 100644 index 0000000..ae9c561 --- /dev/null +++ b/src/commands/mod.rs @@ -0,0 +1,30 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::segregated_sign_send::sign::SignPayload; + +use clap::Clap; + +mod governance; +mod ledger; +mod neuron; +mod principal; +mod send; + +#[derive(Clap)] +pub enum Command { + GetPrincipal(principal::GetPrincipalOpts), + Governance(governance::GovernanceOpts), + Ledger(ledger::LedgerOpts), + Send(send::SendOpts), + Neuron(neuron::NeuronOpts), +} + +pub async fn exec(cmd: Command, maybe_sign_payload: Option, env: Env) -> NnsCliResult { + match cmd { + Command::GetPrincipal(v) => principal::exec(v, env).await, + Command::Governance(v) => governance::exec(v, maybe_sign_payload, env).await, + Command::Ledger(v) => ledger::exec(v, maybe_sign_payload, env).await, + Command::Send(v) => send::exec(v).await, + Command::Neuron(v) => neuron::exec(v, maybe_sign_payload, env).await, + } +} diff --git a/src/commands/neuron/dissolve.rs b/src/commands/neuron/dissolve.rs new file mode 100644 index 0000000..d55910a --- /dev/null +++ b/src/commands/neuron/dissolve.rs @@ -0,0 +1,102 @@ +use crate::lib::agent::create_waiter; +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use anyhow::anyhow; +use candid::{Decode, Encode}; +use clap::Clap; +use ic_nns_common::pb::v1::NeuronId as NeuronIdProto; +use ic_nns_common::types::NeuronId; +use ic_nns_governance::pb::v1::manage_neuron_response::Command::Error; +use ic_nns_governance::pb::v1::{ + manage_neuron::configure::Operation, + manage_neuron::Command, + manage_neuron::Configure, + manage_neuron::IncreaseDissolveDelay, + manage_neuron::{StartDissolving, StopDissolving}, + ManageNeuron, ManageNeuronResponse, +}; + +const MANAGE_NEURON_METHOD: &str = "manage_neuron"; + +/// Configure the neuron's dissolve parameters +#[derive(Clap, Clone)] +pub struct DissolveOpts { + #[clap(possible_values = &["increase-delay", "start", "stop"])] + operation: String, + additional_delay_seconds: Option, +} + +fn get_command(opts: DissolveOpts) -> NnsCliResult { + match opts.operation.as_str() { + "start" => Ok(Command::Configure(Configure { + operation: Some(Operation::StartDissolving(StartDissolving {})), + })), + "stop" => Ok(Command::Configure(Configure { + operation: Some(Operation::StopDissolving(StopDissolving {})), + })), + "increase-delay" => { + let dissolve_delay = IncreaseDissolveDelay { + additional_dissolve_delay_seconds: + opts.additional_delay_seconds + .ok_or_else( + || anyhow!( + "Please specify a dissolve dissolve delay i.e. `icx-nns neuron dissolve increase-delay "))?, + }; + Ok(Command::Configure(Configure { + operation: Some(Operation::IncreaseDissolveDelay(dissolve_delay)), + })) + } + _ => unreachable!(), + } +} + +pub async fn exec( + opts: DissolveOpts, + id: u64, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let command = get_command(opts)?; + let id = NeuronId(id); + + let manage_neuron = ManageNeuron { + id: Some(NeuronIdProto::from(id)), + command: Some(command), + }; + let arg = Encode!(&manage_neuron)?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: MANAGE_NEURON_METHOD.to_string(), + is_query: false, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .update(&governance_canister_id(), MANAGE_NEURON_METHOD) + .with_arg(arg) + .call_and_wait(create_waiter()) + .await?; + let manage_neuron_response = Decode!(&result, ManageNeuronResponse)?; + + match manage_neuron_response.command { + Some(Error(gov_err)) => println!("{}", gov_err), + Some(ic_nns_governance::pb::v1::manage_neuron_response::Command::Configure( + ic_nns_governance::pb::v1::manage_neuron_response::ConfigureResponse {}, + )) => eprintln!("Configured succesfully."), + _ => eprintln!("Received an invalid response."), + }; + } + } + + NnsCliResult::Ok(()) +} diff --git a/src/commands/neuron/full_neuron.rs b/src/commands/neuron/full_neuron.rs new file mode 100644 index 0000000..c729c5b --- /dev/null +++ b/src/commands/neuron/full_neuron.rs @@ -0,0 +1,53 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use candid::{Decode, Encode}; +use clap::Clap; +use ic_nns_governance::pb::v1::{GovernanceError, Neuron}; + +const GET_FULL_NEURON_METHOD: &str = "get_full_neuron"; + +/// Get the full neuron information +#[derive(Clap)] +pub struct GetFullNeuronOpts {} + +pub async fn exec( + _opts: GetFullNeuronOpts, + id: u64, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let arg = Encode!(&id)?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: GET_FULL_NEURON_METHOD.to_string(), + is_query: true, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .query(&governance_canister_id(), GET_FULL_NEURON_METHOD) + .with_arg(arg) + .call() + .await?; + + let neuron_result = Decode!(&result, Result)?; + + match neuron_result { + Ok(neuron) => println!("{:?}", neuron), + Err(gov_err) => eprintln!("{:?}", gov_err), + }; + } + }; + + NnsCliResult::Ok(()) +} diff --git a/src/commands/neuron/hot_key.rs b/src/commands/neuron/hot_key.rs new file mode 100644 index 0000000..fa182f6 --- /dev/null +++ b/src/commands/neuron/hot_key.rs @@ -0,0 +1,107 @@ +use crate::lib::agent::create_waiter; +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use anyhow::anyhow; +use candid::{Decode, Encode}; +use clap::Clap; +use ic_base_types::PrincipalId; +use ic_nns_common::pb::v1::NeuronId as NeuronIdProto; +use ic_nns_common::types::NeuronId; +use ic_nns_governance::pb::v1::manage_neuron_response::Command::Error; +use ic_nns_governance::pb::v1::{ + manage_neuron::configure::Operation, manage_neuron::AddHotKey, manage_neuron::Command, + manage_neuron::Configure, manage_neuron::RemoveHotKey, ManageNeuron, ManageNeuronResponse, +}; +use ic_types::Principal; +use std::convert::TryFrom; + +const MANAGE_NEURON_METHOD: &str = "manage_neuron"; + +/// Configure the neuron's hot key parameters +#[derive(Clap, Clone)] +pub struct HotKeyOpts { + hot_key: Principal, + #[clap(possible_values = &["add", "remove"])] + operation: String, +} + +fn get_command(operation: String, hot_key: Principal) -> NnsCliResult { + match operation.as_str() { + "add" => { + let hot_key = AddHotKey { + new_hot_key: { + let base_types_principal = + PrincipalId::try_from(hot_key.as_slice()).map_err(|err| anyhow!(err))?; + Some(base_types_principal) + }, + }; + Ok(Command::Configure(Configure { + operation: Some(Operation::AddHotKey(hot_key)), + })) + } + "remove" => { + let hot_key = RemoveHotKey { + hot_key_to_remove: { + let base_types_principal = + PrincipalId::try_from(hot_key.as_slice()).map_err(|err| anyhow!(err))?; + Some(base_types_principal) + }, + }; + Ok(Command::Configure(Configure { + operation: Some(Operation::RemoveHotKey(hot_key)), + })) + } + _ => unreachable!(), + } +} + +pub async fn exec( + opts: HotKeyOpts, + id: u64, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let command = get_command(opts.operation, opts.hot_key)?; + let id = NeuronId(id); + + let manage_neuron = ManageNeuron { + id: Some(NeuronIdProto::from(id)), + command: Some(command), + }; + let arg = Encode!(&manage_neuron)?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: MANAGE_NEURON_METHOD.to_string(), + is_query: false, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .update(&governance_canister_id(), MANAGE_NEURON_METHOD) + .with_arg(arg) + .call_and_wait(create_waiter()) + .await?; + let manage_neuron_response = Decode!(&result, ManageNeuronResponse)?; + + match manage_neuron_response.command { + Some(Error(gov_err)) => println!("{}", gov_err), + Some(ic_nns_governance::pb::v1::manage_neuron_response::Command::Configure( + ic_nns_governance::pb::v1::manage_neuron_response::ConfigureResponse {}, + )) => eprintln!("Configured succesfully."), + _ => eprintln!("Received an invalid response."), + }; + } + } + + NnsCliResult::Ok(()) +} diff --git a/src/commands/neuron/ids.rs b/src/commands/neuron/ids.rs new file mode 100644 index 0000000..456ad92 --- /dev/null +++ b/src/commands/neuron/ids.rs @@ -0,0 +1,47 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use candid::{Decode, Encode}; +use clap::Clap; + +const GET_NEURON_IDS_METHOD: &str = "get_neuron_ids"; + +/// Get the neuron ids associated with your identity +#[derive(Clap)] +pub struct GetNeuronIdOpts {} + +pub async fn exec( + _opts: GetNeuronIdOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let arg = Encode!(&())?; + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: GET_NEURON_IDS_METHOD.to_string(), + is_query: true, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .query(&governance_canister_id(), GET_NEURON_IDS_METHOD) + .with_arg(arg) + .call() + .await?; + + let ids = Decode!(&result, Vec)?; + + println!("{:?}", ids); + } + } + + NnsCliResult::Ok(()) +} diff --git a/src/commands/neuron/info.rs b/src/commands/neuron/info.rs new file mode 100644 index 0000000..585d759 --- /dev/null +++ b/src/commands/neuron/info.rs @@ -0,0 +1,53 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use candid::{Decode, Encode}; +use clap::Clap; +use ic_nns_governance::pb::v1::{GovernanceError, NeuronInfo}; + +const GET_NEURON_INFO_METHOD: &str = "get_neuron_info"; + +/// Get some neuron info +#[derive(Clap)] +pub struct GetNeuronInfoOpts {} + +pub async fn exec( + _opts: GetNeuronInfoOpts, + id: u64, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let arg = Encode!(&id)?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: GET_NEURON_INFO_METHOD.to_string(), + is_query: true, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .query(&governance_canister_id(), GET_NEURON_INFO_METHOD) + .with_arg(arg) + .call() + .await?; + + let neuron_info_result = Decode!(&result, Result)?; + + match neuron_info_result { + Ok(neuron_info) => println!("{:?}", neuron_info), + Err(gov_err) => eprintln!("{:?}", gov_err), + }; + } + } + + NnsCliResult::Ok(()) +} diff --git a/src/commands/neuron/list.rs b/src/commands/neuron/list.rs new file mode 100644 index 0000000..63cffd1 --- /dev/null +++ b/src/commands/neuron/list.rs @@ -0,0 +1,57 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::governance_canister_id; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use candid::{CandidType, Decode, Encode}; +use clap::Clap; +use ic_nns_governance::pb::v1::ListNeuronsResponse; + +const LIST_NEURONS_METHOD: &str = "list_neurons"; + +/// Call governance canister's list_neurons method +#[derive(CandidType, Clap)] +pub struct ListNeuronsOpts { + // List of neuron ids + #[clap(long)] + neuron_ids: Vec, + + // Include neurons readable by caller + #[clap(long)] + include_neurons_readable_by_caller: bool, +} + +pub async fn exec( + opts: ListNeuronsOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let arg = Encode!(&opts)?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: governance_canister_id(), + method_name: LIST_NEURONS_METHOD.to_string(), + is_query: true, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .query(&governance_canister_id(), LIST_NEURONS_METHOD) + .with_arg(arg) + .call() + .await?; + + let neurons = Decode!(&result, ListNeuronsResponse)?; + + println!("{:?}", neurons); + } + } + + NnsCliResult::Ok(()) +} diff --git a/src/commands/neuron/mod.rs b/src/commands/neuron/mod.rs new file mode 100644 index 0000000..c3726b8 --- /dev/null +++ b/src/commands/neuron/mod.rs @@ -0,0 +1,80 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::segregated_sign_send::sign::SignPayload; + +use anyhow::{anyhow, bail}; +use clap::Clap; + +mod dissolve; +mod full_neuron; +mod hot_key; +mod ids; +mod info; +mod list; +mod stake_or_refresh; +mod stake_or_refresh_notify; +mod stake_or_refresh_send; + +/// Manage neuron subcommand +#[derive(Clap)] +#[clap(name("neuron"))] +pub struct NeuronOpts { + #[clap(subcommand)] + subcmd: SubCommand, + id: Option, +} + +#[derive(Clap)] +enum SubCommand { + FullInfo(full_neuron::GetFullNeuronOpts), + HotKey(hot_key::HotKeyOpts), + Ids(ids::GetNeuronIdOpts), + Info(info::GetNeuronInfoOpts), + List(list::ListNeuronsOpts), + StakeOrRefresh(stake_or_refresh::StakeRefreshNeuronOpts), + StakeOrRefreshNotify(stake_or_refresh_notify::StakeRefreshNeuronNotifyOpts), + StakeOrRefreshSend(stake_or_refresh_send::StakeRefreshNeuronSendOpts), + Dissolve(dissolve::DissolveOpts), +} + +pub async fn exec( + opts: NeuronOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let id = match opts.subcmd { + SubCommand::FullInfo(_) + | SubCommand::HotKey(_) + | SubCommand::Info(_) + | SubCommand::Dissolve(_) => opts.id.ok_or_else(|| { + anyhow!("Please specify a neuron id i.e. `icx-nns neuron ") + })?, + SubCommand::Ids(_) + | SubCommand::List(_) + | SubCommand::StakeOrRefresh(_) + | SubCommand::StakeOrRefreshNotify(_) + | SubCommand::StakeOrRefreshSend(_) => { + if let Some(id) = opts.id { + bail!("Provided neuron id {} which is not needed for this command. Omit the neuron id and execute the command again", id); + } else { + 0_u64 // unused + } + } + }; + + match opts.subcmd { + SubCommand::FullInfo(v) => full_neuron::exec(v, id, maybe_sign_payload, env).await, + SubCommand::HotKey(v) => hot_key::exec(v, id, maybe_sign_payload, env).await, + SubCommand::Ids(v) => ids::exec(v, maybe_sign_payload, env).await, + SubCommand::Info(v) => info::exec(v, id, maybe_sign_payload, env).await, + SubCommand::List(v) => list::exec(v, maybe_sign_payload, env).await, + SubCommand::StakeOrRefresh(v) => stake_or_refresh::exec(v, maybe_sign_payload, env).await, + SubCommand::StakeOrRefreshNotify(v) => { + stake_or_refresh_notify::exec(v, maybe_sign_payload, env).await + } + SubCommand::StakeOrRefreshSend(v) => { + stake_or_refresh_send::exec(v, maybe_sign_payload, env).await + } + SubCommand::Dissolve(v) => dissolve::exec(v, id, maybe_sign_payload, env).await, + } +} diff --git a/src/commands/neuron/stake_or_refresh.rs b/src/commands/neuron/stake_or_refresh.rs new file mode 100644 index 0000000..88a3fc5 --- /dev/null +++ b/src/commands/neuron/stake_or_refresh.rs @@ -0,0 +1,144 @@ +use crate::lib::agent::create_waiter; +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::{governance_canister_id, ledger_canister_id}; +use crate::lib::nns_types::utils::{ + get_governance_subaccount, get_icpts_from_args, icpts_amount_validator, icpts_from_str, +}; +use crate::lib::segregated_sign_send::sign::SignPayload; + +use anyhow::{anyhow, bail}; +use candid::{Decode, Encode}; +use clap::Clap; +use ic_agent::Agent; +use ic_base_types::{CanisterId, PrincipalId}; +use ic_nns_common::pb::v1::NeuronId; +use ic_types::Principal; +use ledger_canister::{ + AccountIdentifier, BlockHeight, ICPTs, Memo, NotifyCanisterArgs, SendArgs, Subaccount, + TRANSACTION_FEE, +}; +use std::convert::TryFrom; + +const SEND_METHOD: &str = "send_dfx"; +const NOTIFY_METHOD: &str = "notify_dfx"; + +/// Stake a new neuron or refresh an existing neuron +#[derive(Clap)] +pub struct StakeRefreshNeuronOpts { + /// Specify the controller of the neuron + controller: String, + + /// A unique numerical memo, or a nonce, associated + /// with the neuron. To refresh an existing neuron, + /// specify the same memo provided when it was created. + memo: u64, + + /// ICP to stake or refresh into a neuron + /// Can be specified as a Decimal with the fractional portion up to 8 decimal places + /// i.e. 100.012 + #[clap(long, validator(icpts_amount_validator))] + #[clap(long)] + amount: Option, + + /// Specify ICP as a whole number, helpful for use in conjunction with `--e8s` + #[clap(long, conflicts_with("amount"))] + icp: Option, + + /// Specify e8s as a whole number, helpful for use in conjunction with `--icp` + #[clap(long, conflicts_with("amount"))] + e8s: Option, + + /// Transaction fee, default is 10000 e8s. + #[clap(long, validator(icpts_amount_validator))] + fee: Option, + + /// Max fee, default is 10000 e8s. + #[clap(long, validator(icpts_amount_validator))] + max_fee: Option, +} + +async fn send_and_notify( + agent: Agent, + memo: Memo, + amount: ICPTs, + fee: ICPTs, + to_subaccount: Option, + max_fee: ICPTs, +) -> NnsCliResult { + let ledger_canister_id = ledger_canister_id(); + + let governance_canister_id = governance_canister_id(); + + let gov_base_types_principal = PrincipalId::try_from(governance_canister_id.clone().as_slice()) + .map_err(|err| anyhow!(err))?; + + let to = AccountIdentifier::new(gov_base_types_principal, to_subaccount); + + let result = agent + .update(&ledger_canister_id, SEND_METHOD) + .with_arg(Encode!(&SendArgs { + memo, + amount, + fee, + from_subaccount: None, + to, + created_at_time: None, + })?) + .call_and_wait(create_waiter()) + .await?; + + let block_height = Decode!(&result, BlockHeight)?; + println!("Transfer sent at BlockHeight: {}", block_height); + + let result = agent + .update(&ledger_canister_id, NOTIFY_METHOD) + .with_arg(Encode!(&NotifyCanisterArgs { + block_height, + max_fee, + from_subaccount: None, + to_canister: CanisterId::try_from(gov_base_types_principal) + .map_err(|err| anyhow!(err))?, + to_subaccount, + })?) + .call_and_wait(create_waiter()) + .await?; + + let result = Decode!(&result, NeuronId)?; + Ok(result) +} + +pub async fn exec( + opts: StakeRefreshNeuronOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + if maybe_sign_payload.is_some() { + bail!("The `--sign` flag isn't valid for this command since it calls the ledger canister's send_dfx and notify_dfx sequentially. Please use `icx-nns --sign neuron stake-or-refresh-send` then `icx-nns --sign neuron stake-or-refresh-notify` instead."); + } + let amount = get_icpts_from_args(opts.amount, opts.icp, opts.e8s)?; + + let fee = opts + .fee + .map_or(Ok(TRANSACTION_FEE), |v| icpts_from_str(&v)) + .map_err(|err| anyhow!(err))?; + + let memo = Memo(opts.memo); + + let base_types_principal = + PrincipalId::try_from(Principal::from_text(opts.controller)?.as_slice()) + .map_err(|err| anyhow!(err))?; + + let gov_subaccount = get_governance_subaccount(memo, base_types_principal); + + let to_subaccount = Some(gov_subaccount); + + let max_fee = opts + .max_fee + .map_or(Ok(TRANSACTION_FEE), |v| icpts_from_str(&v)) + .map_err(|err| anyhow!(err))?; + + let result = send_and_notify(env.agent, memo, amount, fee, to_subaccount, max_fee).await?; + println!("Neuron id: {:?}", result); + Ok(()) +} diff --git a/src/commands/neuron/stake_or_refresh_notify.rs b/src/commands/neuron/stake_or_refresh_notify.rs new file mode 100644 index 0000000..5ccd841 --- /dev/null +++ b/src/commands/neuron/stake_or_refresh_notify.rs @@ -0,0 +1,119 @@ +use crate::lib::agent::create_waiter; +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::{governance_canister_id, ledger_canister_id}; +use crate::lib::nns_types::utils::{ + get_governance_subaccount, icpts_amount_validator, icpts_from_str, +}; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use anyhow::anyhow; +use candid::{Decode, Encode}; +use clap::Clap; +use ic_base_types::{CanisterId, PrincipalId}; +use ic_nns_common::pb::v1::NeuronId; +use ic_types::Principal; +use ledger_canister::{BlockHeight, ICPTs, Memo, NotifyCanisterArgs, Subaccount, TRANSACTION_FEE}; +use std::convert::TryFrom; + +const NOTIFY_METHOD: &str = "notify_dfx"; + +/// Stake a new neuron or refresh an existing neuron +#[derive(Clap)] +pub struct StakeRefreshNeuronNotifyOpts { + /// Specify the controller of the neuron + controller: String, + + /// A unique numerical memo, or a nonce, associated + /// with the neuron. To refresh an existing neuron, + /// specify the same memo provided when it was created. + memo: u64, + + /// The ledger block height at which the transaction was sent. + block_height: u64, + + /// Max fee, default is 10000 e8s. + #[clap(long, validator(icpts_amount_validator))] + max_fee: Option, +} + +async fn notify( + env: Env, + block_height: BlockHeight, + to_subaccount: Option, + max_fee: ICPTs, + maybe_sign_payload: Option, +) -> NnsCliResult<()> { + let ledger_canister_id = ledger_canister_id(); + + let governance_canister_id = governance_canister_id(); + + let gov_base_types_principal = PrincipalId::try_from(governance_canister_id.clone().as_slice()) + .map_err(|err| anyhow!(err))?; + + let arg = Encode!(&NotifyCanisterArgs { + block_height, + max_fee, + from_subaccount: None, + to_canister: CanisterId::try_from(gov_base_types_principal).map_err(|err| anyhow!(err))?, + to_subaccount, + })?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: ledger_canister_id, + method_name: NOTIFY_METHOD.to_string(), + is_query: false, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .update(&ledger_canister_id, NOTIFY_METHOD) + .with_arg(arg) + .call_and_wait(create_waiter()) + .await?; + + let neuron_id = Decode!(&result, NeuronId)?; + println!("Neuron id: {:?}", neuron_id); + } + } + + Ok(()) +} + +pub async fn exec( + opts: StakeRefreshNeuronNotifyOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let memo = Memo(opts.memo); + let block_height: BlockHeight = opts.block_height; + + let base_types_principal = + PrincipalId::try_from(Principal::from_text(opts.controller)?.as_slice()) + .map_err(|err| anyhow!(err))?; + + let gov_subaccount = get_governance_subaccount(memo, base_types_principal); + + let to_subaccount = Some(gov_subaccount); + + let max_fee = opts + .max_fee + .map_or(Ok(TRANSACTION_FEE), |v| icpts_from_str(&v)) + .map_err(|err| anyhow!(err))?; + + notify( + env, + block_height, + to_subaccount, + max_fee, + maybe_sign_payload, + ) + .await?; + Ok(()) +} diff --git a/src/commands/neuron/stake_or_refresh_send.rs b/src/commands/neuron/stake_or_refresh_send.rs new file mode 100644 index 0000000..7b81c42 --- /dev/null +++ b/src/commands/neuron/stake_or_refresh_send.rs @@ -0,0 +1,130 @@ +use crate::lib::agent::create_waiter; +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; +use crate::lib::nns_types::governance::{governance_canister_id, ledger_canister_id}; +use crate::lib::nns_types::utils::{ + get_governance_subaccount, get_icpts_from_args, icpts_amount_validator, icpts_from_str, +}; +use crate::lib::segregated_sign_send::sign::{sign_message, CanisterPayload, SignPayload}; + +use anyhow::anyhow; +use candid::{Decode, Encode}; +use clap::Clap; +use ic_base_types::PrincipalId; +use ic_types::Principal; +use ledger_canister::{ + AccountIdentifier, BlockHeight, ICPTs, Memo, SendArgs, Subaccount, TRANSACTION_FEE, +}; +use std::convert::TryFrom; + +const SEND_METHOD: &str = "send_dfx"; + +/// Stake a new neuron or refresh an existing neuron +#[derive(Clap)] +pub struct StakeRefreshNeuronSendOpts { + /// Specify the controller of the neuron + controller: String, + + /// A unique numerical memo, or a nonce, associated + /// with the neuron. To refresh an existing neuron, + /// specify the same memo provided when it was created. + memo: u64, + + /// ICP to stake or refresh into a neuron + /// Can be specified as a Decimal with the fractional portion up to 8 decimal places + /// i.e. 100.012 + #[clap(long, validator(icpts_amount_validator))] + #[clap(long)] + amount: Option, + + /// Specify ICP as a whole number, helpful for use in conjunction with `--e8s` + #[clap(long, conflicts_with("amount"))] + icp: Option, + + /// Specify e8s as a whole number, helpful for use in conjunction with `--icp` + #[clap(long, conflicts_with("amount"))] + e8s: Option, + + /// Transaction fee, default is 10000 e8s. + #[clap(long, validator(icpts_amount_validator))] + fee: Option, +} + +async fn send( + env: Env, + memo: Memo, + amount: ICPTs, + fee: ICPTs, + to_subaccount: Option, + maybe_sign_payload: Option, +) -> NnsCliResult<()> { + let ledger_canister_id = ledger_canister_id(); + let governance_canister_id = governance_canister_id(); + + let gov_base_types_principal = PrincipalId::try_from(governance_canister_id.clone().as_slice()) + .map_err(|err| anyhow!(err))?; + + let to = AccountIdentifier::new(gov_base_types_principal, to_subaccount); + + let arg = Encode!(&SendArgs { + memo, + amount, + fee, + from_subaccount: None, + to, + created_at_time: None, + })?; + + match maybe_sign_payload { + Some(payload) => { + let mut sign_payload = payload; + sign_payload.payload = Some(CanisterPayload { + canister_id: ledger_canister_id, + method_name: SEND_METHOD.to_string(), + is_query: false, + arg, + }); + sign_message(sign_payload, env.agent, env.sender).await?; + } + None => { + let result = env + .agent + .update(&ledger_canister_id, SEND_METHOD) + .with_arg(arg) + .call_and_wait(create_waiter()) + .await?; + + let block_height = Decode!(&result, BlockHeight)?; + println!("Transfer sent at BlockHeight: {}", block_height); + } + } + + Ok(()) +} + +pub async fn exec( + opts: StakeRefreshNeuronSendOpts, + maybe_sign_payload: Option, + env: Env, +) -> NnsCliResult { + let amount = get_icpts_from_args(opts.amount, opts.icp, opts.e8s)?; + + let fee = opts + .fee + .map_or(Ok(TRANSACTION_FEE), |v| icpts_from_str(&v)) + .map_err(|err| anyhow!(err))?; + + let memo = Memo(opts.memo); + + let base_types_principal = + PrincipalId::try_from(Principal::from_text(opts.controller)?.as_slice()) + .map_err(|err| anyhow!(err))?; + + let gov_subaccount = get_governance_subaccount(memo, base_types_principal); + + let to_subaccount = Some(gov_subaccount); + + send(env, memo, amount, fee, to_subaccount, maybe_sign_payload).await?; + + Ok(()) +} diff --git a/src/commands/principal.rs b/src/commands/principal.rs new file mode 100644 index 0000000..d007b2c --- /dev/null +++ b/src/commands/principal.rs @@ -0,0 +1,13 @@ +use crate::lib::env::Env; +use crate::lib::error::NnsCliResult; + +use clap::Clap; + +/// Prints the selected identity's principal +#[derive(Clap)] +pub struct GetPrincipalOpts {} + +pub async fn exec(_opts: GetPrincipalOpts, env: Env) -> NnsCliResult { + println!("{}", env.sender.to_text()); + NnsCliResult::Ok(()) +} diff --git a/src/commands/send.rs b/src/commands/send.rs new file mode 100644 index 0000000..f4e4f82 --- /dev/null +++ b/src/commands/send.rs @@ -0,0 +1,139 @@ +use crate::lib::error::{NnsCliError, NnsCliResult}; +use crate::lib::segregated_sign_send::signed_message::SignedMessageV1; + +use anyhow::{anyhow, bail}; +use clap::Clap; +use ic_agent::agent::{ + lookup_read_state_response, AgentError, QueryResponse, ReplicaV2Transport, + RequestStatusResponse, +}; +use ic_agent::{agent::http_transport::ReqwestHttpReplicaV2Transport, RequestId}; +use ic_types::Principal; +use std::{fs::File, path::Path}; +use std::{io::Read, str::FromStr}; + +/// Send a signed message +#[derive(Clap)] +pub struct SendOpts { + /// Specifies the file name of the message + file_name: String, + + /// Send the signed request-status call in the message + #[clap(long)] + status: bool, +} + +pub async fn exec(opts: SendOpts) -> NnsCliResult { + let file_name = opts.file_name; + let path = Path::new(&file_name); + let mut file = File::open(&path).map_err(|_| anyhow!("Message file doesn't exist."))?; + let mut json = String::new(); + file.read_to_string(&mut json) + .map_err(|_| anyhow!("Cannot read the message file."))?; + let message: SignedMessageV1 = + serde_json::from_str(&json).map_err(|_| anyhow!("Invalid json message."))?; + message.validate()?; + + let network = message.network.clone(); + let transport = ReqwestHttpReplicaV2Transport::create(network)?; + let content = hex::decode(&message.content)?; + let canister_id = Principal::from_text(message.canister_id.clone())?; + + if opts.status { + if message.call_type.clone().as_str() != "update" { + bail!("Can only check request_status on update calls."); + } + if message.signed_request_status.is_none() { + bail!("No signed_request_status in [{}].", file_name); + } + let envelope = hex::decode(&message.signed_request_status.unwrap())?; + let response = transport.read_state(canister_id.clone(), envelope).await?; + let request_id = RequestId::from_str( + &message + .request_id + .expect("Cannot get request_id from the update message."), + )?; + match lookup_read_state_response(response, request_id).map_err(|err| anyhow!("{}", err))? { + RequestStatusResponse::Replied { reply } => { + let ic_agent::agent::Replied::CallReplied(blob) = reply; + println!("{}", candid::IDLArgs::from_bytes(&blob)?); + } + RequestStatusResponse::Rejected { + reject_code, + reject_message, + } => { + return Err(NnsCliError::new(AgentError::ReplicaError { + reject_code, + reject_message, + })) + } + RequestStatusResponse::Unknown => (), + RequestStatusResponse::Received | RequestStatusResponse::Processing => { + eprintln!("The update call has been received and is processing.") + } + RequestStatusResponse::Done => { + return Err(NnsCliError::new(AgentError::RequestStatusDoneNoReply( + String::from(request_id), + ))) + } + } + return Ok(()); + } + + eprintln!("Will send message:"); + eprintln!(" Creation: {}", message.creation); + eprintln!(" Expiration: {}", message.expiration); + eprintln!(" Network: {}", message.network); + eprintln!(" Call type: {}", message.call_type); + eprintln!(" Sender: {}", message.sender); + eprintln!(" Canister id: {}", message.canister_id); + eprintln!(" Method name: {}", message.method_name); + eprintln!(" Arg: {:?}", message.arg); + + eprintln!("\nOkay? [y/N]"); + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + if !["y", "yes"].contains(&input.to_lowercase().trim()) { + return Ok(()); + } + + match message.call_type.as_str() { + "query" => { + let response: QueryResponse = + serde_cbor::from_slice(&transport.query(canister_id, content).await?) + .map_err(|err| anyhow!("{}", err))?; + match response { + QueryResponse::Replied { reply } => { + println!("{}", candid::IDLArgs::from_bytes(&reply.arg)?); + } + QueryResponse::Rejected { + reject_code, + reject_message, + } => { + eprintln!("{} {}", reject_code, reject_message); + } + }; + } + "update" => { + let request_id = RequestId::from_str( + &message + .request_id + .expect("Cannot get request_id from the update message."), + )?; + transport + .call(canister_id.clone(), content, request_id) + .await?; + + eprintln!( + "To check the status of this update call, append `--status` to current command." + ); + eprintln!("e.g. `icx-nns send message.json --status`"); + eprint!("Request ID: "); + println!("0x{}", String::from(request_id)); + eprint!("Canister ID: "); + println!("{}", canister_id.to_string()); + } + _ => unreachable!(), + } + Ok(()) +} diff --git a/src/lib/agent/mod.rs b/src/lib/agent/mod.rs new file mode 100644 index 0000000..b5d97fe --- /dev/null +++ b/src/lib/agent/mod.rs @@ -0,0 +1,27 @@ +use crate::lib::error::NnsCliResult; + +use anyhow::anyhow; +use garcon::Delay; +use ic_agent::{Agent, Identity}; + +pub fn create_waiter() -> Delay { + Delay::builder() + .throttle(std::time::Duration::from_secs(1)) + .build() +} + +pub async fn construct_agent( + identity: Box, + endpoint: String, + fetch_root_key: bool, +) -> NnsCliResult { + let agent = Agent::builder() + .with_url(endpoint) + .with_boxed_identity(identity) + .build() + .map_err(|err| anyhow!("{:?}", err.to_string()))?; + if fetch_root_key { + let _ = agent.fetch_root_key().await?; + } + Ok(agent) +} diff --git a/src/lib/env/mod.rs b/src/lib/env/mod.rs new file mode 100644 index 0000000..7730394 --- /dev/null +++ b/src/lib/env/mod.rs @@ -0,0 +1,7 @@ +use ic_agent::Agent; +use ic_types::Principal; + +pub struct Env { + pub agent: Agent, + pub sender: Principal, +} diff --git a/src/lib/error/mod.rs b/src/lib/error/mod.rs new file mode 100644 index 0000000..2068e88 --- /dev/null +++ b/src/lib/error/mod.rs @@ -0,0 +1,5 @@ +// The type to represent NNS CLI results. +pub type NnsCliResult = anyhow::Result; + +// The type to represent NNS CLI errors. +pub type NnsCliError = anyhow::Error; diff --git a/src/lib/identity/mod.rs b/src/lib/identity/mod.rs new file mode 100644 index 0000000..8104af2 --- /dev/null +++ b/src/lib/identity/mod.rs @@ -0,0 +1,56 @@ +use crate::lib::error::NnsCliResult; + +use anyhow::anyhow; +use ic_agent::identity::BasicIdentity; +use ic_agent::Identity; +use ic_identity_hsm::HardwareIdentity; + +const HSM_PKCS11_LIBRARY_PATH: &str = "HSM_PKCS11_LIBRARY_PATH"; +const PEM_PATH: &str = "PEM_PATH"; +const HSM_SLOT_INDEX: &str = "HSM_SLOT_INDEX"; +const HSM_KEY_ID: &str = "HSM_KEY_ID"; +const HSM_PIN: &str = "HSM_PIN"; + +fn expect_env_var(name: &str) -> Result { + std::env::var(name).map_err(|_| format!("Need to specify the {} environment variable", name)) +} + +fn get_hsm_pin() -> Result { + expect_env_var(HSM_PIN) +} + +fn create_basic_identity() -> NnsCliResult> { + let id = match std::env::var(PEM_PATH) { + Ok(_) => { + let path = expect_env_var(PEM_PATH).map_err(|err| anyhow!("{}", err))?; + BasicIdentity::from_pem_file(path).expect("Could not read the pem file.") + } + Err(_) => return Err(anyhow!("PEM_PATH environment variable is not set.")), + }; + Ok(Box::new(id)) +} + +fn create_hsm_identity() -> NnsCliResult> { + if std::env::var(HSM_PKCS11_LIBRARY_PATH).is_err() { + return Err(anyhow!( + "HSM_PKCS11_LIBRARY_PATH environment variable is not set." + )); + } + let path = expect_env_var(HSM_PKCS11_LIBRARY_PATH).map_err(|err| anyhow!("{}", err))?; + let slot_index = expect_env_var(HSM_SLOT_INDEX) + .map_err(|err| anyhow!("{}", err))? + .parse::() + .map_err(|e| anyhow!("Unable to parse {} value: {}", HSM_SLOT_INDEX, e))?; + let key = expect_env_var(HSM_KEY_ID).map_err(|err| anyhow!("{}", err))?; + let id = HardwareIdentity::new(path, slot_index, &key, get_hsm_pin) + .map_err(|e| anyhow!("Unable to create hw identity: {}", e))?; + Ok(Box::new(id)) +} + +pub fn create_identity(use_hsm: bool) -> NnsCliResult> { + if use_hsm { + create_hsm_identity() + } else { + create_basic_identity() + } +} diff --git a/src/lib/mod.rs b/src/lib/mod.rs new file mode 100644 index 0000000..7cfdee4 --- /dev/null +++ b/src/lib/mod.rs @@ -0,0 +1,6 @@ +pub mod agent; +pub mod env; +pub mod error; +pub mod identity; +pub mod nns_types; +pub mod segregated_sign_send; diff --git a/src/lib/nns_types/governance/mod.rs b/src/lib/nns_types/governance/mod.rs new file mode 100644 index 0000000..49ca8b6 --- /dev/null +++ b/src/lib/nns_types/governance/mod.rs @@ -0,0 +1,61 @@ +use ic_types::Principal; +use num_derive::ToPrimitive; +use strum_macros::{AsRefStr, EnumString}; + +#[derive(AsRefStr, Debug, EnumString, ToPrimitive)] +#[strum(serialize_all = "snake_case")] +pub enum ProposalRewardStatus { + Unspecified = 0, + /// The proposal still accept votes, for the purpose of + /// vote rewards. This implies nothing on the ProposalStatus. + AcceptVotes = 1, + /// The proposal no longer accepts votes. It is due to settle + /// at the next reward event. + ReadyToSettle = 2, + /// The proposal has been taken into account in a reward event. + Settled = 3, + /// The proposal is not eligible to be taken into account in a reward event. + Ineligible = 4, +} + +#[derive(AsRefStr, Debug, EnumString, ToPrimitive)] +#[strum(serialize_all = "snake_case")] +pub enum ProposalStatus { + Unspecified = 0, + /// A decision (adopt/reject) has yet to be made. + Open = 1, + /// The proposal has been rejected. + Rejected = 2, + /// The proposal has been adopted (sometimes also called + /// "accepted"). At this time, either execution as not yet started, + /// or it has but the outcome is not yet known. + Adopted = 3, + /// The proposal was adopted and successfully executed. + Executed = 4, + /// The proposal was adopted, but execution failed. + Failed = 5, +} + +#[derive(AsRefStr, Debug, EnumString, ToPrimitive)] +#[strum(serialize_all = "snake_case")] +pub enum Topic { + Unspecified = 0, + NeuronManagement = 1, + ExchangeRate = 2, + NetworkEconomics = 3, + Governance = 4, + NodeAdmin = 5, + ParticipantManagement = 6, + SubnetManagement = 7, + NetworkCanisterManagement = 8, + Kyc = 9, + NodeProviderRewards = 10, +} + +pub fn ledger_canister_id() -> Principal { + Principal::from_slice(ic_nns_constants::LEDGER_CANISTER_ID.as_ref()) +} + +pub fn governance_canister_id() -> Principal { + Principal::from_slice(ic_nns_constants::GOVERNANCE_CANISTER_ID.as_ref()) +} diff --git a/src/lib/nns_types/mod.rs b/src/lib/nns_types/mod.rs new file mode 100644 index 0000000..71d6cc9 --- /dev/null +++ b/src/lib/nns_types/mod.rs @@ -0,0 +1,2 @@ +pub mod governance; +pub mod utils; diff --git a/src/lib/nns_types/utils/mod.rs b/src/lib/nns_types/utils/mod.rs new file mode 100644 index 0000000..6a5d701 --- /dev/null +++ b/src/lib/nns_types/utils/mod.rs @@ -0,0 +1,80 @@ +use crate::lib::error::NnsCliResult; + +use anyhow::anyhow; +use ic_base_types::PrincipalId; +use ledger_canister::{ICPTs, Memo, Subaccount, DECIMAL_PLACES}; +use openssl::sha::Sha256; +use rust_decimal::Decimal; +use std::convert::TryFrom; +use std::str::FromStr; + +pub fn icpts_amount_validator(icpts: &str) -> Result<(), String> { + let err_message = format!("Could not convert {} to ICP type", icpts); + icpts_from_str(icpts).map(|_| ()).map_err(|_| err_message) +} + +pub fn get_governance_subaccount(memo: Memo, principal: PrincipalId) -> Subaccount { + Subaccount::try_from( + &{ + let mut state = Sha256::new(); + state.update(&[0x0c]); + state.update(b"neuron-stake"); + state.update(&principal.as_slice()); + state.update(&memo.0.to_be_bytes()); + state.finish() + }[..], + ) + .expect("Couldn't build subaccount from hash.") +} + +pub fn icpts_from_str(s: &str) -> NnsCliResult { + match Decimal::from_str(s) { + Ok(amount) => { + if amount.scale() > DECIMAL_PLACES { + return Err(anyhow!( + "e8s can only be specified to the 8th decimal.".to_string() + )); + } + let icpts = match amount.trunc().to_string().parse::() { + Ok(v) => v, + Err(e) => return Err(anyhow!(format!("{}", e))), + }; + let e8s = match amount.fract().to_string().as_str() { + "0" => 0_u64, + e8s => { + let e8s = &e8s.to_string()[2..e8s.to_string().len()]; + let amount = e8s.chars().enumerate().fold(0, |amount, (idx, val)| { + amount + + (10_u64.pow(DECIMAL_PLACES - 1 - (idx as u32)) + * (val.to_digit(10).unwrap() as u64)) + }); + amount as u64 + } + }; + ICPTs::new(icpts, e8s).map_err(|err| anyhow!(err)) + } + Err(e) => Err(anyhow!(format!("Decimal conversion error: {}", e))), + } +} + +pub fn get_icpts_from_args( + amount: Option, + icp: Option, + e8s: Option, +) -> NnsCliResult { + if amount.is_none() { + let icp = match icp { + Some(v) => ICPTs::from_icpts(v).map_err(|err| anyhow!(err))?, + None => ICPTs::from_e8s(0), + }; + let icp_from_e8s = match e8s { + Some(v) => ICPTs::from_e8s(v), + None => ICPTs::from_e8s(0), + }; + let amount = icp + icp_from_e8s; + Ok(amount.map_err(|err| anyhow!(err))?) + } else { + Ok(icpts_from_str(&amount.unwrap()) + .map_err(|err| anyhow!("Could not add ICPs and e8s: {}", err))?) + } +} diff --git a/src/lib/segregated_sign_send/mod.rs b/src/lib/segregated_sign_send/mod.rs new file mode 100644 index 0000000..de4ddbc --- /dev/null +++ b/src/lib/segregated_sign_send/mod.rs @@ -0,0 +1,3 @@ +pub mod sign; +pub mod sign_transport; +pub mod signed_message; diff --git a/src/lib/segregated_sign_send/sign.rs b/src/lib/segregated_sign_send/sign.rs new file mode 100644 index 0000000..8f62c85 --- /dev/null +++ b/src/lib/segregated_sign_send/sign.rs @@ -0,0 +1,121 @@ +use crate::lib::error::NnsCliResult; +use crate::lib::segregated_sign_send::sign_transport::SignReplicaV2Transport; +use crate::lib::segregated_sign_send::signed_message::SignedMessageV1; + +use anyhow::{anyhow, bail}; +use chrono::Utc; +use humanize_rs::duration; +use ic_agent::RequestId; +use ic_agent::{Agent, AgentError}; +use ic_types::Principal; +use std::fs::File; +use std::io::Read; +use std::path::Path; +use std::str::FromStr; +use std::time::SystemTime; + +pub struct CanisterPayload { + pub canister_id: Principal, + pub method_name: String, + pub is_query: bool, + pub arg: Vec, +} + +pub struct SignPayload { + pub payload: Option, + pub network: String, + pub expire_after: String, + pub file: String, +} + +pub async fn sign_message(opts: SignPayload, agent: Agent, sender: Principal) -> NnsCliResult { + let payload = opts.payload.unwrap(); + let timeout = duration::parse(&opts.expire_after) + .map_err(|_| anyhow!("Cannot parse expire_after as a duration (e.g. `1h`, `1h 30m`)"))?; + let expiration_system_time = SystemTime::now() + .checked_add(timeout) + .ok_or_else(|| anyhow!("Time wrapped around."))?; + let chorono_timeout = chrono::Duration::seconds(timeout.as_secs() as i64); + let creation = Utc::now(); + let expiration = creation + .checked_add_signed(chorono_timeout) + .ok_or_else(|| anyhow!("Expiration datetime overflow."))?; + + let message_template = SignedMessageV1::new( + creation, + expiration, + opts.network, + sender, + payload.canister_id.clone(), + payload.method_name.to_string(), + payload.arg.clone(), + ); + + let file_name = opts.file; + if Path::new(&file_name).exists() { + bail!( + "[{}] already exists, please specify a different output file name.", + file_name + ); + } + + let mut sign_agent = agent.clone(); + sign_agent.set_transport(SignReplicaV2Transport::new( + file_name.clone(), + message_template, + )); + + if payload.is_query { + let res = sign_agent + .query(&payload.canister_id, payload.method_name) + .with_effective_canister_id(payload.canister_id) + .with_arg(&payload.arg) + .expire_at(expiration_system_time) + .call() + .await; + match res { + Err(AgentError::TransportError(b)) => { + println!("{}", b); + Ok(()) + } + Err(e) => bail!(e), + Ok(_) => unreachable!(), + } + } else { + let res = sign_agent + .update(&payload.canister_id, payload.method_name) + .with_effective_canister_id(payload.canister_id.clone()) + .with_arg(&payload.arg) + .expire_at(expiration_system_time) + .call() + .await; + match res { + Err(AgentError::TransportError(b)) => { + println!("{}", b); + //Ok(()) + } + Err(e) => bail!(e), + Ok(_) => unreachable!(), + } + let path = Path::new(&file_name); + let mut file = File::open(&path).map_err(|_| anyhow!("Message file doesn't exist."))?; + let mut json = String::new(); + file.read_to_string(&mut json) + .map_err(|_| anyhow!("Cannot read the message file."))?; + let message: SignedMessageV1 = + serde_json::from_str(&json).map_err(|_| anyhow!("Invalid json message."))?; + // message from file guaranteed to have request_id becase it is a update message just generated + let request_id = RequestId::from_str(&message.request_id.unwrap())?; + let res = sign_agent + .request_status_raw(&request_id, payload.canister_id.clone()) + .await; + match res { + Err(AgentError::TransportError(b)) => { + println!("{}", b); + Ok(()) + } + Err(e) => bail!(e), + Ok(_) => unreachable!(), + } + } +} diff --git a/src/lib/segregated_sign_send/sign_transport.rs b/src/lib/segregated_sign_send/sign_transport.rs new file mode 100644 index 0000000..ce0acfa --- /dev/null +++ b/src/lib/segregated_sign_send/sign_transport.rs @@ -0,0 +1,142 @@ +use super::signed_message::SignedMessageV1; + +use ic_agent::agent::ReplicaV2Transport; +use ic_agent::{AgentError, RequestId}; +use ic_types::Principal; + +use std::fs::{File, OpenOptions}; +use std::future::Future; +use std::io::{Read, Write}; +use std::path::Path; +use std::pin::Pin; +use thiserror::Error; + +#[derive(Error, Debug)] +enum SerializeStatus { + #[error("{0}")] + Success(String), +} + +pub(crate) struct SignReplicaV2Transport { + file_name: String, + message_template: SignedMessageV1, +} + +impl SignReplicaV2Transport { + pub fn new>(file_name: U, message_template: SignedMessageV1) -> Self { + Self { + file_name: file_name.into(), + message_template, + } + } +} + +impl ReplicaV2Transport for SignReplicaV2Transport { + fn read_state<'a>( + &'a self, + _effective_canister_id: Principal, + envelope: Vec, + ) -> Pin, AgentError>> + Send + 'a>> { + async fn run(s: &SignReplicaV2Transport, envelope: Vec) -> Result, AgentError> { + let path = Path::new(&s.file_name); + let mut file = + File::open(&path).map_err(|x| AgentError::MessageError(x.to_string()))?; + let mut json = String::new(); + file.read_to_string(&mut json) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + let message: SignedMessageV1 = + serde_json::from_str(&json).map_err(|x| AgentError::MessageError(x.to_string()))?; + let message = message.with_signed_request_status(hex::encode(&envelope)); + let json = serde_json::to_string(&message) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + let mut file = OpenOptions::new() + .write(true) + .truncate(true) + .open(&path) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + file.write_all(json.as_bytes()) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + Err(AgentError::TransportError( + SerializeStatus::Success(format!( + "Signed request_status append to update message in [{}]", + &s.file_name + )) + .into(), + )) + } + + Box::pin(run(self, envelope)) + } + + fn call<'a>( + &'a self, + _effective_canister_id: Principal, + envelope: Vec, + request_id: RequestId, + ) -> Pin> + Send + 'a>> { + async fn run( + s: &SignReplicaV2Transport, + envelope: Vec, + request_id: RequestId, + ) -> Result<(), AgentError> { + let message = s + .message_template + .clone() + .with_call_type("update".to_string()) + .with_request_id(request_id) + .with_content(hex::encode(&envelope)); + let json = serde_json::to_string(&message) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + let path = Path::new(&s.file_name); + let mut file = + File::create(&path).map_err(|x| AgentError::MessageError(x.to_string()))?; + file.write_all(json.as_bytes()) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + Err(AgentError::TransportError( + SerializeStatus::Success(format!("Update message generated at [{}]", &s.file_name)) + .into(), + )) + } + + Box::pin(run(self, envelope, request_id)) + } + + fn query<'a>( + &'a self, + _effective_canister_id: Principal, + envelope: Vec, + ) -> Pin, AgentError>> + Send + 'a>> { + async fn run(s: &SignReplicaV2Transport, envelope: Vec) -> Result, AgentError> { + let message = s + .message_template + .clone() + .with_call_type("query".to_string()) + .with_content(hex::encode(&envelope)); + let json = serde_json::to_string(&message) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + let path = Path::new(&s.file_name); + let mut file = + File::create(&path).map_err(|x| AgentError::MessageError(x.to_string()))?; + file.write_all(json.as_bytes()) + .map_err(|x| AgentError::MessageError(x.to_string()))?; + Err(AgentError::TransportError( + SerializeStatus::Success(format!("Query message generated at [{}]", &s.file_name)) + .into(), + )) + } + + Box::pin(run(self, envelope)) + } + + fn status<'a>( + &'a self, + ) -> Pin, AgentError>> + Send + 'a>> { + async fn run(_: &SignReplicaV2Transport) -> Result, AgentError> { + Err(AgentError::MessageError( + "status calls not supported".to_string(), + )) + } + + Box::pin(run(self)) + } +} diff --git a/src/lib/segregated_sign_send/signed_message.rs b/src/lib/segregated_sign_send/signed_message.rs new file mode 100644 index 0000000..6217aaa --- /dev/null +++ b/src/lib/segregated_sign_send/signed_message.rs @@ -0,0 +1,206 @@ +use crate::lib::error::NnsCliResult; + +use ic_agent::RequestId; +use ic_types::principal::Principal; + +use anyhow::{anyhow, bail}; +use chrono::{DateTime, TimeZone, Utc}; +use serde::{Deserialize, Serialize}; +use serde_cbor::Value; +use std::convert::TryFrom; +use std::time::Duration; + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub(crate) struct SignedMessageV1 { + version: usize, + #[serde(with = "date_time_utc")] + pub creation: DateTime, + #[serde(with = "date_time_utc")] + pub expiration: DateTime, + pub network: String, // url of the network + pub call_type: String, + pub sender: String, + pub canister_id: String, + pub method_name: String, + pub arg: Vec, + pub request_id: Option, // only useful for update call + pub content: String, // hex::encode the Vec + pub signed_request_status: Option, // hex::encode the Vec, only accompany update call +} + +impl SignedMessageV1 { + pub fn new( + creation: DateTime, + expiration: DateTime, + network: String, + sender: Principal, + canister_id: Principal, + method_name: String, + arg: Vec, + ) -> Self { + Self { + version: 1, + creation, + expiration, + network, + call_type: String::new(), + sender: sender.to_string(), + canister_id: canister_id.to_string(), + method_name, + arg, + request_id: None, + content: String::new(), + signed_request_status: None, + } + } + + pub fn with_call_type(mut self, request_type: String) -> Self { + self.call_type = request_type; + self + } + + pub fn with_request_id(mut self, request_id: RequestId) -> Self { + self.request_id = Some(String::from(request_id)); + self + } + + pub fn with_content(mut self, content: String) -> Self { + self.content = content; + self + } + + pub fn with_signed_request_status(mut self, signed_request_status: String) -> Self { + self.signed_request_status = Some(signed_request_status); + self + } + + pub fn validate(&self) -> NnsCliResult { + if self.version != 1 { + bail!("Invalid message: version must be 1"); + } + + if !["query", "update"].contains(&self.call_type.as_str()) { + bail!("Invalid message: call_type must be `query` or `update`"); + } + + let content = hex::decode(&self.content)?; + + let cbor: Value = serde_cbor::from_slice(&content) + .map_err(|_| anyhow!("Invalid cbor data in the content of the message."))?; + + if let Value::Map(m) = cbor { + let cbor_content = m + .get(&Value::Text("content".to_string())) + .ok_or_else(|| anyhow!("Invalid cbor content"))?; + if let Value::Map(m) = cbor_content { + let ingress_expiry = m + .get(&Value::Text("ingress_expiry".to_string())) + .ok_or_else(|| anyhow!("Invalid cbor content"))?; + if let Value::Integer(s) = ingress_expiry { + let seconds_since_epoch_cbor = Duration::from_nanos(*s as u64).as_secs(); + let expiration_from_cbor = Utc.timestamp(seconds_since_epoch_cbor as i64, 0); + let diff = self.expiration.signed_duration_since(expiration_from_cbor); + if diff > chrono::Duration::seconds(5) || diff < chrono::Duration::seconds(-5) { + bail!( + "Invalid message: expiration not match\njson: {}\ncbor: {}", + self.expiration, + expiration_from_cbor + ) + } + if Utc::now() > expiration_from_cbor { + bail!("The message has been expired at: {}", expiration_from_cbor); + } + } + let sender = m + .get(&Value::Text("sender".to_string())) + .ok_or_else(|| anyhow!("Invalid cbor content"))?; + if let Value::Bytes(s) = sender { + let sender_from_cbor = + Principal::try_from(s).map_err(|_| anyhow!("Invalid cbor content."))?; + let sender_from_json = Principal::from_text(&self.sender) + .map_err(|_| anyhow!("Invalid json: sender."))?; + if !sender_from_cbor.eq(&sender_from_json) { + bail!( + "Invalid message: sender principle not match\njson: {}\ncbor: {}", + sender_from_json, + sender_from_cbor + ) + } + } + + let canister_id = m + .get(&Value::Text("canister_id".to_string())) + .ok_or_else(|| anyhow!("Invalid cbor content"))?; + if let Value::Bytes(s) = canister_id { + let canister_id_from_cbor = + Principal::try_from(s).map_err(|_| anyhow!("Invalid cbor content."))?; + let canister_id_from_json = Principal::from_text(&self.canister_id) + .map_err(|_| anyhow!("Invalid json: canister_id."))?; + if !canister_id_from_cbor.eq(&canister_id_from_json) { + bail!( + "Invalid message: canister_id not match\njson: {}\ncbor: {}", + canister_id_from_json, + canister_id_from_cbor + ) + } + } + + let method_name = m + .get(&Value::Text("method_name".to_string())) + .ok_or_else(|| anyhow!("Invalid cbor content"))?; + if let Value::Text(s) = method_name { + if !s.eq(&self.method_name) { + bail!( + "Invalid message: method_name not match\njson: {}\ncbor: {}", + self.method_name, + s + ) + } + } + + let arg = m + .get(&Value::Text("arg".to_string())) + .ok_or_else(|| anyhow!("Invalid cbor content"))?; + if let Value::Bytes(s) = arg { + if !s.eq(&self.arg) { + bail!( + "Invalid message: arg not match\njson: {:?}\ncbor: {:?}", + self.arg, + s + ) + } + } + } else { + bail!("Invalid cbor content"); + } + } else { + bail!("Invalid cbor content"); + } + Ok(()) + } +} + +mod date_time_utc { + // https://serde.rs/custom-date-format.html + use chrono::{DateTime, TimeZone, Utc}; + use serde::{self, Deserialize, Deserializer, Serializer}; + + const FORMAT: &str = "%Y-%m-%d %H:%M:%S UTC"; + + pub fn serialize(date: &DateTime, serializer: S) -> Result + where + S: Serializer, + { + let s = format!("{}", date.format(FORMAT)); + serializer.serialize_str(&s) + } + + pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + Utc.datetime_from_str(&s, FORMAT) + .map_err(serde::de::Error::custom) + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..f3eea96 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,87 @@ +use crate::lib::agent::construct_agent; +use crate::lib::env::Env; +use crate::lib::identity::create_identity; +use crate::lib::segregated_sign_send::sign::SignPayload; +use clap::{AppSettings, Clap}; + +use anyhow::anyhow; +use tokio::runtime::Runtime; + +mod commands; +mod lib; + +const IC_ENDPOINT: &str = "https://ic0.app"; + +/// A tool to interact with IC NNS. +#[derive(Clap)] +#[clap(name("icx-nns"), global_setting = AppSettings::ColoredHelp)] +pub struct Opts { + #[clap(subcommand)] + command: commands::Command, + + /// An IP address and port to connect to "
:" + #[clap(long)] + endpoint: Option, + + /// A flag to control whether or not to use the HSM backed identity + #[clap(long)] + use_hsm: bool, + + /// Sign the message locally and save content to filename as specified + /// with the `--flag` option. This file can be sent with `icx-nns send ` + #[clap(long)] + sign: bool, + + /// Specify the output file name. Extension type should be `.json` + /// Default filename: message.json + #[clap(long, requires("sign"))] + file: Option, + + /// Specifies how long will the message be valid in seconds + /// Default expiry timeout: 5 minutes + #[clap(long, requires("sign"))] + expire_after: Option, +} + +fn main() { + let opts = Opts::parse(); + let command = opts.command; + let (network, fetch_root_key) = opts + .endpoint + .clone() + .map_or((IC_ENDPOINT.to_string(), false), |v| { + (format!("http://{}", v), true) + }); + let use_hsm = opts.use_hsm; + let sign = opts.sign; + let file = opts.file.unwrap_or_else(|| "message.json".to_string()); + let expire_after = opts.expire_after.unwrap_or_else(|| "5m".to_string()); + + let runtime = Runtime::new().expect("Unable to create a runtime"); + + let result = runtime.block_on(async { + let identity = create_identity(use_hsm)?; + let sender = identity.sender().map_err(|err| anyhow!("{}", err))?; + + let agent = construct_agent(identity, network.clone(), fetch_root_key).await?; + + let env = Env { agent, sender }; + + let maybe_sign_payload = if sign { + Some(SignPayload { + payload: None, + network, + expire_after, + file, + }) + } else { + None + }; + commands::exec(command, maybe_sign_payload, env).await + }); + + if let Err(err) = result { + eprintln!("{}", err); + std::process::exit(255); + } +}