diff --git a/Cargo.lock b/Cargo.lock index 6264e537..042921f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,18 +12,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" +checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" [[package]] name = "arrayref" @@ -48,17 +48,88 @@ dependencies = [ ] [[package]] -name = "async-std" -version = "1.6.2" +name = "async-channel" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d68a33ebc8b57800847d00787307f84a562224a14db069b0acefe4c2abbf5d" +checksum = "21279cfaa4f47df10b1816007e738ca3747ef2ee53ffc51cdbf57a8bb266fee3" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801" +dependencies = [ + "async-task 4.0.2", + "concurrent-queue", + "fastrand", + "futures-lite", + "once_cell", + "vec-arena", +] + +[[package]] +name = "async-global-executor" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5586e693d02f9b439742e9d5d68bd64d923c6861954f7d78f91001a0e152d589" +dependencies = [ + "async-executor", + "async-io", + "futures-lite", + "num_cpus", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33be191d05a54ec120e4667375e2ad49fe506b846463df384460ab801c7ae5dc" +dependencies = [ + "concurrent-queue", + "fastrand", + "futures-lite", + "log", + "nb-connect", + "once_cell", + "parking", + "polling", + "vec-arena", + "waker-fn", +] + +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-std" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c92085acfce8b32e5b261d0b59b8f3309aee69fea421ea3f271f8b93225754f" dependencies = [ "async-attributes", - "async-task", + "async-global-executor", + "async-io", + "async-mutex", + "async-task 3.0.0", + "blocking", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", + "futures-lite", + "gloo-timers", "kv-log-macro", "log", "memchr", @@ -67,7 +138,6 @@ dependencies = [ "pin-project-lite", "pin-utils", "slab", - "smol", "wasm-bindgen-futures", ] @@ -77,6 +147,12 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" +[[package]] +name = "async-task" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ab27c1aa62945039e44edaeee1dc23c74cc0c303dd5fe0fb462a184f1c3a518" + [[package]] name = "async-tls" version = "0.7.0" @@ -84,7 +160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" dependencies = [ "futures", - "rustls", + "rustls 0.17.0", "webpki", "webpki-roots", ] @@ -119,10 +195,16 @@ dependencies = [ ] [[package]] -name = "autocfg" +name = "atomic-waker" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "base64" @@ -132,15 +214,15 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "bincode" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf" +checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" dependencies = [ "byteorder", "serde", @@ -159,7 +241,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" dependencies = [ "either", - "radium", + "radium 0.3.0", +] + +[[package]] +name = "bitvec" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2838fdd79e8776dbe07a106c784b0f8dda571a21b2750a092cc4cbaa653c8e" +dependencies = [ + "funty", + "radium 0.4.1", + "wyz", ] [[package]] @@ -175,43 +268,39 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding", - "byte-tools", - "byteorder", "generic-array", ] [[package]] name = "block-padding" -version = "0.1.5" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "blocking" -version = "0.4.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d17efb70ce4421e351d61aafd90c16a20fb5bfe339fcdc32a86816280e62ce0" +checksum = "2640778f8053e72c11f621b0a5175a0560a269282aa98ed85107773ab8e2a556" dependencies = [ - "futures-channel", - "futures-util", + "async-channel", + "atomic-waker", + "fastrand", + "futures-lite", "once_cell", - "parking", "waker-fn", ] [[package]] name = "bumpalo" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" [[package]] name = "byte-slice-cast" @@ -219,12 +308,6 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.3.4" @@ -233,21 +316,21 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "bytes" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "cache-padded" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24508e28c677875c380c20f4d28124fab6f8ed4ef929a1397d7b1a31e92f1005" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" [[package]] name = "cc" -version = "1.0.41" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dae9c4b8fedcae85592ba623c4fd08cfdab3e3b72d6df780c6ead964a69bfff" +checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" [[package]] name = "cfg-if" @@ -257,19 +340,21 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chrono" -version = "0.4.13" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" +checksum = "d021fddb7bd3e734370acfa4a83f34095571d8570c039f1420d77540f68d5772" dependencies = [ + "libc", "num-integer", "num-traits", "time", + "winapi 0.3.9", ] [[package]] name = "coins-ledger" version = "0.1.0" -source = "git+https://github.com/summa-tx/bitcoins-rs#44f68c6a40dbaf9dfe4c84182c107e6bc749bf1f" +source = "git+https://github.com/summa-tx/bitcoins-rs#84f3fa74e28b5991fc8c151d145e8473c71027ff" dependencies = [ "async-trait", "blake2b_simd", @@ -291,13 +376,19 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.1.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83c06aff61f2d899eb87c379df3cbf7876f14471dcab474e0b6dc90ab96c080" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" dependencies = [ "cache-padded", ] +[[package]] +name = "const-oid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d9162b7289a46e86208d6af2c686ca5bfde445878c41a458a9fac706252d0b" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -320,6 +411,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + [[package]] name = "crossbeam-utils" version = "0.7.2" @@ -339,19 +436,19 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-mac" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +checksum = "58bcd97a54c7ca5ce2f6eb16f6bede5b0ab5f0055fedc17d2f0b4466e21671ca" dependencies = [ "generic-array", - "subtle 1.0.0", + "subtle", ] [[package]] name = "curl" -version = "0.4.29" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "762e34611d2d5233a506a79072be944fddd057db2f18e04c0d6fa79e3fd466fd" +checksum = "78baca05127a115136a9898e266988fc49ca7ea2c839f60fc6e1fc9df1599168" dependencies = [ "curl-sys", "libc", @@ -359,14 +456,14 @@ dependencies = [ "openssl-sys", "schannel", "socket2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "curl-sys" -version = "0.4.31+curl-7.70.0" +version = "0.4.36+curl-7.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcd62757cc4f5ab9404bc6ca9f0ae447e729a1403948ce5106bd588ceac6a3b0" +checksum = "68cad94adeb0c16558429c3c34a607acc9ea58e09a7b66310aabc9788fc5d721" dependencies = [ "cc", "libc", @@ -374,44 +471,72 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "digest" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ "generic-array", ] [[package]] name = "dtoa" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" +checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" + +[[package]] +name = "ecdsa" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a7c278cc833033b4322122e05b99dbc5a2a2a9bb2c51534ff1f4899c7802d66" +dependencies = [ + "elliptic-curve", + "hmac", + "signature", +] [[package]] name = "either" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "elliptic-curve" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e7e174baa250269c92f2e0d59abaeb14c7d8072abd130dee996cc61141825a" +dependencies = [ + "bitvec 0.18.4", + "const-oid", + "digest", + "ff", + "generic-array", + "group", + "rand_core", + "subtle", + "zeroize", +] [[package]] name = "encoding_rs" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" +checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" dependencies = [ "cfg-if", ] [[package]] name = "ethabi-next" -version = "12.0.0" +version = "12.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1190707a051f20d9d966b187da7eaa4fa3f2a293911cdcb8541e76724980ac1b" +checksum = "523719389cb738dda51fb8d22c96960e192da6263cdf1e08e7dc8c59de4cb032" dependencies = [ "ethereum-types", "rustc-hex", @@ -519,16 +644,20 @@ version = "0.1.3" dependencies = [ "arrayvec", "bincode", + "ecdsa", + "elliptic-curve", "ethabi-next", "ethereum-types", "ethers", + "generic-array", "glob", - "libsecp256k1", + "k256", "rand", "rlp", "rustc-hex", "serde", "serde_json", + "sha2", "thiserror", "tiny-keccak 2.0.2", ] @@ -594,16 +723,27 @@ dependencies = [ ] [[package]] -name = "fake-simd" -version = "0.1.2" +name = "event-listener" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" [[package]] name = "fastrand" -version = "1.3.2" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b90eb1dec02087df472ab9f0db65f27edaa654a746830042688bcc2eaf68090f" +checksum = "5c85295147490b8fcf2ea3d104080a105a8b2c63f9c319e82c02d8e952388919" + +[[package]] +name = "ff" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01646e077d4ebda82b73f1bca002ea1e91561a77df2431a9e79729bcc31950ef" +dependencies = [ + "bitvec 0.18.4", + "rand_core", + "subtle", +] [[package]] name = "fixed-hash" @@ -654,6 +794,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "funty" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ba62103ce691c2fd80fbae2213dfdda9ce60804973ac6b6e97de818ea7f52c8" + [[package]] name = "futures" version = "0.3.5" @@ -702,6 +848,21 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" +[[package]] +name = "futures-lite" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0db18c5f58083b54b0c416638ea73066722c2815c1e54dd8ba85ee3def593c3a" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.5" @@ -757,22 +918,23 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.12.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", + "version_check", ] [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] @@ -782,10 +944,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] -name = "h2" -version = "0.2.5" +name = "gloo-timers" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "group" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc11f9f5fbf1943b48ae7c2bf6846e7d827a512d1be4f23af708f5ca5d01dde1" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" dependencies = [ "bytes", "fnv", @@ -794,17 +980,23 @@ dependencies = [ "futures-util", "http", "indexmap", - "log", "slab", "tokio", "tokio-util", + "tracing", ] [[package]] -name = "hermit-abi" -version = "0.1.14" +name = "hashbrown" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" + +[[package]] +name = "hermit-abi" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" dependencies = [ "libc", ] @@ -822,25 +1014,14 @@ dependencies = [ [[package]] name = "hmac" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +checksum = "deae6d9dbb35ec2c502d62b8f7b1c000a0822c3b0794ba36b3149c0a1c840dff" dependencies = [ "crypto-mac", "digest", ] -[[package]] -name = "hmac-drbg" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" -dependencies = [ - "digest", - "generic-array", - "hmac", -] - [[package]] name = "http" version = "0.2.1" @@ -869,10 +1050,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] -name = "hyper" -version = "0.13.6" +name = "httpdate" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] +name = "hyper" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" dependencies = [ "bytes", "futures-channel", @@ -882,27 +1069,27 @@ dependencies = [ "http", "http-body", "httparse", + "httpdate", "itoa", - "log", "pin-project", "socket2", - "time", "tokio", "tower-service", + "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" +checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6" dependencies = [ "bytes", "futures-util", "hyper", "log", - "rustls", + "rustls 0.18.1", "tokio", "tokio-rustls", "webpki", @@ -948,11 +1135,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.3.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" dependencies = [ "autocfg", + "hashbrown", ] [[package]] @@ -974,20 +1162,43 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "0.4.5" +name = "ipnet" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" + +[[package]] +name = "itoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "js-sys" -version = "0.3.40" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" +checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.5.5" +source = "git+https://github.com/RustCrypto/elliptic-curves#8845cc09dc55ba3fa41ffa2750d799cf6a23d405" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sha3", +] + +[[package]] +name = "keccak" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -1000,9 +1211,9 @@ dependencies = [ [[package]] name = "kv-log-macro" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ff57d6d215f7ca7eb35a9a64d656ba4d9d2bef114d741dc08048e75e2f5d418" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" dependencies = [ "log", ] @@ -1015,31 +1226,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.71" +version = "0.2.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" - -[[package]] -name = "libsecp256k1" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" -dependencies = [ - "arrayref", - "crunchy", - "digest", - "hmac-drbg", - "rand", - "sha2", - "subtle 2.2.3", - "typenum", -] +checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" [[package]] name = "libz-sys" -version = "1.0.25" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655" dependencies = [ "cc", "libc", @@ -1134,14 +1329,24 @@ dependencies = [ ] [[package]] -name = "net2" -version = "0.2.34" +name = "nb-connect" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +checksum = "e847c76b390f44529c2071ef06d0b52fbb4bdb04cc8987a5cfa63954c000abca" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "net2" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" dependencies = [ "cfg-if", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1188,15 +1393,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" [[package]] name = "opaque-debug" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" @@ -1233,21 +1438,21 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "1.3.0" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329c8f7f4244ddb5c37c103641027a76c530e65e8e4b8240b29f81ea40508b17" +checksum = "7c740e5fbcb6847058b40ac7e5574766c6388f585e184d769910fe0d3a2ca861" dependencies = [ "arrayvec", - "bitvec", + "bitvec 0.17.4", "byte-slice-cast", "serde", ] [[package]] name = "parking" -version = "1.0.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4029bc3504a62d92e42f30b9095fdef73b8a0b2a06aa41ce2935143b05a1a06" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "percent-encoding" @@ -1257,18 +1462,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "0.4.20" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75373ff9037d112bb19bc61333a06a159eaeb217660dcfbea7d88e1db823919" +checksum = "f48fad7cfbff853437be7cf54d7b993af21f53be7f0988cbfe4a51535aa77205" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.20" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b4b44893d3c370407a1d6a5cfde7c41ae0478e31c516c85f67eb3adc51be6d" +checksum = "24c6d293bdd3ca5a1697997854c6cf7855e43fb6a0ba1c47af57a5bcafd158ae" dependencies = [ "proc-macro2", "quote", @@ -1277,9 +1482,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df32da11d84f3a7d70205549562966279adb900e080fad3dccd8e64afccf0ad" +checksum = "71f349a4f0e70676ffb2dbafe16d0c992382d02f0a952e3ddf584fc289dac6b3" [[package]] name = "pin-utils" @@ -1289,15 +1494,28 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" + +[[package]] +name = "polling" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0720e0b9ea9d52451cf29d3413ba8a9303f8815d9d9653ef70e03ff73e65566" +dependencies = [ + "cfg-if", + "libc", + "log", + "wepoll-sys-stjepang", + "winapi 0.3.9", +] [[package]] name = "ppv-lite86" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" [[package]] name = "primitive-types" @@ -1314,30 +1532,30 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.16" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" +checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" [[package]] name = "proc-macro-nested" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.17" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101" +checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" dependencies = [ "unicode-xid", ] [[package]] name = "quote" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ "proc-macro2", ] @@ -1348,6 +1566,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" +[[package]] +name = "radium" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64de9a0c5361e034f1aefc9f71a86871ec870e766fe31a009734a989b329286a" + [[package]] name = "rand" version = "0.7.3" @@ -1391,9 +1615,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "regex" @@ -1419,16 +1643,16 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "reqwest" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680" +checksum = "e9eaa17ac5d7b838b7503d118fa16ad88f440498bf9ffe5424e621f93190d61e" dependencies = [ - "base64 0.12.1", + "base64 0.12.3", "bytes", "encoding_rs", "futures-core", @@ -1437,6 +1661,7 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", + "ipnet", "js-sys", "lazy_static", "log", @@ -1444,7 +1669,7 @@ dependencies = [ "mime_guess", "percent-encoding", "pin-project-lite", - "rustls", + "rustls 0.18.1", "serde", "serde_json", "serde_urlencoded", @@ -1460,17 +1685,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.12" +version = "0.16.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" +checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" dependencies = [ "cc", - "lazy_static", "libc", + "once_cell", "spin", "untrusted", "web-sys", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1502,10 +1727,23 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.4" +name = "rustls" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +dependencies = [ + "base64 0.12.3", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "schannel" @@ -1514,15 +1752,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.8", + "winapi 0.3.9", ] -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" - [[package]] name = "sct" version = "0.6.0" @@ -1558,9 +1790,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.112" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243" +checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" dependencies = [ "serde_derive", ] @@ -1579,9 +1811,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.112" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf0343ce212ac0d3d6afd9391ac8e9c9efe06b533c8d33f660f6390cc4093f57" +checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" dependencies = [ "proc-macro2", "quote", @@ -1590,9 +1822,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.55" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" +checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" dependencies = [ "itoa", "ryu", @@ -1613,71 +1845,68 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" dependencies = [ "block-buffer", + "cfg-if", + "cpuid-bool", "digest", - "fake-simd", "opaque-debug", ] [[package]] name = "sha2" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +dependencies = [ + "block-buffer", + "cfg-if", + "cpuid-bool", + "digest", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" dependencies = [ "block-buffer", "digest", - "fake-simd", + "keccak", "opaque-debug", ] +[[package]] +name = "signature" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "slab" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -[[package]] -name = "smallvec" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" - -[[package]] -name = "smol" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620cbb3c6e34da57d3a248cda0cd01cd5848164dc062e764e65d06fe3ea7aed5" -dependencies = [ - "async-task", - "blocking", - "concurrent-queue", - "fastrand", - "futures-io", - "futures-util", - "libc", - "once_cell", - "scoped-tls", - "slab", - "socket2", - "wepoll-sys-stjepang", - "winapi 0.3.8", -] - [[package]] name = "socket2" -version = "0.3.12" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" dependencies = [ "cfg-if", "libc", "redox_syscall", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1694,21 +1923,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subtle" -version = "1.0.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - -[[package]] -name = "subtle" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" +checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" [[package]] name = "syn" -version = "1.0.29" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb37da98a55b1d08529362d9cbb863be17556873df2585904ab9d2bc951291d0" +checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" dependencies = [ "proc-macro2", "quote", @@ -1726,23 +1949,23 @@ dependencies = [ "rand", "redox_syscall", "remove_dir_all", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "thiserror" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" +checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" +checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ "proc-macro2", "quote", @@ -1760,12 +1983,13 @@ dependencies = [ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", - "winapi 0.3.8", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi 0.3.9", ] [[package]] @@ -1787,10 +2011,16 @@ dependencies = [ ] [[package]] -name = "tokio" -version = "0.2.21" +name = "tinyvec" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" + +[[package]] +name = "tokio" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ "bytes", "fnv", @@ -1827,12 +2057,12 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.13.1" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" +checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" dependencies = [ "futures-core", - "rustls", + "rustls 0.18.1", "tokio", "webpki", ] @@ -1858,18 +2088,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] -name = "try-lock" -version = "0.2.2" +name = "tracing" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" +dependencies = [ + "cfg-if", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" +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 = "tungstenite" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5c7d464221cb0b538a1cd12f6d9127ed1e6bb7f3ffca98fb3cd4c6e3af8175c" +checksum = "f0308d80d86700c5878b9ef6321f020f29b1bb9d5ff3cab25e75e23f3a492a23" dependencies = [ - "base64 0.12.1", + "base64 0.12.3", "byteorder", "bytes", "http", @@ -1891,9 +2141,9 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" +checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" dependencies = [ "byteorder", "crunchy", @@ -1921,18 +2171,18 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" dependencies = [ - "smallvec", + "tinyvec", ] [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "untrusted" @@ -1959,9 +2209,15 @@ checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" [[package]] name = "vcpkg" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" +checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" + +[[package]] +name = "vec-arena" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" [[package]] name = "version_check" @@ -1977,9 +2233,9 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "waker-fn" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9571542c2ce85ce642e6b58b3364da2fb53526360dfb7c211add4f5c23105ff7" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" [[package]] name = "want" @@ -1998,10 +2254,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] -name = "wasm-bindgen" -version = "0.2.63" +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ "cfg-if", "serde", @@ -2011,9 +2273,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" dependencies = [ "bumpalo", "lazy_static", @@ -2026,9 +2288,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.13" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" +checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" dependencies = [ "cfg-if", "js-sys", @@ -2038,9 +2300,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2048,9 +2310,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ "proc-macro2", "quote", @@ -2061,15 +2323,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.63" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" [[package]] name = "web-sys" -version = "0.3.40" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17" +checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" dependencies = [ "js-sys", "wasm-bindgen", @@ -2077,9 +2339,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f50e1972865d6b1adb54167d1c8ed48606004c2c9d0ea5f1eeb34d95e863ef" +checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" dependencies = [ "ring", "untrusted", @@ -2096,9 +2358,9 @@ dependencies = [ [[package]] name = "wepoll-sys-stjepang" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fd319e971980166b53e17b1026812ad66c6b54063be879eb182342b55284694" +checksum = "1fdfbb03f290ca0b27922e8d48a0997b4ceea12df33269b9f75e713311eb178d" dependencies = [ "cc", ] @@ -2111,9 +2373,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", @@ -2143,7 +2405,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2155,3 +2417,15 @@ dependencies = [ "winapi 0.2.8", "winapi-build", ] + +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + +[[package]] +name = "zeroize" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a" diff --git a/ethers-contract/ethers-contract-abigen/src/contract/methods.rs b/ethers-contract/ethers-contract-abigen/src/contract/methods.rs index dc13fd35..04684ecd 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract/methods.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract/methods.rs @@ -115,7 +115,7 @@ mod tests { // no inputs let params = vec![]; let token_stream = expand_inputs_call_arg(¶ms); - assert_eq!(token_stream.to_string(), "( )"); + assert_eq!(token_stream.to_string(), "()"); // single input let params = vec![Param { @@ -137,7 +137,7 @@ mod tests { }, ]; let token_stream = expand_inputs_call_arg(¶ms); - assert_eq!(token_stream.to_string(), "( arg_a , arg_b , )"); + assert_eq!(token_stream.to_string(), "(arg_a , arg_b ,)"); // three inputs let params = vec![ @@ -155,7 +155,7 @@ mod tests { }, ]; let token_stream = expand_inputs_call_arg(¶ms); - assert_eq!(token_stream.to_string(), "( arg_a , arg_b , arg_c , )"); + assert_eq!(token_stream.to_string(), "(arg_a , arg_b , arg_c ,)"); } #[test] diff --git a/ethers-core/Cargo.toml b/ethers-core/Cargo.toml index c926e5e6..818a74e2 100644 --- a/ethers-core/Cargo.toml +++ b/ethers-core/Cargo.toml @@ -17,10 +17,13 @@ ethabi = { package = "ethabi-next", version = "12.0.0", default-features = false arrayvec = { version = "0.5.1", default-features = false } # crypto -secp256k1 = { package = "libsecp256k1", version = "0.3.5" } +ecdsa = { version = "0.8.0", features = ["std"] } +elliptic-curve = { version = "0.6.1", features = ["arithmetic"] } +generic-array = "0.14.4" +k256 = { git = "https://github.com/RustCrypto/elliptic-curves", version = "0.5.2", features = ["keccak256", "ecdsa"] } rand = "0.7.2" tiny-keccak = { version = "2.0.2", default-features = false } - +sha2 = { version = "0.9.1" } # misc serde = { version = "1.0.110", default-features = false, features = ["derive"] } diff --git a/ethers-core/src/lib.rs b/ethers-core/src/lib.rs index 86bc6fa2..42415671 100644 --- a/ethers-core/src/lib.rs +++ b/ethers-core/src/lib.rs @@ -49,5 +49,5 @@ pub mod utils; // re-export rand to avoid potential confusion when there's rand version mismatches pub use rand; -// re-export libsecp -pub use secp256k1; +// re-export k256 +pub use k256; diff --git a/ethers-core/src/types/crypto/hash.rs b/ethers-core/src/types/crypto/hash.rs new file mode 100644 index 00000000..6d43b0a9 --- /dev/null +++ b/ethers-core/src/types/crypto/hash.rs @@ -0,0 +1,87 @@ +//! This is a helper module used to pass the pre-hashed message for signing to the +//! `sign_digest` methods of K256. +use crate::types::H256; +use elliptic_curve::consts::U64; +use k256::ecdsa::signature::digest::{ + generic_array::GenericArray, BlockInput, Digest, FixedOutput, Output, Reset, Update, +}; + +pub type Sha256Proxy = ProxyDigest; + +#[derive(Clone)] +pub enum ProxyDigest { + Proxy(Output), + Digest(D), +} + +impl From for ProxyDigest +where + GenericArray::OutputSize>: Copy, +{ + fn from(src: H256) -> Self { + ProxyDigest::Proxy(*GenericArray::from_slice(src.as_bytes())) + } +} + +impl Default for ProxyDigest { + fn default() -> Self { + ProxyDigest::Digest(D::new()) + } +} + +impl Update for ProxyDigest { + // we update only if we are digest + fn update(&mut self, data: impl AsRef<[u8]>) { + match self { + ProxyDigest::Digest(ref mut d) => { + d.update(data); + } + ProxyDigest::Proxy(..) => { + unreachable!("can not update if we are proxy"); + } + } + } + + // we chain only if we are digest + fn chain(self, data: impl AsRef<[u8]>) -> Self { + match self { + ProxyDigest::Digest(d) => ProxyDigest::Digest(d.chain(data)), + ProxyDigest::Proxy(..) => { + unreachable!("can not update if we are proxy"); + } + } + } +} + +impl Reset for ProxyDigest { + // make new one + fn reset(&mut self) { + *self = Self::default(); + } +} + +// Use Sha256 with 512 bit blocks +impl BlockInput for ProxyDigest { + type BlockSize = U64; +} + +impl FixedOutput for ProxyDigest { + // we default to the output of the original digest + type OutputSize = D::OutputSize; + + fn finalize_into(self, out: &mut GenericArray) { + match self { + ProxyDigest::Digest(d) => { + *out = d.finalize(); + } + ProxyDigest::Proxy(p) => { + *out = p; + } + } + } + + fn finalize_into_reset(&mut self, out: &mut GenericArray) { + let s = std::mem::take(self); + s.finalize_into(out); + } +} diff --git a/ethers-core/src/types/crypto/keys.rs b/ethers-core/src/types/crypto/keys.rs index 55361133..2f4a78b5 100644 --- a/ethers-core/src/types/crypto/keys.rs +++ b/ethers-core/src/types/crypto/keys.rs @@ -1,15 +1,11 @@ +use super::hash::Sha256Proxy; use crate::{ types::{Address, Signature, TransactionRequest, H256}, utils::{hash_message, keccak256}, }; -use rand::Rng; +use rand::{CryptoRng, Rng}; use rustc_hex::FromHex; -use secp256k1::{ - self as Secp256k1, - util::{COMPRESSED_PUBLIC_KEY_SIZE, SECRET_KEY_SIZE}, - Error as SecpError, Message, PublicKey as PubKey, RecoveryId, SecretKey, -}; use serde::{ de::Error as DeserializeError, de::{SeqAccess, Visitor}, @@ -18,9 +14,28 @@ use serde::{ }; use std::{fmt, ops::Deref, str::FromStr}; +use k256::{ + ecdsa::{ + recoverable::{Id as RecoveryId, Signature as RecoverableSignature}, + signature::DigestSigner, + SigningKey, + }, + elliptic_curve::{error::Error as EllipticCurveError, FieldBytes}, + EncodedPoint as K256PublicKey, Secp256k1, SecretKey as K256SecretKey, +}; + +const SECRET_KEY_SIZE: usize = 32; +const COMPRESSED_PUBLIC_KEY_SIZE: usize = 33; + /// A private key on Secp256k1 -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct PrivateKey(pub(super) SecretKey); +#[derive(Clone, Debug)] +pub struct PrivateKey(pub(super) K256SecretKey); + +impl PartialEq for PrivateKey { + fn eq(&self, other: &Self) -> bool { + self.0.to_bytes().eq(&other.0.to_bytes()) + } +} impl Serialize for PrivateKey { fn serialize(&self, serializer: S) -> Result @@ -28,8 +43,8 @@ impl Serialize for PrivateKey { S: Serializer, { let mut seq = serializer.serialize_tuple(SECRET_KEY_SIZE)?; - for e in &self.0.serialize() { - seq.serialize_element(e)?; + for e in self.0.to_bytes() { + seq.serialize_element(&e)?; } seq.end() } @@ -42,26 +57,26 @@ impl<'de> Deserialize<'de> for PrivateKey { { let bytes = <[u8; SECRET_KEY_SIZE]>::deserialize(deserializer)?; Ok(PrivateKey( - SecretKey::parse(&bytes).map_err(DeserializeError::custom)?, + K256SecretKey::from_bytes(&bytes).map_err(DeserializeError::custom)?, )) } } impl FromStr for PrivateKey { - type Err = SecpError; + type Err = EllipticCurveError; fn from_str(src: &str) -> Result { let src = src .from_hex::>() .expect("invalid hex when reading PrivateKey"); - let sk = SecretKey::parse_slice(&src)?; + let sk = K256SecretKey::from_bytes(&src)?; Ok(PrivateKey(sk)) } } impl PrivateKey { - pub fn new(rng: &mut R) -> Self { - PrivateKey(SecretKey::random(rng)) + pub fn new(rng: &mut R) -> Self { + PrivateKey(K256SecretKey::random(rng)) } /// Sign arbitrary string data. @@ -78,9 +93,7 @@ impl PrivateKey { let message = message.as_ref(); let message_hash = hash_message(message); - let sig_message = - Message::parse_slice(message_hash.as_bytes()).expect("hash is non-zero 32-bytes; qed"); - self.sign_with_eip155(&sig_message, None) + self.sign_hash_with_eip155(message_hash, None) } /// RLP encodes and then signs the stransaction. @@ -95,39 +108,41 @@ impl PrivateKey { /// If `tx.to` is an ENS name. The caller MUST take care of name resolution before /// calling this function. pub fn sign_transaction(&self, tx: &TransactionRequest, chain_id: Option) -> Signature { - // Get the transaction's sighash let sighash = tx.sighash(chain_id); - let message = - Message::parse_slice(sighash.as_bytes()).expect("hash is non-zero 32-bytes; qed"); - // Sign it (with replay protection if applicable) - self.sign_with_eip155(&message, chain_id) + self.sign_hash_with_eip155(sighash, chain_id) } - fn sign_with_eip155(&self, message: &Message, chain_id: Option) -> Signature { - let (signature, recovery_id) = Secp256k1::sign(message, &self.0); + fn sign_hash_with_eip155(&self, hash: H256, chain_id: Option) -> Signature { + let signing_key = SigningKey::new(&self.0.to_bytes()).expect("invalid secret key"); - let v = to_eip155_v(recovery_id, chain_id); - let r = H256::from_slice(&signature.r.b32()); - let s = H256::from_slice(&signature.s.b32()); + let recoverable_sig: RecoverableSignature = + signing_key.sign_digest(Sha256Proxy::from(hash)); - Signature { v, r, s } + let v = to_eip155_v(recoverable_sig.recovery_id(), chain_id); + + let r_bytes: FieldBytes = recoverable_sig.r().into(); + let s_bytes: FieldBytes = recoverable_sig.s().into(); + let r = H256::from_slice(&r_bytes.as_slice()); + let s = H256::from_slice(&s_bytes.as_slice()); + + Signature { r, s, v } } } /// Applies [EIP155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md) fn to_eip155_v(recovery_id: RecoveryId, chain_id: Option) -> u64 { - let standard_v = recovery_id.serialize() as u64; + let standard_v: u8 = recovery_id.into(); if let Some(chain_id) = chain_id { // When signing with a chain ID, add chain replay protection. - standard_v + 35 + chain_id * 2 + (standard_v as u64) + 35 + chain_id * 2 } else { // Otherwise, convert to 'Electrum' notation. - standard_v + 27 + (standard_v as u64) + 27 } } impl Deref for PrivateKey { - type Target = SecretKey; + type Target = K256SecretKey; fn deref(&self) -> &Self::Target { &self.0 @@ -136,11 +151,11 @@ impl Deref for PrivateKey { /// A secp256k1 Public Key #[derive(Clone, Debug, PartialEq, Eq)] -pub struct PublicKey(pub(super) PubKey); +pub struct PublicKey(pub(super) K256PublicKey); -impl From for PublicKey { +impl From for PublicKey { /// Gets the public address of a private key. - fn from(src: PubKey) -> PublicKey { + fn from(src: K256PublicKey) -> PublicKey { PublicKey(src) } } @@ -148,7 +163,7 @@ impl From for PublicKey { impl From<&PrivateKey> for PublicKey { /// Gets the public address of a private key. fn from(src: &PrivateKey) -> PublicKey { - let public_key = PubKey::from_secret_key(src); + let public_key = K256PublicKey::from_secret_key(src, false); PublicKey(public_key) } } @@ -162,7 +177,7 @@ impl From<&PrivateKey> for PublicKey { /// computing the hash. impl From<&PublicKey> for Address { fn from(src: &PublicKey) -> Address { - let public_key = src.0.serialize(); + let public_key = src.0.as_bytes(); debug_assert_eq!(public_key[0], 0x04); let hash = keccak256(&public_key[1..]); @@ -196,7 +211,8 @@ impl Serialize for PublicKey { S: Serializer, { let mut seq = serializer.serialize_tuple(COMPRESSED_PUBLIC_KEY_SIZE)?; - for e in self.0.serialize_compressed().iter() { + + for e in self.0.compress().as_bytes().iter() { seq.serialize_element(e)?; } seq.end() @@ -228,9 +244,15 @@ impl<'de> Deserialize<'de> for PublicKey { .ok_or_else(|| DeserializeError::custom("could not read bytes"))?; } - Ok(PublicKey( - PubKey::parse_compressed(&bytes).map_err(DeserializeError::custom)?, - )) + let pub_key = K256PublicKey::from_bytes(&bytes[..]) + .map_err(|_| DeserializeError::custom("parse pub key"))?; + + let uncompressed_pub_key = pub_key.decompress(); + if uncompressed_pub_key.is_some().into() { + Ok(PublicKey(uncompressed_pub_key.unwrap())) + } else { + Err(DeserializeError::custom("parse pub key")) + } } } @@ -241,40 +263,86 @@ impl<'de> Deserialize<'de> for PublicKey { #[cfg(test)] mod tests { use super::*; - use rustc_hex::FromHex; #[test] fn serde() { for _ in 0..10 { let key = PrivateKey::new(&mut rand::thread_rng()); let serialized = bincode::serialize(&key).unwrap(); - assert_eq!(serialized, &key.0.serialize()); + assert_eq!(serialized.as_slice(), key.0.to_bytes().as_slice()); let de: PrivateKey = bincode::deserialize(&serialized).unwrap(); assert_eq!(key, de); let public = PublicKey::from(&key); + println!("public = {:?}", public); + let serialized = bincode::serialize(&public).unwrap(); - assert_eq!(&serialized[..], public.0.serialize_compressed().as_ref()); let de: PublicKey = bincode::deserialize(&serialized).unwrap(); assert_eq!(public, de); } } #[test] - fn signs_data() { - // test vector taken from: - // https://web3js.readthedocs.io/en/v1.2.2/web3-eth-accounts.html#sign + #[cfg(not(feature = "celo"))] + fn signs_tx() { + use crate::types::Address; + // retrieved test vector from: + // https://web3js.readthedocs.io/en/v1.2.0/web3-eth-accounts.html#eth-accounts-signtransaction + let tx = TransactionRequest { + from: None, + to: Some( + "F0109fC8DF283027b6285cc889F5aA624EaC1F55" + .parse::
() + .unwrap() + .into(), + ), + value: Some(1_000_000_000.into()), + gas: Some(2_000_000.into()), + nonce: Some(0.into()), + gas_price: Some(21_000_000_000u128.into()), + data: None, + }; + let chain_id = 1; let key: PrivateKey = "4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318" .parse() .unwrap(); - let sign = key.sign("Some data"); + let sig = key.sign_transaction(&tx, Some(chain_id)); + let sighash = tx.sighash(Some(chain_id)); + assert!(sig.verify(sighash, Address::from(key)).is_ok()); + } + + #[test] + fn key_to_address() { + let priv_key: PrivateKey = + "0000000000000000000000000000000000000000000000000000000000000001" + .parse() + .unwrap(); + let addr: Address = priv_key.into(); assert_eq!( - sign.to_vec(), - "b91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a0291c" - .from_hex::>() - .unwrap() + addr, + Address::from_str("7E5F4552091A69125d5DfCb7b8C2659029395Bdf").expect("Decoding failed") + ); + + let priv_key: PrivateKey = + "0000000000000000000000000000000000000000000000000000000000000002" + .parse() + .unwrap(); + let addr: Address = priv_key.into(); + assert_eq!( + addr, + Address::from_str("2B5AD5c4795c026514f8317c7a215E218DcCD6cF").expect("Decoding failed") + ); + + let priv_key: PrivateKey = + "0000000000000000000000000000000000000000000000000000000000000003" + .parse() + .unwrap(); + let addr: Address = priv_key.into(); + assert_eq!( + addr, + Address::from_str("6813Eb9362372EEF6200f3b1dbC3f819671cBA69").expect("Decoding failed") ); } } diff --git a/ethers-core/src/types/crypto/mod.rs b/ethers-core/src/types/crypto/mod.rs index 20ffaa34..d1bd89fa 100644 --- a/ethers-core/src/types/crypto/mod.rs +++ b/ethers-core/src/types/crypto/mod.rs @@ -2,4 +2,6 @@ mod keys; pub use keys::{PrivateKey, PublicKey}; mod signature; -pub use signature::{Signature, SignatureError}; +pub use signature::Signature; + +mod hash; diff --git a/ethers-core/src/types/crypto/signature.rs b/ethers-core/src/types/crypto/signature.rs index 9a70d7ec..0de3cb43 100644 --- a/ethers-core/src/types/crypto/signature.rs +++ b/ethers-core/src/types/crypto/signature.rs @@ -5,21 +5,22 @@ use crate::{ }; use rustc_hex::{FromHex, ToHex}; -use secp256k1::{ - self as Secp256k1, Error as Secp256k1Error, Message, RecoveryId, - Signature as RecoverableSignature, -}; use serde::{Deserialize, Serialize}; use std::{convert::TryFrom, fmt, str::FromStr}; use thiserror::Error; +use elliptic_curve::consts::U32; +use generic_array::GenericArray; +use k256::ecdsa::{ + recoverable::{Id as RecoveryId, Signature as RecoverableSignature}, + Error as K256SignatureError, Signature as K256Signature, +}; +use k256::EncodedPoint as K256PublicKey; + /// An error involving a signature. -#[derive(Clone, Debug, Error)] +#[derive(Debug, Error)] pub enum SignatureError { - /// Internal error inside the recovery - #[error(transparent)] - Secp256k1Error(#[from] Secp256k1Error), /// Invalid length, secp256k1 signatures are 65 bytes #[error("invalid signature length, got {0}, expected 65")] InvalidLength(usize), @@ -30,6 +31,12 @@ pub enum SignatureError { /// produced the signature did not match the expected address) #[error("Signature verification failed. Expected {0}, got {0}")] VerificationError(Address, Address), + /// Internal error during signature recovery + #[error(transparent)] + K256Error(#[from] K256SignatureError), + /// Error in recovering public key from signature + #[error("Public key recovery error")] + RecoveryError, } /// Recovery message data. @@ -92,22 +99,27 @@ impl Signature { RecoveryMessage::Data(ref message) => hash_message(message), RecoveryMessage::Hash(hash) => hash, }; - let message = Message::parse_slice(message_hash.as_bytes())?; - let (signature, recovery_id) = self.as_signature()?; - let public_key = Secp256k1::recover(&message, &signature, &recovery_id)?; + let (recoverable_sig, _recovery_id) = self.as_signature()?; + let verify_key = + recoverable_sig.recover_verify_key_from_digest_bytes(message_hash.as_ref().into())?; - Ok(PublicKey::from(public_key).into()) + let uncompressed_pub_key = K256PublicKey::from(&verify_key).decompress(); + if uncompressed_pub_key.is_some().into() { + Ok(PublicKey::from(uncompressed_pub_key.unwrap()).into()) + } else { + Err(SignatureError::RecoveryError) + } } /// Retrieves the recovery signature. fn as_signature(&self) -> Result<(RecoverableSignature, RecoveryId), SignatureError> { let recovery_id = self.recovery_id()?; let signature = { - let mut sig = [0u8; 64]; - sig[..32].copy_from_slice(self.r.as_bytes()); - sig[32..].copy_from_slice(self.s.as_bytes()); - RecoverableSignature::parse(&sig) + let gar: &GenericArray = GenericArray::from_slice(self.r.as_bytes()); + let gas: &GenericArray = GenericArray::from_slice(self.s.as_bytes()); + let sig = K256Signature::from_scalars(*gar, *gas)?; + RecoverableSignature::new(&sig, recovery_id)? }; Ok((signature, recovery_id)) @@ -116,7 +128,7 @@ impl Signature { /// Retrieve the recovery ID. fn recovery_id(&self) -> Result { let standard_v = normalize_recovery_id(self.v); - Ok(RecoveryId::parse(standard_v)?) + Ok(RecoveryId::new(standard_v)?) } /// Copies and serializes `self` into a new `Vec` with the recovery id included @@ -258,6 +270,23 @@ mod tests { assert_eq!(recovered2, address); } + #[test] + fn recover_web3_signature() { + // test vector taken from: + // https://web3js.readthedocs.io/en/v1.2.2/web3-eth-accounts.html#sign + let key: PrivateKey = "4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318" + .parse() + .unwrap(); + let address = Address::from(&key); + let our_signature = key.sign("Some data"); + let signature = Signature::from_str( + "b91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a0291c" + ).expect("could not parse signature"); + assert_eq!(our_signature.recover("Some data").unwrap(), address,); + assert_eq!(signature.recover("Some data").unwrap(), address); + assert_eq!(our_signature, signature); + } + #[test] fn to_vec() { let message = "Some data"; diff --git a/ethers-signers/src/ledger/types.rs b/ethers-signers/src/ledger/types.rs index 09c0c4d4..48076c16 100644 --- a/ethers-signers/src/ledger/types.rs +++ b/ethers-signers/src/ledger/types.rs @@ -33,9 +33,6 @@ pub enum LedgerError { #[error("Error when decoding UTF8 Response: {0}")] Utf8Error(#[from] std::str::Utf8Error), - - #[error(transparent)] - SignatureError(#[from] ethers_core::types::SignatureError), } pub const P1_FIRST: u8 = 0x00; diff --git a/ethers-signers/src/wallet.rs b/ethers-signers/src/wallet.rs index 1addf65a..3096342d 100644 --- a/ethers-signers/src/wallet.rs +++ b/ethers-signers/src/wallet.rs @@ -1,8 +1,8 @@ use crate::Signer; use ethers_core::{ - rand::Rng, - secp256k1, + k256::elliptic_curve::error::Error as K256Error, + rand::{CryptoRng, Rng}, types::{Address, PrivateKey, PublicKey, Signature, TransactionRequest}, }; @@ -77,7 +77,7 @@ impl Wallet { // TODO: Add support for mnemonic and encrypted JSON /// Creates a new random keypair seeded with the provided RNG - pub fn new(rng: &mut R) -> Self { + pub fn new(rng: &mut R) -> Self { let private_key = PrivateKey::new(rng); let public_key = PublicKey::from(&private_key); let address = Address::from(&private_key); @@ -133,7 +133,7 @@ impl From for Wallet { } impl FromStr for Wallet { - type Err = secp256k1::Error; + type Err = K256Error; fn from_str(src: &str) -> Result { Ok(PrivateKey::from_str(src)?.into())