diff --git a/Cargo.lock b/Cargo.lock index 7f4170c4f7..32254027da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -460,18 +460,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "auto_impl" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -505,12 +493,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - [[package]] name = "base58" version = "0.2.0" @@ -791,9 +773,6 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" -dependencies = [ - "serde", -] [[package]] name = "bzip2-sys" @@ -1070,12 +1049,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "core-foundation" version = "0.9.3" @@ -1451,18 +1424,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "crypto-bigint" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" -dependencies = [ - "generic-array 0.14.7", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -1668,16 +1629,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "der" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" -dependencies = [ - "const-oid", - "zeroize", -] - [[package]] name = "der-parser" version = "7.0.0" @@ -1754,10 +1705,8 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn 1.0.109", ] @@ -1792,7 +1741,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.4", - "const-oid", "crypto-common", "subtle", ] @@ -1900,24 +1848,10 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der 0.6.1", - "elliptic-curve 0.12.3", - "rfc6979 0.3.1", - "signature 1.6.4", -] - -[[package]] -name = "ecdsa" -version = "0.16.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" -dependencies = [ - "der 0.7.7", - "digest 0.10.6", - "elliptic-curve 0.13.5", - "rfc6979 0.4.0", - "signature 2.1.0", - "spki 0.7.2", + "der", + "elliptic-curve", + "rfc6979", + "signature", ] [[package]] @@ -1926,7 +1860,7 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature 1.6.4", + "signature", ] [[package]] @@ -1969,50 +1903,22 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ - "base16ct 0.1.1", - "crypto-bigint 0.4.9", - "der 0.6.1", + "base16ct", + "crypto-bigint", + "der", "digest 0.10.6", - "ff 0.12.1", + "ff", "generic-array 0.14.7", - "group 0.12.1", + "group", "hkdf", "pem-rfc7468", - "pkcs8 0.9.0", + "pkcs8", "rand_core 0.6.4", - "sec1 0.3.0", + "sec1", "subtle", "zeroize", ] -[[package]] -name = "elliptic-curve" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" -dependencies = [ - "base16ct 0.2.0", - "crypto-bigint 0.5.2", - "digest 0.10.6", - "ff 0.13.0", - "generic-array 0.14.7", - "group 0.13.0", - "pkcs8 0.10.2", - "rand_core 0.6.4", - "sec1 0.7.2", - "subtle", - "zeroize", -] - -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - [[package]] name = "enum-as-inner" version = "0.5.1" @@ -2104,13 +2010,7 @@ checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ "ethereum-types", "hex", - "once_cell", - "regex", - "serde", - "serde_json", "sha3", - "thiserror", - "uint", ] [[package]] @@ -2121,10 +2021,8 @@ checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ "crunchy", "fixed-hash", - "impl-codec", "impl-rlp", "impl-serde", - "scale-info", "tiny-keccak", ] @@ -2136,41 +2034,12 @@ checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ "ethbloom", "fixed-hash", - "impl-codec", "impl-rlp", "impl-serde", "primitive-types", - "scale-info", "uint", ] -[[package]] -name = "ethers-core" -version = "2.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6da5fa198af0d3be20c19192df2bd9590b92ce09a8421e793bec8851270f1b05" -dependencies = [ - "arrayvec 0.7.2", - "bytes", - "chrono", - "elliptic-curve 0.13.5", - "ethabi", - "generic-array 0.14.7", - "hex", - "k256 0.13.1", - "num_enum", - "open-fastrlp", - "rand 0.8.5", - "rlp", - "serde", - "serde_json", - "strum", - "tempfile", - "thiserror", - "tiny-keccak", - "unicode-xid", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -2250,16 +2119,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "fiat-crypto" version = "0.1.20" @@ -2348,21 +2207,6 @@ 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 = "fork-tree" version = "3.0.0" @@ -2541,7 +2385,7 @@ dependencies = [ "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", - "k256 0.11.6", + "k256", "log", "once_cell", "parity-scale-codec", @@ -2836,7 +2680,6 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", - "zeroize", ] [[package]] @@ -2933,18 +2776,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ - "ff 0.12.1", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff 0.13.0", + "ff", "rand_core 0.6.4", "subtle", ] @@ -3015,31 +2847,6 @@ dependencies = [ "ahash 0.8.3", ] -[[package]] -name = "headers" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" -dependencies = [ - "base64 0.13.1", - "bitflags", - "bytes", - "headers-core", - "http", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" -dependencies = [ - "http", -] - [[package]] name = "heck" version = "0.4.1" @@ -3227,19 +3034,6 @@ dependencies = [ "tokio-rustls", ] -[[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 = "iana-time-zone" version = "0.1.56" @@ -3291,16 +3085,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "if-addrs" version = "0.7.0" @@ -3657,21 +3441,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa 0.14.8", - "elliptic-curve 0.12.3", - "sha2 0.10.6", -] - -[[package]] -name = "k256" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" -dependencies = [ - "cfg-if", - "ecdsa 0.16.7", - "elliptic-curve 0.13.5", - "once_cell", + "ecdsa", + "elliptic-curve", "sha2 0.10.6", ] @@ -3816,7 +3587,7 @@ dependencies = [ "prost-build", "rand 0.8.5", "rw-stream-sink", - "sec1 0.3.0", + "sec1", "sha2 0.10.6", "smallvec", "thiserror", @@ -4515,12 +4286,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -4723,24 +4488,6 @@ dependencies = [ "rand 0.8.5", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "netlink-packet-core" version = "0.4.2" @@ -4948,27 +4695,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "object" version = "0.29.0" @@ -5026,75 +4752,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "open-fastrlp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" -dependencies = [ - "arrayvec 0.7.2", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", -] - -[[package]] -name = "open-fastrlp-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "openssl" -version = "0.10.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "overload" version = "0.1.1" @@ -5107,8 +4770,8 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ - "ecdsa 0.14.8", - "elliptic-curve 0.12.3", + "ecdsa", + "elliptic-curve", "sha2 0.10.6", ] @@ -5118,8 +4781,8 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" dependencies = [ - "ecdsa 0.14.8", - "elliptic-curve 0.12.3", + "ecdsa", + "elliptic-curve", "sha2 0.10.6", ] @@ -5216,7 +4879,6 @@ dependencies = [ "bstr", "ethabi", "ethereum-types", - "ethers-core", "extend", "frame-benchmarking", "frame-support", @@ -5243,7 +4905,6 @@ dependencies = [ "sp-tracing", "strum", "traced-test", - "web3", ] [[package]] @@ -5934,18 +5595,8 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der 0.6.1", - "spki 0.6.0", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der 0.7.7", - "spki 0.7.2", + "der", + "spki", ] [[package]] @@ -6581,43 +6232,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "reqwest" -version = "0.11.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" -dependencies = [ - "base64 0.21.0", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite 0.2.9", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - [[package]] name = "resolv-conf" version = "0.7.0" @@ -6634,21 +6248,11 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint 0.4.9", + "crypto-bigint", "hmac 0.12.1", "zeroize", ] -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac 0.12.1", - "subtle", -] - [[package]] name = "ring" version = "0.16.20" @@ -6671,21 +6275,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", - "rlp-derive", "rustc-hex", ] -[[package]] -name = "rlp-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rocksdb" version = "0.19.0" @@ -8043,24 +7635,10 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "base16ct 0.1.1", - "der 0.6.1", + "base16ct", + "der", "generic-array 0.14.7", - "pkcs8 0.9.0", - "subtle", - "zeroize", -] - -[[package]] -name = "sec1" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" -dependencies = [ - "base16ct 0.2.0", - "der 0.7.7", - "generic-array 0.14.7", - "pkcs8 0.10.2", + "pkcs8", "subtle", "zeroize", ] @@ -8071,16 +7649,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ - "secp256k1-sys 0.6.1", -] - -[[package]] -name = "secp256k1" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" -dependencies = [ - "secp256k1-sys 0.8.1", + "secp256k1-sys", ] [[package]] @@ -8092,15 +7661,6 @@ dependencies = [ "cc", ] -[[package]] -name = "secp256k1-sys" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" -dependencies = [ - "cc", -] - [[package]] name = "secrecy" version = "0.8.0" @@ -8188,18 +7748,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "sha-1" version = "0.9.8" @@ -8322,16 +7870,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "signature" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" -dependencies = [ - "digest 0.10.6", - "rand_core 0.6.4", -] - [[package]] name = "simba" version = "0.8.1" @@ -8649,7 +8187,7 @@ dependencies = [ "regex", "scale-info", "schnorrkel", - "secp256k1 0.24.3", + "secp256k1", "secrecy", "serde", "sp-core-hashing", @@ -8747,7 +8285,7 @@ dependencies = [ "libsecp256k1", "log", "parity-scale-codec", - "secp256k1 0.24.3", + "secp256k1", "sp-core", "sp-externalities", "sp-keystore", @@ -9112,17 +8650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der 0.6.1", -] - -[[package]] -name = "spki" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" -dependencies = [ - "base64ct", - "der 0.7.7", + "der", ] [[package]] @@ -9661,16 +9189,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.4" @@ -10598,54 +10116,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web3" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5388522c899d1e1c96a4c307e3797e0f697ba7c77dd8e0e625ecba9dd0342937" -dependencies = [ - "arrayvec 0.7.2", - "base64 0.21.0", - "bytes", - "derive_more", - "ethabi", - "ethereum-types", - "futures", - "futures-timer", - "headers", - "hex", - "idna 0.4.0", - "jsonrpc-core", - "log", - "once_cell", - "parking_lot 0.12.1", - "pin-project", - "reqwest", - "rlp", - "secp256k1 0.27.0", - "serde", - "serde_json", - "soketto", - "tiny-keccak", - "tokio", - "tokio-stream", - "tokio-util", - "url", - "web3-async-native-tls", -] - -[[package]] -name = "web3-async-native-tls" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6d8d1636b2627fe63518d5a9b38a569405d9c9bc665c43c9c341de57227ebb" -dependencies = [ - "native-tls", - "thiserror", - "tokio", - "url", -] - [[package]] name = "webpki" version = "0.21.4" @@ -10746,7 +10216,7 @@ dependencies = [ "ccm", "curve25519-dalek 3.2.0", "der-parser 8.2.0", - "elliptic-curve 0.12.3", + "elliptic-curve", "hkdf", "hmac 0.12.1", "log", @@ -10758,11 +10228,11 @@ dependencies = [ "rcgen 0.9.3", "ring", "rustls 0.19.1", - "sec1 0.3.0", + "sec1", "serde", "sha1", "sha2 0.10.6", - "signature 1.6.4", + "signature", "subtle", "thiserror", "tokio", diff --git a/Cargo.toml b/Cargo.toml index 250b1239e9..60d28b2b8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,10 +46,6 @@ serde = { version = "1.0.163", default-features = false, features = ["derive"] } scale-info = { version = "2.7", default-features = false, features = [ "derive", ] } -sha3 = "0.10.8" -ethers-core = "2.0.7" -web3 = "0.19.0" -getrandom = { version = "0.2", features = ["js"] } # Project Local Dependencies creditcoin-node-runtime = { path = "runtime" } @@ -105,7 +101,6 @@ sc-service = { branch = "pos-keep-history-polkadot-v0.9.41", git = "https://gith "test-helpers", ] } sp-api = { branch = "pos-keep-history-polkadot-v0.9.41", git = "https://github.com/gluwa/substrate.git", default-features = false } -sp-application-crypto = { branch = "pos-keep-history-polkadot-v0.9.41", git = "https://github.com/gluwa/substrate.git" } sp-arithmetic = { branch = "pos-keep-history-polkadot-v0.9.41", git = "https://github.com/gluwa/substrate.git", default-features = false } sp-block-builder = { branch = "pos-keep-history-polkadot-v0.9.41", git = "https://github.com/gluwa/substrate.git", default-features = false } sp-blockchain = { branch = "pos-keep-history-polkadot-v0.9.41", git = "https://github.com/gluwa/substrate.git" } diff --git a/pallets/creditcoin/Cargo.toml b/pallets/creditcoin/Cargo.toml index acb3502fad..9e98f72d50 100644 --- a/pallets/creditcoin/Cargo.toml +++ b/pallets/creditcoin/Cargo.toml @@ -48,8 +48,6 @@ sp-std = { workspace = true } strum = { version = "0.24.1", features = ["derive"], default-features = false } tracing = { workspace = true } pallet-offchain-task-scheduler = { workspace = true } -ethers-core.workspace = true -web3.workspace = true [dev-dependencies] assert_matches = { workspace = true } diff --git a/pallets/creditcoin/src/helpers.rs b/pallets/creditcoin/src/helpers.rs index 8c7fd21ab2..447267e206 100644 --- a/pallets/creditcoin/src/helpers.rs +++ b/pallets/creditcoin/src/helpers.rs @@ -1,19 +1,16 @@ mod external_address; mod register_transfer; -use ethers_core::types::RecoveryMessage; +use alloc::string::String; pub use external_address::{address_is_well_formed, generate_external_address}; #[cfg(any(test, feature = "runtime-benchmarks"))] pub use external_address::{EVMAddress, PublicToAddress}; -use sp_core::U256; -use sp_runtime::BoundedVec; use crate::{ pallet::*, types::{Address, AddressId, SignatureType}, Blockchain, DealOrderId, Error, ExternalAddress, Guid, Id, TransferId, }; -use ethers_core::types::Signature; use frame_support::ensure; use frame_system::pallet_prelude::*; use sp_std::prelude::*; @@ -106,6 +103,80 @@ impl Pallet { UsedGuids::::insert(guid, ()); Ok(()) } + + pub fn try_extract_address( + signature_type: SignatureType, + signature: [u8; 65], + account_id: String, + blockchain: Blockchain, + address: ExternalAddress, + ) -> Result> { + match signature_type { + // Old Way + SignatureType::EthSign => { + Self::ExtractEthSignPublicKey(signature, account_id, blockchain, address) + }, + // New Way + SignatureType::PersonalSign => { + Self::ExtractPeronalSignPublicKey(signature, account_id, blockchain, address) + }, + } + } + + fn ExtractEthSignPublicKey( + signature: [u8; 65], + account_id: String, + blockchain: Blockchain, + address: ExternalAddress, + ) -> Result> { + let message = sp_io::hashing::sha2_256(account_id.as_bytes()); + let message = &sp_io::hashing::blake2_256(message.as_ref()); + + match secp256k1_ecdsa_recover_compressed(&signature, &message) { + Ok(public_key) => { + match generate_external_address( + &blockchain, + &address, + sp_core::ecdsa::Public::from_raw(public_key), + ) { + Some(s) => Ok(s), + None => Err(crate::Error::::EthSignExternalAddressGenerationFailed), + } + }, + Err(e) => Err(crate::Error::::EthSignInvalidSignature), + } + } + + pub fn eth_message(message: String) -> [u8; 32] { + sp_io::hashing::keccak_256( + alloc::format!("{}{}{}", "\x19Ethereum Signed Message:\n", message.len(), message) + .as_bytes(), + ) + } + + pub fn ExtractPeronalSignPublicKey( + signature: [u8; 65], + account_id: String, + blockchain: Blockchain, + address: ExternalAddress, + ) -> Result> { + let message = Self::eth_message(account_id); + let message = &sp_io::hashing::blake2_256(message.as_ref()); + + match secp256k1_ecdsa_recover_compressed(&signature, &message) { + Ok(public_key) => { + match generate_external_address( + &blockchain, + &address, + sp_core::ecdsa::Public::from_raw(public_key), + ) { + Some(s) => Ok(s), + None => Err(crate::Error::::EthSignExternalAddressGenerationFailed), + } + }, + Err(e) => Err(crate::Error::::EthSignInvalidSignature), + } + } } pub fn non_paying_error( @@ -154,80 +225,4 @@ pub mod extensions { } } -pub fn try_extract_address( - signature_type: SignatureType, - signature: [u8; 65], - account_id: String, - blockchain: Blockchain, - address: ExternalAddress, -) -> Result> { - match signature_type { - // Old Way - SignatureType::EthSign => { - ExtractEthSignPublicKey(signature, account_id, blockchain, address) - }, - // New Way - SignatureType::PersonalSign => ExtractPeronalSignPublicKey(signature, account_id), - } -} - -use ethers_core::types::Signature; use sp_io::crypto::secp256k1_ecdsa_recover_compressed; -use web3::signing::{keccak256, recover}; - -fn ExtractEthSignPublicKey( - signature: [u8; 65], - account_id: String, - blockchain: Blockchain, - address: ExternalAddress, -) -> Result> { - let message = sp_io::hashing::sha2_256(account_id.as_bytes()); - let message = &sp_io::hashing::blake2_256(message.as_ref()); - - match secp256k1_ecdsa_recover_compressed(&signature, &message) { - Ok(public_key) => { - match generate_external_address( - &blockchain, - &address, - sp_core::ecdsa::Public::from_raw(public_key), - ) { - Some(s) => Ok(s), - None => Err(crate::Error::EthSignExternalAddressGenerationFailed), - } - }, - Err(e) => Err(crate::Error::EthSignInvalidSignature), - } -} - -pub fn eth_message(message: String) -> [u8; 32] { - keccak256( - format!("{}{}{}", "\x19Ethereum Signed Message:\n", message.len(), message).as_bytes(), - ) -} - -pub fn ExtractPeronalSignPublicKey( - signature: [u8; 65], - message: String, -) -> Result> { - // Build the signature object - let v = signature[64]; - let r = U256::from_big_endian(&signature[0..32]); - let s = U256::from_big_endian(&signature[32..64]); - let signature = Signature { r, s, v: v.into() }; - - // Create the message and format it properly - let message = eth_message(message); - let recovery_message = RecoveryMessage::Data(message.to_vec()); - - if let Ok(address) = signature.recover(message) { - let address = address.as_bytes(); - let address = address.to_vec(); - - let res: ExternalAddress = - BoundedVec::try_from(address).expect("20 bytes fits within bounds."); - - return Ok(res); - } - - return Err(crate::Error::PerosnalSignFailedRecovery); -} diff --git a/pallets/creditcoin/src/lib.rs b/pallets/creditcoin/src/lib.rs index c318b26a6b..a89dc3be11 100644 --- a/pallets/creditcoin/src/lib.rs +++ b/pallets/creditcoin/src/lib.rs @@ -656,6 +656,63 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(23)] + #[pallet::weight(::WeightInfo::register_address_v2())] + pub fn register_address_v2( + origin: OriginFor, + blockchain: Blockchain, + address: ExternalAddress, + ownership_proof: sp_core::ecdsa::Signature, + signature_type: SignatureType, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + let account_id = who.encode().to_vec(); + let account_id = alloc::string::String::from_utf8(account_id).unwrap(); + + match Pallet::::try_extract_address( + signature_type, + ownership_proof.into(), + account_id, + blockchain, + address, + ) { + Ok(recreated_address) => { + // Check if external address of keypair used to sign AccountID + // is the same one mentioned in this call to register_address + ensure!(recreated_address == address, Error::::OwnershipNotSatisfied); + + let address_id = AddressId::new::(&blockchain, &address); + + if let Ok(account_id) = Addresses::::try_get(&address_id) { + // Already registered, let's figure out who owns it so we can + // return a nice error + if who == account_id.owner { + fail!(Error::::AddressAlreadyRegisteredByCaller); + } + fail!(Error::::AddressAlreadyRegistered); + } + + // note: this error condition is unreachable! + // AddressFormatNotSupported or OwnershipNotSatisfied will error out first + ensure!( + helpers::address_is_well_formed(&blockchain, &address), + Error::::MalformedExternalAddress + ); + + let entry = Address { blockchain, value: address, owner: who }; + Self::deposit_event(Event::::AddressRegistered( + address_id.clone(), + entry.clone(), + )); + >::insert(address_id, entry); + }, + Err(e) => return Err(Error::::AddressAlreadyRegistered), + } + + Err(Error::::AddressAlreadyRegistered) + } + #[pallet::call_index(2)] #[pallet::weight(::WeightInfo::add_ask_order())] pub fn add_ask_order( @@ -1356,59 +1413,5 @@ pub mod pallet { Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) } - - #[pallet::call_index(22)] - #[pallet::weight(::WeightInfo::register_address_v2())] - pub fn register_address_v2( - origin: OriginFor, - blockchain: Blockchain, - address: ExternalAddress, - ownership_proof: sp_core::ecdsa::Signature, - signature_type: SignatureType, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - match helpers::try_extract_address( - signature_type, - ownership_proof.into(), - who.to_string(), - blockchain, - address, - ) { - Ok(recreated_address) => { - // Check if external address of keypair used to sign AccountID - // is the same one mentioned in this call to register_address - ensure!(recreated_address == address, Error::::OwnershipNotSatisfied); - - let address_id = AddressId::new::(&blockchain, &address); - - if let Ok(account_id) = Addresses::::try_get(&address_id) { - // Already registered, let's figure out who owns it so we can - // return a nice error - if who == account_id.owner { - fail!(Error::::AddressAlreadyRegisteredByCaller); - } - fail!(Error::::AddressAlreadyRegistered); - } - - // note: this error condition is unreachable! - // AddressFormatNotSupported or OwnershipNotSatisfied will error out first - ensure!( - helpers::address_is_well_formed(&blockchain, &address), - Error::::MalformedExternalAddress - ); - - let entry = Address { blockchain, value: address, owner: who }; - Self::deposit_event(Event::::AddressRegistered( - address_id.clone(), - entry.clone(), - )); - >::insert(address_id, entry); - }, - Err(e) => return Err(e), - } - - Ok(()) - } } }