diff --git a/.gitmodules b/.gitmodules index df0dea378..acb172053 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "lib/protocol-eth"] path = lib/protocol-eth - url = https://github.com/AdExNetwork/adex-protocol-eth + url = https://github.com/AdExNetwork/adex-protocol-eth/ + branch = master diff --git a/Cargo.lock b/Cargo.lock index dbfeea364..5c8d9b124 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,11 +6,13 @@ version = "0.1.0" dependencies = [ "async-trait", "base64 0.10.1", - "byteorder 1.4.2", + "byteorder 1.4.3", "chrono", + "create2", + "dashmap", "eth_checksum", "ethstore", - "futures 0.3.12", + "futures 0.3.13", "hex", "lazy_static", "primitives", @@ -20,7 +22,7 @@ dependencies = [ "serde_json", "sha2 0.8.2", "tiny-keccak 1.5.0", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-compat-02", "web3", "wiremock", @@ -37,9 +39,9 @@ dependencies = [ [[package]] name = "adler" -version = "0.2.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "adview-manager" @@ -50,7 +52,7 @@ dependencies = [ "lazy_static", "num-integer", "primitives", - "rand 0.8.2", + "rand 0.8.3", "reqwest", "serde", "serde_json", @@ -89,7 +91,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" dependencies = [ "block-cipher-trait", - "byteorder 1.4.2", + "byteorder 1.4.3", "opaque-debug 0.2.3", ] @@ -160,9 +162,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "async-channel" -version = "1.5.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9" +checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" dependencies = [ "concurrent-queue", "event-listener", @@ -245,7 +247,7 @@ checksum = "9e9e7a929bd34c68a82d58a4de7f86fffdaf97fb2af850162a7bb19dd7269b33" dependencies = [ "native-tls", "thiserror", - "tokio 0.2.24", + "tokio 0.2.25", "url", ] @@ -270,7 +272,7 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.4", + "pin-project-lite 0.2.6", "pin-utils", "slab", "wasm-bindgen-futures", @@ -284,9 +286,9 @@ checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" [[package]] name = "async-trait" -version = "0.1.42" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" +checksum = "36ea56748e10732c49404c153638a15ec3d6211ec5ff35d9bb20e13b93576adf" dependencies = [ "proc-macro2", "quote", @@ -324,9 +326,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" +checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" dependencies = [ "addr2line", "cfg-if 1.0.0", @@ -348,7 +350,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" dependencies = [ - "byteorder 1.4.2", + "byteorder 1.4.3", ] [[package]] @@ -452,8 +454,8 @@ checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ "block-padding 0.1.5", "byte-tools 0.3.1", - "byteorder 1.4.2", - "generic-array 0.12.3", + "byteorder 1.4.3", + "generic-array 0.12.4", ] [[package]] @@ -472,7 +474,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" dependencies = [ - "generic-array 0.12.3", + "generic-array 0.12.4", ] [[package]] @@ -516,9 +518,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-slice-cast" @@ -552,9 +554,9 @@ checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" [[package]] name = "byteorder" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" @@ -576,9 +578,9 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" [[package]] name = "cc" -version = "1.0.66" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" @@ -602,15 +604,15 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time 0.1.43", + "time", "winapi 0.3.9", ] [[package]] name = "cid" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d88f30b1e74e7063df5711496f3ee6e74a9735d62062242d70cddf77717f18e" +checksum = "ff0e3bc0b6446b3f9663c1a6aba6ef06c5aeaa1bc92bd18077be337198ab9768" dependencies = [ "multibase", "multihash", @@ -650,8 +652,8 @@ dependencies = [ "bytes 1.0.1", "futures-util", "memchr", - "pin-project-lite 0.2.4", - "tokio 1.0.2", + "pin-project-lite 0.2.6", + "tokio 1.3.0", ] [[package]] @@ -674,29 +676,12 @@ dependencies = [ "serde", ] -[[package]] -name = "const_fn" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" - [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "cookie" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784ad0fbab4f3e9cef09f20e0aea6000ae08d2cb98ac4c0abc53df18803d702f" -dependencies = [ - "percent-encoding", - "time 0.2.24", - "version_check", -] - [[package]] name = "core-foundation" version = "0.9.1" @@ -719,6 +704,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" +[[package]] +name = "create2" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77400797683577a98863496c945600573f30a738651ee5cc047234f9a4cc821" +dependencies = [ + "hex", + "sha3 0.8.2", +] + [[package]] name = "crossbeam-channel" version = "0.5.0" @@ -742,12 +737,11 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ "cfg-if 1.0.0", - "const_fn", "crossbeam-utils", "lazy_static", "memoffset", @@ -766,9 +760,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ "autocfg 1.0.1", "cfg-if 1.0.0", @@ -794,7 +788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7afa06d05a046c7a47c3a849907ec303504608c927f4e85f7bfff22b7180d971" dependencies = [ "constant_time_eq", - "generic-array 0.9.0", + "generic-array 0.9.1", ] [[package]] @@ -819,9 +813,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10bcb9d7dcbf7002aaffbb53eac22906b64cdcc127971dcc387d8eb7c95d5560" +checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19" dependencies = [ "quote", "syn", @@ -839,9 +833,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.10.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +checksum = "a06d4a9551359071d1890820e3571252b91229e0712e7c36b08940e603c5a8fc" dependencies = [ "darling_core", "darling_macro", @@ -849,23 +843,23 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.10.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +checksum = "b443e5fb0ddd56e0c9bfa47dc060c5306ee500cb731f2b91432dd65589a77684" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.9.3", + "strsim 0.10.0", "syn", ] [[package]] name = "darling_macro" -version = "0.10.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +checksum = "c0220073ce504f12a70efc4e7cdaea9e9b1b324872e7ad96a208056d7a638b81" dependencies = [ "darling_core", "quote", @@ -884,9 +878,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993a608597367c6377b258c25d7120740f00ed23a2252b729b1932dd7866f908" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] name = "data-encoding-macro" @@ -919,7 +913,7 @@ dependencies = [ "crossbeam-queue", "num_cpus", "serde", - "tokio 1.0.2", + "tokio 1.3.0", ] [[package]] @@ -931,10 +925,10 @@ dependencies = [ "async-trait", "config", "deadpool", - "futures 0.3.12", + "futures 0.3.13", "log", "serde", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-postgres", ] @@ -961,7 +955,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" dependencies = [ - "generic-array 0.9.0", + "generic-array 0.9.1", ] [[package]] @@ -970,7 +964,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array 0.12.3", + "generic-array 0.12.4", ] [[package]] @@ -983,32 +977,26 @@ dependencies = [ ] [[package]] -name = "dirs" -version = "2.0.2" +name = "dirs-next" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if 0.1.10", - "dirs-sys", + "cfg-if 1.0.0", + "dirs-sys-next", ] [[package]] -name = "dirs-sys" -version = "0.3.5" +name = "dirs-sys-next" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", "winapi 0.3.9", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dtoa" version = "0.4.7" @@ -1029,9 +1017,9 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "encoding_rs" -version = "0.8.26" +version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" dependencies = [ "cfg-if 1.0.0", ] @@ -1077,7 +1065,7 @@ dependencies = [ "hex", "serde", "serde_json", - "sha3", + "sha3 0.9.1", "thiserror", "uint 0.9.0", ] @@ -1214,7 +1202,7 @@ dependencies = [ "serde_json", "smallvec 0.6.14", "tempdir", - "time 0.1.43", + "time", ] [[package]] @@ -1271,8 +1259,8 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ - "byteorder 1.4.2", - "rand 0.8.2", + "byteorder 1.4.3", + "rand 0.8.3", "rustc-hex 2.1.0", "static_assertions", ] @@ -1300,9 +1288,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", "percent-encoding", @@ -1338,15 +1326,15 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" [[package]] name = "futures" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" +checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" dependencies = [ "futures-channel", "futures-core", @@ -1359,9 +1347,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" dependencies = [ "futures-core", "futures-sink", @@ -1369,15 +1357,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" +checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" [[package]] name = "futures-executor" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" +checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" dependencies = [ "futures-core", "futures-task", @@ -1386,9 +1374,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" +checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" [[package]] name = "futures-lite" @@ -1401,15 +1389,15 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.4", + "pin-project-lite 0.2.6", "waker-fn", ] [[package]] name = "futures-macro" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" +checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -1419,18 +1407,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" +checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" [[package]] name = "futures-task" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" -dependencies = [ - "once_cell", -] +checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" [[package]] name = "futures-timer" @@ -1440,11 +1425,11 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" dependencies = [ - "futures 0.1.30", + "futures 0.1.31", "futures-channel", "futures-core", "futures-io", @@ -1452,7 +1437,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.4", + "pin-project-lite 0.2.6", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1467,18 +1452,18 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "generic-array" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" +checksum = "6d00328cedcac5e81c683e5620ca6a30756fc23027ebf9bff405c0e8da1fbb7e" dependencies = [ "typenum", ] [[package]] name = "generic-array" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" dependencies = [ "typenum", ] @@ -1506,13 +1491,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.1+wasi-snapshot-preview1", + "wasi 0.10.0+wasi-snapshot-preview1", ] [[package]] @@ -1548,7 +1533,7 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 0.2.24", + "tokio 0.2.25", "tokio-util 0.3.1", "tracing", "tracing-futures", @@ -1556,9 +1541,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" +checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78" dependencies = [ "bytes 1.0.1", "fnv", @@ -1568,10 +1553,9 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 1.0.2", - "tokio-util 0.6.1", + "tokio 1.3.0", + "tokio-util 0.6.4", "tracing", - "tracing-futures", ] [[package]] @@ -1591,18 +1575,18 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] [[package]] name = "hex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hmac" @@ -1657,18 +1641,17 @@ dependencies = [ [[package]] name = "http-types" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ab8d0085fb82859c9adf050bd53992297ecdd03a665a230dfa50c8c964bf3d" +checksum = "32613ebb139d1d430ef5783676f84abfa06fc5f2b4b5a25220cdeeff7e16ef5c" dependencies = [ "anyhow", "async-channel", "base64 0.13.0", - "cookie", "futures-lite", "http", "infer", - "pin-project-lite 0.1.11", + "pin-project-lite 0.2.6", "rand 0.7.3", "serde", "serde_json", @@ -1679,9 +1662,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.4" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" [[package]] name = "httpdate" @@ -1691,9 +1674,9 @@ checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" [[package]] name = "hyper" -version = "0.13.9" +version = "0.13.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" dependencies = [ "bytes 0.5.6", "futures-channel", @@ -1705,9 +1688,9 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 1.0.4", + "pin-project", "socket2", - "tokio 0.2.24", + "tokio 0.2.25", "tower-service", "tracing", "want", @@ -1715,23 +1698,23 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.2" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12219dc884514cb4a6a03737f4413c0e01c23a1b059b0156004b23f1e19dccbe" +checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" dependencies = [ "bytes 1.0.1", "futures-channel", "futures-core", "futures-util", - "h2 0.3.0", + "h2 0.3.1", "http", "http-body 0.4.0", "httparse", "httpdate", "itoa", - "pin-project 1.0.4", + "pin-project", "socket2", - "tokio 1.0.2", + "tokio 1.3.0", "tower-service", "tracing", "want", @@ -1744,12 +1727,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93ec5be69758dfc06b9b29efa9d6e9306e387c85eb362c603912eead2ad98c7" dependencies = [ "bytes 0.5.6", - "futures 0.3.12", + "futures 0.3.13", "http", - "hyper 0.13.9", + "hyper 0.13.10", "hyper-tls 0.4.3", "native-tls", - "tokio 0.2.24", + "tokio 0.2.25", "tokio-tls", "tower-service", "typed-headers", @@ -1762,9 +1745,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" dependencies = [ "bytes 0.5.6", - "hyper 0.13.9", + "hyper 0.13.10", "native-tls", - "tokio 0.2.24", + "tokio 0.2.25", "tokio-tls", ] @@ -1775,9 +1758,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes 1.0.1", - "hyper 0.14.2", + "hyper 0.14.4", "native-tls", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-native-tls", ] @@ -1789,9 +1772,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" dependencies = [ "matches", "unicode-bidi", @@ -1804,7 +1787,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" dependencies = [ - "parity-scale-codec 1.3.6", + "parity-scale-codec 1.3.7", ] [[package]] @@ -1836,9 +1819,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" dependencies = [ "autocfg 1.0.1", "hashbrown", @@ -1891,9 +1874,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.46" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ "wasm-bindgen", ] @@ -1904,7 +1887,7 @@ version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a47c4c3ac843f9a4238943f97620619033dadef4b378cd1e8addd170de396b3" dependencies = [ - "futures 0.3.12", + "futures 0.3.13", "log", "serde", "serde_derive", @@ -1944,22 +1927,22 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lexical-core" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616" +checksum = "21f866863575d0e1d654fbeeabdc927292fdf862873dc3c96c6f753357e13374" dependencies = [ "arrayvec 0.5.2", "bitflags", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "ryu", "static_assertions", ] [[package]] name = "libc" -version = "0.2.82" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" +checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" [[package]] name = "lock_api" @@ -1982,11 +1965,12 @@ dependencies = [ [[package]] name = "log" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", + "value-bag", ] [[package]] @@ -2081,9 +2065,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "miniz_oxide" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" dependencies = [ "adler", "autocfg 1.0.1", @@ -2110,9 +2094,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.7" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" +checksum = "a5dede4e2065b3842b8b0af444119f3aa331cc7cc2dd20388bfb0f5d5a38823a" dependencies = [ "libc", "log", @@ -2189,8 +2173,8 @@ dependencies = [ "digest 0.9.0", "generic-array 0.14.4", "multihash-derive", - "sha2 0.9.2", - "sha3", + "sha2 0.9.3", + "sha3 0.9.1", "unsigned-varint", ] @@ -2228,12 +2212,12 @@ dependencies = [ [[package]] name = "nb-connect" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998" +checksum = "670361df1bc2399ee1ff50406a0d422587dd3bb0da596e1978fe8e05dabddf4f" dependencies = [ "libc", - "winapi 0.3.9", + "socket2", ] [[package]] @@ -2375,15 +2359,15 @@ dependencies = [ [[package]] name = "object" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" [[package]] name = "once_cell" -version = "1.5.2" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" [[package]] name = "opaque-debug" @@ -2468,9 +2452,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "1.3.6" +version = "1.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79602888a81ace83e3d1d4b2873286c1f5f906c84db667594e8db8da3506c383" +checksum = "a4b26b16c7687c3075982af47719e481815df30bc544f7a6690763a25ca16e9d" dependencies = [ "arrayvec 0.5.2", "bitvec 0.17.4", @@ -2524,7 +2508,7 @@ checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", "lock_api 0.4.2", - "parking_lot_core 0.8.2", + "parking_lot_core 0.8.3", ] [[package]] @@ -2542,14 +2526,14 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.1.57", + "redox_syscall", "smallvec 1.6.1", "winapi 0.3.9", ] @@ -2585,9 +2569,9 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c09cddfbfc98de7f76931acf44460972edb4023eb14d0c6d4018800e552d8e0" dependencies = [ - "byteorder 1.4.2", + "byteorder 1.4.3", "crypto-mac 0.6.2", - "generic-array 0.9.0", + "generic-array 0.9.1", ] [[package]] @@ -2616,38 +2600,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" -dependencies = [ - "pin-project-internal 0.4.27", -] - -[[package]] -name = "pin-project" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b70b68509f17aa2857863b6fa00bf21fc93674c7a8893de2f469f6aa7ca2f2" -dependencies = [ - "pin-project-internal 1.0.4", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.27" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caa25a6393f22ce819b0f50e0be89287292fda8d425be38ee0ca14c4931d9e71" +checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" dependencies = [ "proc-macro2", "quote", @@ -2656,15 +2620,15 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" [[package]] name = "pin-utils" @@ -2711,9 +2675,9 @@ checksum = "0f853fba627ed1f21392d329eeb03caf90dce57a65dfbd24274f4c39452ed3bb" dependencies = [ "bytes 1.0.1", "fallible-iterator", - "futures 0.3.12", + "futures 0.3.13", "log", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-postgres", ] @@ -2723,9 +2687,9 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d442770e2b1e244bb5eb03b31c79b65bb2568f413b899eaba850fa945a65954" dependencies = [ - "futures 0.3.12", + "futures 0.3.13", "native-tls", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-native-tls", "tokio-postgres", ] @@ -2737,14 +2701,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70e34ad3dc5c56d036b9418185ee97e14b6766d55c8ccf9dc18302ad4e6371d9" dependencies = [ "base64 0.13.0", - "byteorder 1.4.2", + "byteorder 1.4.3", "bytes 1.0.1", "fallible-iterator", "hmac 0.10.1", "md5", "memchr", - "rand 0.8.2", - "sha2 0.9.2", + "rand 0.8.3", + "sha2 0.9.3", "stringprep", ] @@ -2818,7 +2782,7 @@ dependencies = [ "ethabi", "ethereum-types 0.11.0", "fake", - "futures 0.3.12", + "futures 0.3.13", "hex", "lazy_static", "merkletree", @@ -2829,7 +2793,7 @@ dependencies = [ "parse-display", "postgres-types", "pretty_assertions", - "rand 0.8.2", + "rand 0.8.3", "serde", "serde-hex", "serde_json", @@ -2839,9 +2803,9 @@ dependencies = [ "slog-async", "slog-term", "thiserror", - "time 0.1.43", + "time", "tiny-keccak 2.0.2", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-postgres", "toml", "url", @@ -2910,9 +2874,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] @@ -2986,13 +2950,13 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", "rand_chacha 0.3.0", - "rand_core 0.6.1", + "rand_core 0.6.2", "rand_hc 0.3.0", ] @@ -3023,7 +2987,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", - "rand_core 0.6.1", + "rand_core 0.6.2", ] [[package]] @@ -3052,11 +3016,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ - "getrandom 0.2.1", + "getrandom 0.2.2", ] [[package]] @@ -3083,7 +3047,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ - "rand_core 0.6.1", + "rand_core 0.6.2", ] [[package]] @@ -3186,37 +3150,30 @@ dependencies = [ "futures-util", "itoa", "percent-encoding", - "pin-project-lite 0.2.4", + "pin-project-lite 0.2.6", "sha1", - "tokio 1.0.2", - "tokio-util 0.6.1", + "tokio 1.3.0", + "tokio-util 0.6.4", "url", ] [[package]] name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom 0.1.16", - "redox_syscall 0.1.57", - "rust-argon2", + "getrandom 0.2.2", + "redox_syscall", ] [[package]] @@ -3248,9 +3205,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd281b1030aa675fb90aa994d07187645bb3c8fc756ca766e7c3070b439de9de" +checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" dependencies = [ "base64 0.13.0", "bytes 1.0.1", @@ -3259,7 +3216,7 @@ dependencies = [ "futures-util", "http", "http-body 0.4.0", - "hyper 0.14.2", + "hyper 0.14.4", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -3268,11 +3225,11 @@ dependencies = [ "mime", "native-tls", "percent-encoding", - "pin-project-lite 0.2.4", + "pin-project-lite 0.2.6", "serde", "serde_json", "serde_urlencoded", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-native-tls", "url", "wasm-bindgen", @@ -3316,18 +3273,6 @@ dependencies = [ "rustc-hex 2.1.0", ] -[[package]] -name = "rust-argon2" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" -dependencies = [ - "base64 0.13.0", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", -] - [[package]] name = "rust-crypto" version = "0.2.36" @@ -3338,7 +3283,7 @@ dependencies = [ "libc", "rand 0.3.23", "rustc-serialize", - "time 0.1.43", + "time", ] [[package]] @@ -3374,6 +3319,12 @@ dependencies = [ "semver", ] +[[package]] +name = "rustversion" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" + [[package]] name = "ryu" version = "1.0.5" @@ -3418,7 +3369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8570c5e2fa69cb29d492fd4e9974b6b5facb5a888e1c6da630d4a3cd7ebfef4a" dependencies = [ "byte-tools 0.3.1", - "byteorder 1.4.2", + "byteorder 1.4.3", "hmac 0.6.3", "pbkdf2", "sha2 0.7.1", @@ -3444,9 +3395,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.0.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +checksum = "d493c5f39e02dfb062cd8f33301f90f9b13b650e8c1b1d0fd75c19dd64bff69d" dependencies = [ "bitflags", "core-foundation", @@ -3457,9 +3408,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +checksum = "dee48cdde5ed250b0d3252818f646e174ab414036edb884dde62d80a3ac6082d" dependencies = [ "core-foundation-sys", "libc", @@ -3492,9 +3443,9 @@ dependencies = [ "dashmap", "deadpool", "deadpool-postgres", - "futures 0.3.12", + "futures 0.3.13", "hex", - "hyper 0.14.2", + "hyper 0.14.4", "lazy_static", "migrant_lib", "once_cell", @@ -3506,15 +3457,15 @@ dependencies = [ "serde_urlencoded", "slog", "thiserror", - "tokio 1.0.2", + "tokio 1.3.0", "tokio-postgres", ] [[package]] name = "serde" -version = "1.0.119" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3" +checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" dependencies = [ "serde_derive", ] @@ -3532,9 +3483,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.119" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd" +checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ "proc-macro2", "quote", @@ -3543,9 +3494,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.61" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "itoa", "ryu", @@ -3587,9 +3538,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "1.6.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f6201e064705553ece353a736a64be975680bd244908cf63e8fa71e478a51a" +checksum = "b44be9227e214a0420707c9ca74c2d4991d9955bae9415a8f93f05cebf561be5" dependencies = [ "serde", "serde_with_macros", @@ -3597,9 +3548,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1197ff7de45494f290c1e3e1a6f80e108974681984c87a3e480991ef3d0f1950" +checksum = "e48b35457e9d855d3dc05ef32a73e0df1e2c0fd72c38796a4ee909160c8eeec2" dependencies = [ "darling", "proc-macro2", @@ -3609,9 +3560,9 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3cdf1b5e620a498ee6f2a171885ac7e22f0e12089ec4b3d22b84921792507c" +checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -3652,9 +3603,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7aab86fe2149bad8c507606bdb3f4ef5e7b2380eb92350f56122cca72a42a8" +checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -3663,6 +3614,19 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha3" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +dependencies = [ + "block-buffer 0.7.3", + "byte-tools 0.3.1", + "digest 0.8.1", + "keccak", + "opaque-debug 0.2.3", +] + [[package]] name = "sha3" version = "0.9.1" @@ -3716,9 +3680,9 @@ dependencies = [ [[package]] name = "slog-term" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab1d807cf71129b05ce36914e1dbb6fbfbdecaf686301cb457f4fa967f9f5b6" +checksum = "95c1e7e5aab61ced6006149ea772770b84a0d16ce0f7885def313e4829946d76" dependencies = [ "atty", "chrono", @@ -3761,7 +3725,7 @@ checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88" dependencies = [ "base64 0.12.3", "bytes 0.5.6", - "futures 0.3.12", + "futures 0.3.13", "httparse", "log", "rand 0.7.3", @@ -3780,77 +3744,19 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "standback" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66a8cff4fa24853fdf6b51f75c6d7f8206d7c75cab4e467bcd7f25c2b1febe0" -dependencies = [ - "version_check", -] - [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "stream-cipher" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" dependencies = [ - "generic-array 0.12.3", + "generic-array 0.12.4", ] [[package]] @@ -3871,9 +3777,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "strsim" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" @@ -3883,9 +3789,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.58" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" +checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" dependencies = [ "proc-macro2", "quote", @@ -3934,19 +3840,20 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.2", - "redox_syscall 0.2.4", + "rand 0.8.3", + "redox_syscall", "remove_dir_all", "winapi 0.3.9", ] [[package]] name = "term" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" dependencies = [ - "dirs", + "dirs-next", + "rustversion", "winapi 0.3.9", ] @@ -3961,18 +3868,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ "proc-macro2", "quote", @@ -3981,61 +3888,24 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "time" -version = "0.1.43" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ - "libc", - "winapi 0.3.9", + "once_cell", ] [[package]] name = "time" -version = "0.2.24" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "273d3ed44dca264b0d6b3665e8d48fb515042d42466fad93d2a45b90ec4058f7" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ - "const_fn", "libc", - "standback", - "stdweb", - "time-macros", - "version_check", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi 0.3.9", ] -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - [[package]] name = "tiny-keccak" version = "1.5.0" @@ -4056,9 +3926,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" dependencies = [ "tinyvec_macros", ] @@ -4071,9 +3941,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099837d3464c16a808060bb3f02263b412f6fafcb5d01c533d309985fbeebe48" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ "bytes 0.5.6", "fnv", @@ -4086,7 +3956,7 @@ dependencies = [ "mio-named-pipes", "mio-uds", "num_cpus", - "pin-project-lite 0.1.11", + "pin-project-lite 0.1.12", "signal-hook-registry", "slab", "tokio-macros 0.2.6", @@ -4095,18 +3965,18 @@ dependencies = [ [[package]] name = "tokio" -version = "1.0.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca04cec6ff2474c638057b65798f60ac183e5e79d3448bb7163d36a39cff6ec" +checksum = "8d56477f6ed99e10225f38f9f75f872f29b8b8bd8c0b946f63345bb144e9eeda" dependencies = [ "autocfg 1.0.1", "bytes 1.0.1", "libc", "memchr", - "mio 0.7.7", + "mio 0.7.9", "num_cpus", - "pin-project-lite 0.2.4", - "tokio-macros 1.0.0", + "pin-project-lite 0.2.6", + "tokio-macros 1.1.0", ] [[package]] @@ -4117,9 +3987,9 @@ checksum = "e7d4237822b7be8fff0a7a27927462fad435dcb6650f95cea9e946bf6bdc7e07" dependencies = [ "bytes 0.5.6", "once_cell", - "pin-project-lite 0.2.4", - "tokio 0.2.24", - "tokio 1.0.2", + "pin-project-lite 0.2.6", + "tokio 0.2.25", + "tokio 1.3.0", "tokio-stream", ] @@ -4136,9 +4006,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42517d2975ca3114b22a16192634e8241dc5cc1f130be194645970cc1c371494" +checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" dependencies = [ "proc-macro2", "quote", @@ -4152,7 +4022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ "native-tls", - "tokio 1.0.2", + "tokio 1.3.0", ] [[package]] @@ -4162,31 +4032,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cc9f82c2bfb06a33dd0dfb44b07ca98fe72df19e681d80c78d05a1bac2138e2" dependencies = [ "async-trait", - "byteorder 1.4.2", + "byteorder 1.4.3", "bytes 1.0.1", "fallible-iterator", - "futures 0.3.12", + "futures 0.3.13", "log", "parking_lot 0.11.1", "percent-encoding", "phf", - "pin-project-lite 0.2.4", + "pin-project-lite 0.2.6", "postgres-protocol", "postgres-types", "socket2", - "tokio 1.0.2", - "tokio-util 0.6.1", + "tokio 1.3.0", + "tokio-util 0.6.4", ] [[package]] name = "tokio-stream" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76066865172052eb8796c686f0b441a93df8b08d40a950b062ffb9a426f00edd" +checksum = "c535f53c0cfa1acace62995a8994fc9cc1f12d202420da96ff306ee24d576469" dependencies = [ "futures-core", - "pin-project-lite 0.2.4", - "tokio 1.0.2", + "pin-project-lite 0.2.6", + "tokio 1.3.0", ] [[package]] @@ -4196,7 +4066,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" dependencies = [ "native-tls", - "tokio 0.2.24", + "tokio 0.2.25", ] [[package]] @@ -4209,24 +4079,23 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite 0.1.11", - "tokio 0.2.24", + "pin-project-lite 0.1.12", + "tokio 0.2.25", ] [[package]] name = "tokio-util" -version = "0.6.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ae4751faa60b9f96dd8344d74592e5a17c0c9a220413dbc6942d14139bbfcc" +checksum = "ec31e5cc6b46e653cf57762f36f71d5e6386391d88a72fd6db4508f8f676fb29" dependencies = [ "bytes 1.0.1", "futures-core", "futures-io", "futures-sink", "log", - "pin-project-lite 0.2.4", - "tokio 1.0.2", - "tokio-stream", + "pin-project-lite 0.2.6", + "tokio 1.3.0", ] [[package]] @@ -4240,19 +4109,19 @@ dependencies = [ [[package]] name = "tower-service" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.22" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" +checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.4", + "pin-project-lite 0.2.6", "tracing-core", ] @@ -4267,11 +4136,11 @@ dependencies = [ [[package]] name = "tracing-futures" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 0.4.27", + "pin-project", "tracing", ] @@ -4306,7 +4175,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "754ba11732b9161b94c41798e5197e5e75388d012f760c42adb5000353e98646" dependencies = [ - "byteorder 1.4.2", + "byteorder 1.4.3", "crunchy 0.1.6", "heapsize", "rustc-hex 2.1.0", @@ -4318,7 +4187,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" dependencies = [ - "byteorder 1.4.2", + "byteorder 1.4.3", "crunchy 0.2.2", "hex", "static_assertions", @@ -4335,9 +4204,9 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" dependencies = [ "tinyvec", ] @@ -4368,9 +4237,9 @@ checksum = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" [[package]] name = "url" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" +checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ "form_urlencoded", "idna", @@ -4385,7 +4254,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.1", + "getrandom 0.2.2", ] [[package]] @@ -4393,10 +4262,10 @@ name = "validator_worker" version = "0.2.0" dependencies = [ "adapter", - "byteorder 1.4.2", + "byteorder 1.4.3", "chrono", "clap", - "futures 0.3.12", + "futures 0.3.13", "hex", "lazy_static", "num", @@ -4406,10 +4275,19 @@ dependencies = [ "serde", "serde_json", "slog", - "tokio 1.0.2", + "tokio 1.3.0", "toml", ] +[[package]] +name = "value-bag" +version = "1.0.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b676010e055c99033117c2343b33a40a30b91fecd6c49055ac9cd2d6c305ab1" +dependencies = [ + "ctor", +] + [[package]] name = "vcpkg" version = "0.2.11" @@ -4469,15 +4347,15 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.1+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ "cfg-if 1.0.0", "serde", @@ -4487,9 +4365,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ "bumpalo", "lazy_static", @@ -4502,9 +4380,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.19" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" +checksum = "8e67a5806118af01f0d9045915676b22aaebecf4178ae7021bc171dab0b897ab" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -4514,9 +4392,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4524,9 +4402,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ "proc-macro2", "quote", @@ -4537,15 +4415,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" +checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" -version = "0.3.46" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ "js-sys", "wasm-bindgen", @@ -4563,25 +4441,25 @@ dependencies = [ "derive_more", "ethabi", "ethereum-types 0.10.0", - "futures 0.3.12", + "futures 0.3.13", "futures-timer", "hex", - "hyper 0.13.9", + "hyper 0.13.10", "hyper-proxy", "hyper-tls 0.4.3", "jsonrpc-core", "log", "native-tls", "parking_lot 0.11.1", - "pin-project 1.0.4", + "pin-project", "rlp", "secp256k1", "serde", "serde_json", "soketto", "tiny-keccak 2.0.2", - "tokio 0.2.24", - "tokio-util 0.6.1", + "tokio 0.2.25", + "tokio-util 0.6.4", "typed-headers", "url", ] @@ -4649,22 +4527,22 @@ dependencies = [ [[package]] name = "wiremock" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5cb4fb12a3feb97521a5a09031ef4ba84d9d177a6e6382f8b788d88bc231b12" +checksum = "860c1b991b29b6bc5096b46bdaaea904417ed12fda814d38ccf1b869c13629c8" dependencies = [ "async-trait", "deadpool", - "futures 0.3.12", + "futures 0.3.13", "futures-timer", "http-types", - "hyper 0.14.2", + "hyper 0.14.4", "log", "once_cell", "regex", "serde", "serde_json", - "tokio 1.0.2", + "tokio 1.3.0", ] [[package]] diff --git a/adapter/Cargo.toml b/adapter/Cargo.toml index 7d5c50fd4..7cd375826 100644 --- a/adapter/Cargo.toml +++ b/adapter/Cargo.toml @@ -18,6 +18,8 @@ web3 = { version = "0.15", features = ["http-tls", "signing"] } eth_checksum = "0.1" tiny-keccak = "1.5" ethstore = { git = "https://github.com/openethereum/openethereum", tag = "v3.1.1-rc.1" } +create2 = "0.0.2" + # API client reqwest = { version = "0.11", features = ["json"] } @@ -29,6 +31,9 @@ futures = { version = "0.3", features = ["compat"] } async-trait = "0.1" tokio-compat-02 = "0.2" +# Dummy adapter +dashmap = "4.0" + [dev-dependencies] byteorder = "^1.4" tokio = { version = "^1", features = ["macros", "rt-multi-thread"] } diff --git a/adapter/src/dummy.rs b/adapter/src/dummy.rs index de3d8ebc7..cc9c98b3a 100644 --- a/adapter/src/dummy.rs +++ b/adapter/src/dummy.rs @@ -1,15 +1,15 @@ use async_trait::async_trait; +use dashmap::{mapref::entry::Entry, DashMap}; use primitives::{ adapter::{ - Adapter, AdapterErrorKind, AdapterResult, DummyAdapterOptions, Error as AdapterError, - Session, + Adapter, AdapterErrorKind, AdapterResult, Deposit, DummyAdapterOptions, + Error as AdapterError, Session, }, - channel_validator::ChannelValidator, + channel_v5::Channel, config::Config, - Channel, ToETHChecksum, ValidatorId, + Address, ChannelId, ToETHChecksum, ValidatorId, }; -use std::collections::HashMap; -use std::fmt; +use std::{collections::HashMap, fmt, sync::Arc}; #[derive(Debug, Clone)] pub struct DummyAdapter { @@ -19,11 +19,44 @@ pub struct DummyAdapter { session_tokens: HashMap, // Auth tokens that we've generated to authenticate with someone (address => token) authorization_tokens: HashMap, + deposits: Deposits, } -// Enables DummyAdapter to be able to -// check if a channel is valid -impl ChannelValidator for DummyAdapter {} +#[derive(Debug, Clone, Default)] +#[allow(clippy::type_complexity)] +pub struct Deposits(Arc)>>); + +impl Deposits { + pub fn add_deposit(&self, channel: ChannelId, address: Address, deposit: Deposit) { + match self.0.entry((channel, address)) { + Entry::Occupied(mut deposit_calls) => { + // add the new deposit to the Vec + deposit_calls.get_mut().1.push(deposit); + } + Entry::Vacant(empty) => { + // add the new `(ChannelId, Address)` key and init with index 0 and the passed Deposit + empty.insert((0, vec![deposit])); + } + } + } + + pub fn get_next_deposit(&self, channel: ChannelId, address: Address) -> Option { + match self.0.entry((channel, address)) { + Entry::Occupied(mut entry) => { + let (call_index, deposit_calls) = entry.get_mut(); + + let deposit = deposit_calls.get(*call_index).cloned()?; + + // increment the index for the next call + *call_index = call_index + .checked_add(1) + .expect("Deposit call index has overflowed"); + Some(deposit) + } + Entry::Vacant(_) => None, + } + } +} impl DummyAdapter { pub fn init(opts: DummyAdapterOptions, config: &Config) -> Self { @@ -32,8 +65,13 @@ impl DummyAdapter { config: config.to_owned(), session_tokens: opts.dummy_auth, authorization_tokens: opts.dummy_auth_tokens, + deposits: Default::default(), } } + + pub fn add_deposit_call(&self, channel: ChannelId, address: Address, deposit: Deposit) { + self.deposits.add_deposit(channel, address, deposit) + } } #[derive(Debug)] @@ -83,15 +121,6 @@ impl Adapter for DummyAdapter { Ok(is_same) } - async fn validate_channel<'a>( - &'a self, - channel: &'a Channel, - ) -> AdapterResult { - DummyAdapter::is_channel_valid(&self.config, self.whoami(), channel) - .map(|_| true) - .map_err(AdapterError::InvalidChannel) - } - async fn session_from_token<'a>( &'a self, token: &'a str, @@ -129,4 +158,81 @@ impl Adapter for DummyAdapter { ))), } } + + async fn get_deposit( + &self, + channel: &Channel, + address: &Address, + ) -> AdapterResult { + self.deposits + .get_next_deposit(channel.id(), *address) + .ok_or_else(|| AdapterError::Adapter(Box::new(Error {}))) + } +} + +#[cfg(test)] +mod test { + use primitives::{ + config::configuration, + util::tests::prep_db::{ADDRESSES, DUMMY_CAMPAIGN, IDS}, + BigNum, + }; + + use super::*; + + #[tokio::test] + async fn test_deposits_calls() { + let config = configuration("development", None).expect("Should get Config"); + let channel = DUMMY_CAMPAIGN.channel.clone(); + let adapter = DummyAdapter::init( + DummyAdapterOptions { + dummy_identity: IDS["leader"], + dummy_auth: Default::default(), + dummy_auth_tokens: Default::default(), + }, + &config, + ); + + let address = ADDRESSES["creator"]; + + // no mocked deposit calls should cause an Error + { + let result = adapter.get_deposit(&channel, &address).await; + + assert!(result.is_err()); + } + + let get_deposit = |total: u64, create2: u64| Deposit { + total: BigNum::from(total), + still_on_create2: BigNum::from(create2), + }; + + // add two deposit and call 3 times + // also check if different address does not have access to these calls + { + let deposits = [get_deposit(6969, 69), get_deposit(1000, 0)]; + adapter.add_deposit_call(channel.id(), address, deposits[0].clone()); + adapter.add_deposit_call(channel.id(), address, deposits[1].clone()); + + let first_call = adapter + .get_deposit(&channel, &address) + .await + .expect("Should get first mocked deposit"); + assert_eq!(&deposits[0], &first_call); + + // should not affect the Mocked deposit calls and should cause an error + let different_address_call = adapter.get_deposit(&channel, &ADDRESSES["leader"]).await; + assert!(different_address_call.is_err()); + + let second_call = adapter + .get_deposit(&channel, &address) + .await + .expect("Should get second mocked deposit"); + assert_eq!(&deposits[1], &second_call); + + // Third call should error, we've only mocked 2 calls! + let third_call = adapter.get_deposit(&channel, &address).await; + assert!(third_call.is_err()); + } + } } diff --git a/adapter/src/ethereum.rs b/adapter/src/ethereum.rs index 27e0c0d20..ce5e1a9fd 100644 --- a/adapter/src/ethereum.rs +++ b/adapter/src/ethereum.rs @@ -1,37 +1,91 @@ -use crate::EthereumChannel; use async_trait::async_trait; use chrono::Utc; +use create2::calc_addr; use error::*; use ethstore::{ - ethkey::{public_to_address, recover, verify_address, Address, Message, Password, Signature}, + ethkey::{public_to_address, recover, verify_address, Message, Password, Signature}, SafeAccount, }; use futures::TryFutureExt; use lazy_static::lazy_static; use primitives::{ - adapter::{Adapter, AdapterResult, Error as AdapterError, KeystoreOptions, Session}, - channel_validator::ChannelValidator, + adapter::{Adapter, AdapterResult, Deposit, Error as AdapterError, KeystoreOptions, Session}, + channel_v5::Channel, config::Config, - Channel, ChannelId, ToETHChecksum, ValidatorId, + Address, BigNum, ToETHChecksum, ValidatorId, }; use reqwest::Client; use serde::{Deserialize, Serialize}; use serde_json::Value; -use std::{convert::TryFrom, fs}; +use std::{convert::TryFrom, fs, str::FromStr}; use tiny_keccak::Keccak; use web3::{ - contract::{tokens::Tokenizable, Contract, Options}, + contract::{Contract, Options}, + ethabi::{encode, Token}, transports::Http, - types::{H256, U256}, + types::{H160, U256}, Web3, }; +#[cfg(test)] +use test_utils::*; + mod error; +#[cfg(test)] +mod test_utils; lazy_static! { - static ref ADEXCORE_ABI: &'static [u8] = - include_bytes!("../../lib/protocol-eth/abi/AdExCore.json"); - static ref CHANNEL_STATE_ACTIVE: U256 = 1.into(); + static ref OUTPACE_ABI: &'static [u8] = + include_bytes!("../../lib/protocol-eth/abi/OUTPACE.json"); + static ref ERC20_ABI: &'static [u8] = include_str!("../../lib/protocol-eth/abi/ERC20.json") + .trim_end_matches('\n') + .as_bytes(); + static ref SWEEPER_ABI: &'static [u8] = + include_bytes!("../../lib/protocol-eth/abi/Sweeper.json"); + /// Ready to use init code (i.e. decoded) for calculating the create2 address + static ref DEPOSITOR_BYTECODE_DECODED: Vec = { + let bytecode = include_str!("../../lib/protocol-eth/resources/bytecode/Depositor.bin"); + hex::decode(bytecode).expect("Decoded properly") + }; +} + +trait EthereumChannel { + fn tokenize(&self) -> Token; +} + +impl EthereumChannel for Channel { + fn tokenize(&self) -> Token { + let tokens = vec![ + Token::Address(self.leader.as_bytes().into()), + Token::Address(self.follower.as_bytes().into()), + Token::Address(self.guardian.as_bytes().into()), + Token::Address(self.token.as_bytes().into()), + Token::FixedBytes(self.nonce.to_bytes().to_vec()), + ]; + + Token::Tuple(tokens) + } +} + +fn get_counterfactual_address( + sweeper: H160, + channel: &Channel, + outpace: H160, + depositor: &Address, +) -> H160 { + let salt: [u8; 32] = [0; 32]; + let encoded_params = encode(&[ + Token::Address(outpace), + channel.tokenize(), + Token::Address(H160(*depositor.as_bytes())), + ]); + + let mut init_code = DEPOSITOR_BYTECODE_DECODED.clone(); + init_code.extend(&encoded_params); + + let address = calc_addr(sweeper.as_fixed_bytes(), &salt, &init_code); + + H160(address) } #[derive(Debug, Clone)] @@ -45,15 +99,10 @@ pub struct EthereumAdapter { relayer: RelayerClient, } -// Enables EthereumAdapter to be able to -// check if a channel is valid -impl ChannelValidator for EthereumAdapter {} - impl EthereumAdapter { pub fn init(opts: KeystoreOptions, config: &Config) -> AdapterResult { let keystore_contents = fs::read_to_string(&opts.keystore_file).map_err(KeystoreError::ReadingFile)?; - let keystore_json: Value = serde_json::from_str(&keystore_contents).map_err(KeystoreError::Deserialization)?; @@ -120,7 +169,7 @@ impl Adapter for EthereumAdapter { } /// `state_root` is hex string which **should not** be `0x` prefixed - /// `sig` is hex string wihch **should be** `0x` prefixed + /// `sig` is hex string which **should be** `0x` prefixed fn verify( &self, signer: &ValidatorId, @@ -131,7 +180,7 @@ impl Adapter for EthereumAdapter { return Err(VerifyError::SignatureNotPrefixed.into()); } let decoded_signature = hex::decode(&sig[2..]).map_err(VerifyError::SignatureDecoding)?; - let address = Address::from(*signer.inner()); + let address = ethstore::ethkey::Address::from(*signer.as_bytes()); let signature = Signature::from_electrum(&decoded_signature); let state_root = hex::decode(state_root).map_err(VerifyError::StateRootDecoding)?; let message = Message::from(hash_message(&state_root)); @@ -142,58 +191,6 @@ impl Adapter for EthereumAdapter { Ok(verify_address) } - async fn validate_channel<'a>( - &'a self, - channel: &'a Channel, - ) -> AdapterResult { - // check if channel is valid - EthereumAdapter::is_channel_valid(&self.config, self.whoami(), channel) - .map_err(AdapterError::InvalidChannel)?; - - let eth_channel = - EthereumChannel::try_from(channel).map_err(AdapterError::InvalidChannel)?; - - let eth_channel_id = ChannelId::from(eth_channel.hash(&self.config.ethereum_core_address)); - - if eth_channel_id != channel.id { - return Err(AdapterError::Adapter( - Error::InvalidChannelId { - expected: eth_channel_id, - actual: channel.id, - } - .into(), - )); - } - - let contract = Contract::from_json( - self.web3.eth(), - self.config.ethereum_core_address.into(), - &ADEXCORE_ABI, - ) - .map_err(Error::ContractInitialization)?; - - let channel_status: U256 = tokio_compat_02::FutureExt::compat(async { - tokio_compat_02::FutureExt::compat(contract.query( - "states", - H256(*channel.id).into_token(), - None, - Options::default(), - None, - )) - .await - }) - .await - .map_err(Error::ContractQuerying)?; - - if channel_status != *CHANNEL_STATE_ACTIVE { - Err(AdapterError::Adapter( - Error::ChannelInactive(channel.id).into(), - )) - } else { - Ok(true) - } - } - /// Creates a `Session` from a provided Token by calling the Contract. /// Does **not** cache the (`Token`, `Session`) pair. async fn session_from_token<'a>( @@ -269,6 +266,93 @@ impl Adapter for EthereumAdapter { ewt_sign(&wallet, &self.keystore_pwd, &payload) .map_err(|err| AdapterError::Adapter(Error::SignMessage(err).into())) } + + async fn get_deposit( + &self, + channel: &Channel, + depositor_address: &Address, + ) -> AdapterResult { + let outpace_contract = Contract::from_json( + self.web3.eth(), + self.config.outpace_address.into(), + &OUTPACE_ABI, + ) + .map_err(Error::ContractInitialization)?; + + let erc20_contract = + Contract::from_json(self.web3.eth(), channel.token.as_bytes().into(), &ERC20_ABI) + .map_err(Error::ContractInitialization)?; + + let sweeper_contract = Contract::from_json( + self.web3.eth(), + self.config.sweeper_address.into(), + &SWEEPER_ABI, + ) + .map_err(Error::ContractInitialization)?; + + let sweeper_address = sweeper_contract.address(); + let outpace_address = outpace_contract.address(); + + let on_outpace: U256 = tokio_compat_02::FutureExt::compat(async { + tokio_compat_02::FutureExt::compat(outpace_contract.query( + "deposits", + ( + Token::FixedBytes(channel.id().as_bytes().to_vec()), + Token::Address(depositor_address.as_bytes().into()), + ), + None, + Options::default(), + None, + )) + .await + }) + .await + .map_err(Error::ContractQuerying)?; + + let on_outpace = BigNum::from_str(&on_outpace.to_string())?; + + let counterfactual_address = get_counterfactual_address( + sweeper_address, + channel, + outpace_address, + depositor_address, + ); + let still_on_create2: U256 = tokio_compat_02::FutureExt::compat(async { + tokio_compat_02::FutureExt::compat(erc20_contract.query( + "balanceOf", + counterfactual_address, + None, + Options::default(), + None, + )) + .await + }) + .await + .map_err(Error::ContractQuerying)?; + + let still_on_create2: BigNum = still_on_create2.to_string().parse()?; + + let token_info = self + .config + .token_address_whitelist + .get(&channel.token) + .ok_or(Error::TokenNotWhitelisted(channel.token))?; + + // Count the create2 deposit only if it's > minimum token units configured + let deposit = if still_on_create2 > token_info.min_token_units_for_deposit { + Deposit { + total: &still_on_create2 + &on_outpace, + still_on_create2, + } + } else { + Deposit { + total: on_outpace, + still_on_create2: BigNum::from(0), + } + }; + + Ok(deposit) + } } #[derive(Debug, Clone)] @@ -424,44 +508,24 @@ pub fn ewt_verify( #[cfg(test)] mod test { use super::*; - use crate::EthereumChannel; - use chrono::{Duration, Utc}; - use hex::FromHex; - use primitives::config::configuration; - use primitives::ChannelId; - use primitives::{adapter::KeystoreOptions, targeting::Rules}; - use primitives::{ChannelSpec, EventSubmission, SpecValidators, ValidatorDesc}; + use chrono::Utc; use std::convert::TryFrom; - use web3::types::Address; + use web3::{transports::Http, Web3}; use wiremock::{ matchers::{method, path}, Mock, MockServer, ResponseTemplate, }; - fn setup_eth_adapter(contract_address: Option<[u8; 20]>) -> EthereumAdapter { - let mut config = configuration("development", None).expect("failed parse config"); - let keystore_options = KeystoreOptions { - keystore_file: "./test/resources/keystore.json".to_string(), - keystore_pwd: "adexvalidator".to_string(), - }; - - if let Some(ct_address) = contract_address { - config.ethereum_core_address = ct_address; - } - - EthereumAdapter::init(keystore_options, &config).expect("should init ethereum adapter") - } - #[test] fn should_init_and_unlock_ethereum_adapter() { - let mut eth_adapter = setup_eth_adapter(None); + let mut eth_adapter = setup_eth_adapter(None, None, None); eth_adapter.unlock().expect("should unlock eth adapter"); } #[test] fn should_get_whoami_sign_and_verify_messages() { // whoami - let mut eth_adapter = setup_eth_adapter(None); + let mut eth_adapter = setup_eth_adapter(None, None, None); let whoami = eth_adapter.whoami(); assert_eq!( whoami.to_string(), @@ -508,7 +572,8 @@ mod test { #[test] fn should_generate_correct_ewt_sign_and_verify() { - let mut eth_adapter = setup_eth_adapter(None); + let mut eth_adapter = setup_eth_adapter(None, None, None); + eth_adapter.unlock().expect("should unlock eth adapter"); let payload = Payload { @@ -554,7 +619,7 @@ mod test { let mut identities_owned: HashMap = HashMap::new(); identities_owned.insert(identity, 2); - let mut eth_adapter = setup_eth_adapter(None); + let mut eth_adapter = setup_eth_adapter(None, None, None); Mock::given(method("GET")) .and(path(format!("/identity/by-owner/{}", eth_adapter.whoami()))) @@ -569,7 +634,7 @@ mod test { let payload = Payload { id: eth_adapter.whoami().to_checksum(), era: era.floor() as i64, - identity: Some(identity.clone()), + identity: Some(identity), address: eth_adapter.whoami().to_checksum(), }; @@ -581,146 +646,162 @@ mod test { } #[tokio::test] - async fn should_validate_valid_channel_properly() { - let http = - web3::transports::Http::new("http://localhost:8545").expect("failed to init transport"); - - let web3 = web3::Web3::new(http); - let leader_account: Address = "Df08F82De32B8d460adbE8D72043E3a7e25A3B39" - .parse() - .expect("failed to parse leader account"); - let _follower_account: Address = "6704Fbfcd5Ef766B287262fA2281C105d57246a6" - .parse() - .expect("failed to parse leader account"); - - // tokenbytecode.json - let token_bytecode = - include_str!("../test/resources/tokenbytecode.json").trim_end_matches("\n"); - // token_abi.json - let token_abi = include_bytes!("../test/resources/tokenabi.json"); - // adexbytecode.json - let adex_bytecode = include_str!("../../lib/protocol-eth/resources/bytecode/AdExCore.json") - .trim_end_matches("\n"); + async fn get_deposit_and_count_create2_when_min_tokens_received() { + let web3 = Web3::new(Http::new(&GANACHE_URL).expect("failed to init transport")); + + let leader_account = H160(*GANACHE_ADDRESSES["leader"].as_bytes()); // deploy contracts - let token_contract = tokio_compat_02::FutureExt::compat(async { - Contract::deploy(web3.eth(), token_abi) - .expect("invalid token token contract") - .confirmations(0) - .options(Options::with(|opt| { - opt.gas_price = Some(1.into()); - opt.gas = Some(6_721_975.into()); - })) - .execute(token_bytecode, (), leader_account) - }) - .await; + let token = deploy_token_contract(&web3, 1_000) + .await + .expect("Correct parameters are passed to the Token constructor."); + let token_address = Address::from_bytes(&token.1.to_fixed_bytes()); - let token_contract = tokio_compat_02::FutureExt::compat(token_contract) + let sweeper = deploy_sweeper_contract(&web3) .await - .expect("Correct parameters are passed to the constructor."); - - let adex_contract = tokio_compat_02::FutureExt::compat(async { - Contract::deploy(web3.eth(), &ADEXCORE_ABI) - .expect("invalid adex contract") - .confirmations(0) - .options(Options::with(|opt| { - opt.gas_price = Some(1.into()); - opt.gas = Some(6_721_975.into()); - })) - .execute(adex_bytecode, (), leader_account) - }) - .await; - let adex_contract = tokio_compat_02::FutureExt::compat(adex_contract) + .expect("Correct parameters are passed to the Sweeper constructor."); + + let outpace = deploy_outpace_contract(&web3) .await - .expect("Correct parameters are passed to the constructor."); - - // contract call set balance - tokio_compat_02::FutureExt::compat(token_contract.call( - "setBalanceTo", - (Address::from(leader_account), U256::from(2000_u64)), - leader_account, - Options::default(), - )) - .await - .expect("Failed to set balance"); - - let leader_validator_desc = ValidatorDesc { - // keystore.json address (same with js) - id: ValidatorId::try_from("2bdeafae53940669daa6f519373f686c1f3d3393") - .expect("failed to create id"), - url: "http://localhost:8005".to_string(), - fee: 100.into(), - fee_addr: None, - }; + .expect("Correct parameters are passed to the OUTPACE constructor."); - let follower_validator_desc = ValidatorDesc { - // keystore2.json address (same with js) - id: ValidatorId::try_from("6704Fbfcd5Ef766B287262fA2281C105d57246a6") - .expect("failed to create id"), - url: "http://localhost:8006".to_string(), - fee: 100.into(), - fee_addr: None, - }; + let spender = GANACHE_ADDRESSES["creator"]; - let mut valid_channel = Channel { - // to be replace with the proper id - id: ChannelId::from_hex( - "061d5e2a67d0a9a10f1c732bca12a676d83f79663a396f7d87b3e30b9b411088", - ) - .expect("prep_db: failed to deserialize channel id"), - // leader_account - creator: ValidatorId::try_from("Df08F82De32B8d460adbE8D72043E3a7e25A3B39") - .expect("should be valid ValidatorId"), - deposit_asset: eth_checksum::checksum(&format!("{:?}", token_contract.address())), - deposit_amount: 2_000.into(), - valid_until: Utc::now() + Duration::days(2), - targeting_rules: Rules::new(), - spec: ChannelSpec { - title: None, - validators: SpecValidators::new(leader_validator_desc, follower_validator_desc), - max_per_impression: 10.into(), - min_per_impression: 10.into(), - targeting_rules: Rules::new(), - event_submission: Some(EventSubmission { allow: vec![] }), - created: Utc::now(), - active_from: None, - nonce: None, - withdraw_period_start: Utc::now() + Duration::days(1), - ad_units: vec![], - pricing_bounds: None, - }, - exhausted: Default::default(), - }; + let channel = get_test_channel(token_address); - // convert to eth channel - let eth_channel = - EthereumChannel::try_from(&valid_channel).expect("failed to create eth channel"); - let sol_tuple = eth_channel.to_solidity_tuple(); - - // contract call open channel - tokio_compat_02::FutureExt::compat(adex_contract.call( - "channelOpen", - (sol_tuple,), - leader_account, - Options::default(), - )) - .await - .expect("open channel"); + let mut eth_adapter = setup_eth_adapter( + Some(*sweeper.0.as_fixed_bytes()), + Some(*outpace.0.as_fixed_bytes()), + Some((token_address, token.0)), + ); + eth_adapter.unlock().expect("should unlock eth adapter"); - let contract_addr = adex_contract.address().to_fixed_bytes(); - let channel_id = eth_channel.hash(&contract_addr); - // set id to proper id - valid_channel.id = ChannelId::from(channel_id); + let counterfactual_address = + get_counterfactual_address(sweeper.0, &channel, outpace.0, &spender); + + // No Regular nor Create2 deposits + { + let no_deposits = eth_adapter + .get_deposit(&channel, &spender) + .await + .expect("should get deposit"); + + assert_eq!( + Deposit { + total: BigNum::from(0), + still_on_create2: BigNum::from(0), + }, + no_deposits + ); + } - // eth adapter - let mut eth_adapter = setup_eth_adapter(Some(contract_addr)); - eth_adapter.unlock().expect("should unlock eth adapter"); - // validate channel - let result = eth_adapter - .validate_channel(&valid_channel) + // Regular deposit in Outpace without Create2 + { + mock_set_balance( + &token.2, + *GANACHE_ADDRESSES["leader"].as_bytes(), + *spender.as_bytes(), + 10_000_u64, + ) + .await + .expect("Failed to set balance"); + + outpace_deposit(&outpace.1, &channel, *spender.as_bytes(), 10_000) + .await + .expect("Should deposit funds"); + + let regular_deposit = eth_adapter + .get_deposit(&channel, &spender) + .await + .expect("should get deposit"); + + assert_eq!( + Deposit { + total: BigNum::from(10_000), + still_on_create2: BigNum::from(0), + }, + regular_deposit + ); + } + + // Deposit with less than minimum token units + { + // Set balance < minimal token units, i.e. `1_000` + mock_set_balance( + &token.2, + leader_account.to_fixed_bytes(), + counterfactual_address.to_fixed_bytes(), + 999_u64, + ) + .await + .expect("Failed to set balance"); + + let deposit_with_create2 = eth_adapter + .get_deposit(&channel, &spender) + .await + .expect("should get deposit"); + + assert_eq!( + Deposit { + total: BigNum::from(10_000), + // tokens are **less** than the minimum tokens required for deposits to count + still_on_create2: BigNum::from(0), + }, + deposit_with_create2 + ); + } + + // Deposit with more than minimum token units + { + // Set balance > minimal token units + mock_set_balance( + &token.2, + leader_account.to_fixed_bytes(), + counterfactual_address.to_fixed_bytes(), + 1_999_u64, + ) .await - .expect("failed to validate channel"); + .expect("Failed to set balance"); + + let deposit_with_create2 = eth_adapter + .get_deposit(&channel, &spender) + .await + .expect("should get deposit"); + + assert_eq!( + Deposit { + total: BigNum::from(11_999), + // tokens are more than the minimum tokens required for deposits to count + still_on_create2: BigNum::from(1_999), + }, + deposit_with_create2 + ); + } - assert!(result, "should validate valid channel correctly"); + // Run sweeper, it should clear the previously set create2 deposit and leave the total + { + sweeper_sweep( + &sweeper.1, + outpace.0.to_fixed_bytes(), + &channel, + *spender.as_bytes(), + ) + .await + .expect("Should sweep the Spender account"); + + let swept_deposit = eth_adapter + .get_deposit(&channel, &spender) + .await + .expect("should get deposit"); + + assert_eq!( + Deposit { + total: BigNum::from(11_999), + // we've just swept the account, so create2 should be empty + still_on_create2: BigNum::from(0), + }, + swept_deposit + ); + } } } diff --git a/adapter/src/ethereum/error.rs b/adapter/src/ethereum/error.rs index c4e4e5b30..5826115ea 100644 --- a/adapter/src/ethereum/error.rs +++ b/adapter/src/ethereum/error.rs @@ -1,5 +1,8 @@ -use primitives::adapter::{AdapterErrorKind, Error as AdapterError}; -use primitives::ChannelId; +use primitives::{ + adapter::{AdapterErrorKind, Error as AdapterError}, + address::Error as AddressError, + Address, ChannelId, +}; use std::fmt; #[derive(Debug)] @@ -22,6 +25,8 @@ pub enum Error { ContractQuerying(web3::contract::Error), /// Error occurred during verification of Signature and/or StateRoot and/or Address VerifyAddress(VerifyError), + TokenNotWhitelisted(Address), + InvalidDepositAsset(AddressError), } impl std::error::Error for Error {} @@ -43,7 +48,9 @@ impl fmt::Display for Error { VerifyMessage(err) => write!(f, "Verifying message: {}", err), ContractInitialization(err) => write!(f, "Contract initialization: {}", err), ContractQuerying(err) => write!(f, "Contract querying: {}", err), - VerifyAddress(err) => write!(f, "Verifying address: {}", err) + VerifyAddress(err) => write!(f, "Verifying address: {}", err), + TokenNotWhitelisted(deposit_asset) => write!(f, "Token not whitelisted: {}", deposit_asset), + InvalidDepositAsset(err) => write!(f, "Deposit asset {} is invalid", err), } } } diff --git a/adapter/src/ethereum/test_utils.rs b/adapter/src/ethereum/test_utils.rs new file mode 100644 index 000000000..0dbb4b5fb --- /dev/null +++ b/adapter/src/ethereum/test_utils.rs @@ -0,0 +1,240 @@ +use lazy_static::lazy_static; +use std::{collections::HashMap, num::NonZeroU8}; +use web3::{ + contract::{Contract, Options}, + ethabi::Token, + transports::Http, + types::{H160, H256, U256}, + Web3, +}; + +use primitives::{ + adapter::KeystoreOptions, + channel_v5::{Channel, Nonce}, + config::{configuration, TokenInfo}, + Address, BigNum, ValidatorId, +}; + +use crate::EthereumAdapter; + +use super::{EthereumChannel, OUTPACE_ABI, SWEEPER_ABI}; + +// See `adex-eth-protocol` `contracts/mocks/Token.sol` +lazy_static! { + /// Mocked Token ABI + pub static ref MOCK_TOKEN_ABI: &'static [u8] = + include_bytes!("../../test/resources/mock_token_abi.json"); + /// Mocked Token bytecode in JSON + pub static ref MOCK_TOKEN_BYTECODE: &'static str = + include_str!("../../test/resources/mock_token_bytecode.bin"); + /// Sweeper bytecode + pub static ref SWEEPER_BYTECODE: &'static str = include_str!("../../../lib/protocol-eth/resources/bytecode/Sweeper.bin"); + /// Outpace bytecode + pub static ref OUTPACE_BYTECODE: &'static str = include_str!("../../../lib/protocol-eth/resources/bytecode/OUTPACE.bin"); + pub static ref GANACHE_ADDRESSES: HashMap = { + vec![ + ( + "leader".to_string(), + "0x5a04A8fB90242fB7E1db7d1F51e268A03b7f93A5" + .parse() + .expect("Valid Address"), + ), + ( + "follower".to_string(), + "0xe3896ebd3F32092AFC7D27e9ef7b67E26C49fB02" + .parse() + .expect("Valid Address"), + ), + ( + "creator".to_string(), + "0x0E45891a570Af9e5A962F181C219468A6C9EB4e1" + .parse() + .expect("Valid Address"), + ), + ( + "advertiser".to_string(), + "0x8c4B95383a46D30F056aCe085D8f453fCF4Ed66d" + .parse() + .expect("Valid Address"), + ), + ] + .into_iter() + .collect() + }; +} + +pub const GANACHE_URL: &'static str = "http://localhost:8545"; + +pub fn get_test_channel(token_address: Address) -> Channel { + Channel { + leader: ValidatorId::from(&GANACHE_ADDRESSES["leader"]), + follower: ValidatorId::from(&GANACHE_ADDRESSES["follower"]), + guardian: GANACHE_ADDRESSES["advertiser"], + token: token_address, + nonce: Nonce::from(12345_u32), + } +} + +pub fn setup_eth_adapter( + sweeper_address: Option<[u8; 20]>, + outpace_address: Option<[u8; 20]>, + token_whitelist: Option<(Address, TokenInfo)>, +) -> EthereumAdapter { + let mut config = configuration("development", None).expect("failed parse config"); + let keystore_options = KeystoreOptions { + keystore_file: "./test/resources/keystore.json".to_string(), + keystore_pwd: "adexvalidator".to_string(), + }; + + if let Some(address) = sweeper_address { + config.sweeper_address = address; + } + + if let Some(address) = outpace_address { + config.outpace_address = address; + } + + if let Some((address, token_info)) = token_whitelist { + assert!( + config + .token_address_whitelist + .insert(address, token_info) + .is_none(), + "It should not contain the generated token prior to this call!" + ) + } + + EthereumAdapter::init(keystore_options, &config).expect("should init ethereum adapter") +} + +pub async fn mock_set_balance( + token_contract: &Contract, + from: [u8; 20], + address: [u8; 20], + amount: u64, +) -> web3::contract::Result { + tokio_compat_02::FutureExt::compat(token_contract.call( + "setBalanceTo", + (H160(address), U256::from(amount)), + H160(from), + Options::default(), + )) + .await +} + +pub async fn outpace_deposit( + outpace_contract: &Contract, + channel: &Channel, + to: [u8; 20], + amount: u64, +) -> web3::contract::Result { + tokio_compat_02::FutureExt::compat(outpace_contract.call( + "deposit", + (channel.tokenize(), H160(to), U256::from(amount)), + H160(to), + Options::with(|opt| { + opt.gas_price = Some(1.into()); + opt.gas = Some(6_721_975.into()); + }), + )) + .await +} + +pub async fn sweeper_sweep( + sweeper_contract: &Contract, + outpace_address: [u8; 20], + channel: &Channel, + depositor: [u8; 20], +) -> web3::contract::Result { + let from_leader_account = H160(*GANACHE_ADDRESSES["leader"].as_bytes()); + + tokio_compat_02::FutureExt::compat(sweeper_contract.call( + "sweep", + ( + Token::Address(H160(outpace_address)), + channel.tokenize(), + Token::Array(vec![Token::Address(H160(depositor))]), + ), + from_leader_account, + Options::with(|opt| { + opt.gas_price = Some(1.into()); + opt.gas = Some(6_721_975.into()); + }), + )) + .await +} + +/// Deploys the Sweeper contract from `GANACHE_ADDRESS['leader']` +pub async fn deploy_sweeper_contract( + web3: &Web3, +) -> web3::contract::Result<(H160, Contract)> { + let from_leader_account = H160(*GANACHE_ADDRESSES["leader"].as_bytes()); + + let feature = tokio_compat_02::FutureExt::compat(async { + Contract::deploy(web3.eth(), &SWEEPER_ABI) + .expect("Invalid ABI of Sweeper contract") + .confirmations(0) + .options(Options::with(|opt| { + opt.gas_price = Some(1.into()); + opt.gas = Some(6_721_975.into()); + })) + .execute(*SWEEPER_BYTECODE, (), from_leader_account) + }) + .await; + + let sweeper_contract = tokio_compat_02::FutureExt::compat(feature).await?; + + Ok((sweeper_contract.address(), sweeper_contract)) +} + +/// Deploys the Outpace contract from `GANACHE_ADDRESS['leader']` +pub async fn deploy_outpace_contract( + web3: &Web3, +) -> web3::contract::Result<(H160, Contract)> { + let from_leader_account = H160(*GANACHE_ADDRESSES["leader"].as_bytes()); + + let feature = tokio_compat_02::FutureExt::compat(async { + Contract::deploy(web3.eth(), &OUTPACE_ABI) + .expect("Invalid ABI of Sweeper contract") + .confirmations(0) + .options(Options::with(|opt| { + opt.gas_price = Some(1.into()); + opt.gas = Some(6_721_975.into()); + })) + .execute(*OUTPACE_BYTECODE, (), from_leader_account) + }) + .await; + + let outpace_contract = tokio_compat_02::FutureExt::compat(feature).await?; + + Ok((outpace_contract.address(), outpace_contract)) +} + +/// Deploys the Mock Token contract from `GANACHE_ADDRESS['leader']` +pub async fn deploy_token_contract( + web3: &Web3, + min_token_units: u64, +) -> web3::contract::Result<(TokenInfo, H160, Contract)> { + let from_leader_account = H160(*GANACHE_ADDRESSES["leader"].as_bytes()); + + let feature = tokio_compat_02::FutureExt::compat(async { + Contract::deploy(web3.eth(), &MOCK_TOKEN_ABI) + .expect("Invalid ABI of Mock Token contract") + .confirmations(0) + .options(Options::with(|opt| { + opt.gas_price = Some(1.into()); + opt.gas = Some(6_721_975.into()); + })) + .execute(*MOCK_TOKEN_BYTECODE, (), from_leader_account) + }) + .await; + + let token_contract = tokio_compat_02::FutureExt::compat(feature).await?; + + let token_info = TokenInfo { + min_token_units_for_deposit: BigNum::from(min_token_units), + precision: NonZeroU8::new(18).expect("should create NonZeroU8"), + }; + + Ok((token_info, token_contract.address(), token_contract)) +} diff --git a/adapter/src/lib.rs b/adapter/src/lib.rs index e13b74cc8..d6c52fe1a 100644 --- a/adapter/src/lib.rs +++ b/adapter/src/lib.rs @@ -4,11 +4,7 @@ use std::error::Error; -use chrono::{DateTime, Utc}; -use hex::FromHex; -use primitives::{channel::ChannelError, Address, BigNum, Channel, ValidatorId}; -use sha2::{Digest, Sha256}; -use std::convert::TryFrom; +use primitives::{channel::ChannelError, Address, BigNum}; use tiny_keccak::Keccak; use web3::{ ethabi::{encode, token::Token}, @@ -65,146 +61,6 @@ pub fn get_balance_leaf(acc: &Address, amnt: &BigNum) -> Result<[u8; 32], Box, - pub spec: [u8; 32], -} - -impl TryFrom<&Channel> for EthereumChannel { - type Error = ChannelError; - - fn try_from(channel: &Channel) -> Result { - let spec = serde_json::to_string(&channel.spec) - .map_err(|e| ChannelError::InvalidArgument(e.to_string()))?; - - let mut hash = Sha256::new(); - hash.input(spec); - let spec_hash: [u8; 32] = hash.result().into(); - - let validators = channel - .spec - .validators - .iter() - .map(|v| &v.id) - .collect::>(); - - let creator = channel.creator.inner(); - let deposit_asset = <[u8; 20]>::from_hex(&channel.deposit_asset[2..]) - .map_err(|_| ChannelError::InvalidArgument("failed to parse deposit asset".into()))?; - - EthereumChannel::new( - &creator, - &deposit_asset, - &channel.deposit_amount.to_string(), - channel.valid_until, - &validators, - &spec_hash, - ) - } -} - -impl EthereumChannel { - pub fn new( - creator: &[u8; 20], - token_addr: &[u8; 20], - token_amount: &str, // big num string - valid_until: DateTime, - validators: &[&ValidatorId], - spec: &[u8; 32], - ) -> Result { - if BigNum::try_from(token_amount).is_err() { - return Err(ChannelError::InvalidArgument("invalid token amount".into())); - } - - let creator = EthAddress::from_slice(creator); - let token_addr = EthAddress::from_slice(token_addr); - let token_amount = U256::from_dec_str(&token_amount) - .map_err(|_| ChannelError::InvalidArgument("failed to parse token amount".into()))?; - let valid_until = U256::from_dec_str(&valid_until.timestamp().to_string()) - .map_err(|_| ChannelError::InvalidArgument("failed to parse valid until".into()))?; - - let validators = validators - .iter() - .map(|v| EthAddress::from_slice(v.as_bytes())) - .collect(); - - Ok(Self { - creator, - token_addr, - token_amount, - valid_until, - validators, - spec: spec.to_owned(), - }) - } - - pub fn hash(&self, contract_addr: &[u8; 20]) -> [u8; 32] { - let tokens = [ - Token::Address(EthAddress::from_slice(contract_addr)), - Token::Address(self.creator.to_owned()), - Token::Address(self.token_addr.to_owned()), - Token::Uint(self.token_amount.to_owned()), - Token::Uint(self.valid_until.to_owned()), - Token::Array( - self.validators - .iter() - .map(|v| Token::Address(v.to_owned())) - .collect(), - ), - Token::FixedBytes(self.spec.to_vec()), - ]; - - let encoded = encode(&tokens).to_vec(); - let mut result = Keccak::new_keccak256(); - result.update(&encoded); - - let mut res: [u8; 32] = [0; 32]; - result.finalize(&mut res); - - res - } - - pub fn to_solidity_tuple(&self) -> Token { - Token::Tuple(vec![ - Token::Address(self.creator.to_owned()), - Token::Address(self.token_addr.to_owned()), - Token::Uint(self.token_amount.to_owned()), - Token::Uint(self.valid_until.to_owned()), - Token::Array( - self.validators - .iter() - .map(|v| Token::Address(v.to_owned())) - .collect(), - ), - Token::FixedBytes(self.spec.to_vec()), - ]) - } - - pub fn hash_to_sign( - &self, - contract_addr: &str, - balance_root: &str, - ) -> Result<[u8; 32], Box> { - let root = <[u8; 32]>::from_hex(balance_root)?; - let addr = hex::decode(contract_addr)?; - get_signable_state_root(&addr, &root) - } - - pub fn hash_to_sign_hex( - &self, - contract_addr: &str, - balance_root: &str, - ) -> Result> { - let result = self.hash_to_sign(contract_addr, balance_root)?; - Ok(format!("0x{}", hex::encode(result))) - } -} - #[cfg(test)] mod test { use std::convert::TryFrom; diff --git a/adapter/test/resources/mock_token_abi.json b/adapter/test/resources/mock_token_abi.json new file mode 100644 index 000000000..237547b2e --- /dev/null +++ b/adapter/test/resources/mock_token_abi.json @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setBalanceTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/adapter/test/resources/mock_token_bytecode.bin b/adapter/test/resources/mock_token_bytecode.bin new file mode 100644 index 000000000..07d1c3750 --- /dev/null +++ b/adapter/test/resources/mock_token_bytecode.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50610a8f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063095ea7b31461006757806323b872dd1461009757806370a08231146100c7578063a2b0a1c7146100f7578063a9059cbb14610113578063dd62ed3e14610143575b600080fd5b610081600480360381019061007c919061081d565b610173565b60405161008e919061089a565b60405180910390f35b6100b160048036038101906100ac91906107ce565b6101c3565b6040516100be919061089a565b60405180910390f35b6100e160048036038101906100dc9190610769565b61045c565b6040516100ee91906108d5565b60405180910390f35b610111600480360381019061010c919061081d565b6104a4565b005b61012d6004803603810190610128919061081d565b6104eb565b60405161013a919061089a565b60405180910390f35b61015d60048036038101906101589190610792565b6106f5565b60405161016a91906108d5565b60405180910390f35b600081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023d906108b5565b60405180910390fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546102909190610957565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461031c9190610901565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156103ec576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161044991906108d5565b60405180910390a3600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561056e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610565906108b5565b60405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105b89190610957565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106449190610901565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106e391906108d5565b60405180910390a36001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008135905061074e81610a2b565b92915050565b60008135905061076381610a42565b92915050565b60006020828403121561077b57600080fd5b60006107898482850161073f565b91505092915050565b600080604083850312156107a557600080fd5b60006107b38582860161073f565b92505060206107c48582860161073f565b9150509250929050565b6000806000606084860312156107e357600080fd5b60006107f18682870161073f565b93505060206108028682870161073f565b925050604061081386828701610754565b9150509250925092565b6000806040838503121561083057600080fd5b600061083e8582860161073f565b925050602061084f85828601610754565b9150509250929050565b6108628161099d565b82525050565b60006108756012836108f0565b915061088082610a02565b602082019050919050565b610894816109c9565b82525050565b60006020820190506108af6000830184610859565b92915050565b600060208201905081810360008301526108ce81610868565b9050919050565b60006020820190506108ea600083018461088b565b92915050565b600082825260208201905092915050565b600061090c826109c9565b9150610917836109c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561094c5761094b6109d3565b5b828201905092915050565b6000610962826109c9565b915061096d836109c9565b9250828210156109805761097f6109d3565b5b828203905092915050565b6000610996826109a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f494e53554646494349454e545f46554e44530000000000000000000000000000600082015250565b610a348161098b565b8114610a3f57600080fd5b50565b610a4b816109c9565b8114610a5657600080fd5b5056fea264697066735822122012d9e565a541ef14f604411fe60ee4679227706bb736ccd2d5aeb4962f73033e64736f6c63430008010033 \ No newline at end of file diff --git a/adapter/test/resources/tokenabi.json b/adapter/test/resources/tokenabi.json deleted file mode 100644 index a360e3352..000000000 --- a/adapter/test/resources/tokenabi.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"setBalanceTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}] \ No newline at end of file diff --git a/adapter/test/resources/tokenbytecode.json b/adapter/test/resources/tokenbytecode.json deleted file mode 100644 index 9107a4460..000000000 --- a/adapter/test/resources/tokenbytecode.json +++ /dev/null @@ -1 +0,0 @@ -"608060405234801561001057600080fd5b506105fd806100206000396000f3fe608060405234801561001057600080fd5b5060043610610069576000357c01000000000000000000000000000000000000000000000000000000009004806323b872dd1461006e57806370a08231146100f4578063a2b0a1c71461014c578063a9059cbb1461019a575b600080fd5b6100da6004803603606081101561008457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610200565b604051808215151515815260200191505060405180910390f35b6101366004803603602081101561010a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610386565b6040518082815260200191505060405180910390f35b6101986004803603604081101561016257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103ce565b005b6101e6600480360360408110156101b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610415565b604051808215151515815260200191505060405180910390f35b600061024a6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361059a565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506102d46000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836105b3565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600061045f6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361059a565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506104e96000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836105b3565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008282111515156105a857fe5b818303905092915050565b60008082840190508381101515156105c757fe5b809150509291505056fea165627a7a72305820868f9d98bc02466f02dddb8feb6fdc69bdb5c3169e8bb4a57ae1d6a259873d820029" diff --git a/docs/config/dev.toml b/docs/config/dev.toml index a16add636..3ec9f9a98 100644 --- a/docs/config/dev.toml +++ b/docs/config/dev.toml @@ -20,11 +20,30 @@ ip_rate_limit = { type = 'ip', timeframe = 20000 } sid_rate_limit = { type = 'sid', timeframe = 20000 } ethereum_core_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' +# TODO: Replace with real contract address +outpace_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' +# TODO: Replace with real contract address +sweeper_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' + ethereum_network = 'http://localhost:8545' ethereum_adapter_relayer = 'https://goerli-relayer.adex.network' creators_whitelist = [] minimal_deposit = "0" minimal_fee = "0" -token_address_whitelist = [] validators_whitelist = [] + +[[token_address_whitelist]] +address = '0x73967c6a0904aa032c103b4104747e88c566b1a2' #DAI +min_token_units_for_deposit = '100000000' +precision = 18 + +[[token_address_whitelist]] +address = '0x509ee0d083ddf8ac028f2a56731412edd63223b9' #USDT +min_token_units_for_deposit = '100000000' +precision = 6 + +[[token_address_whitelist]] +address = '0x44dcfcead37be45206af6079648988b29284b2c6' #USDC +min_token_units_for_deposit = '100000000' +precision = 6 diff --git a/docs/config/prod.toml b/docs/config/prod.toml index a2c61e367..57e7b8fcb 100644 --- a/docs/config/prod.toml +++ b/docs/config/prod.toml @@ -19,11 +19,36 @@ validator_tick_timeout = 10000 ip_rate_limit = { type = 'ip', timeframe = 1200000 } sid_rate_limit = { type = 'sid', timeframe = 0 } ethereum_core_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' +# TODO: Replace with real contract address +outpace_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' +# TODO: Replace with real contract address +sweeper_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' + ethereum_network = 'http://localhost:8545' ethereum_adapter_relayer = 'https://relayer.adex.network' creators_whitelist = [] minimal_deposit = "0" minimal_fee = "0" -token_address_whitelist = ['0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', '0x6B175474E89094C44Da98b954EedeAC495271d0F'] validators_whitelist = [] + +[[token_address_whitelist]] +address = '0x6b175474e89094c44da98b954eedeac495271d0f' #DAI +min_token_units_for_deposit = '100000000' +precision = 18 + +[[token_address_whitelist]] +address = '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359' #SAI +min_token_units_for_deposit = '100000000' +precision = 18 + +[[token_address_whitelist]] +address = '0xdac17f958d2ee523a2206206994597c13d831ec7' #USDT +min_token_units_for_deposit = '100000000' +precision = 6 + +[[token_address_whitelist]] +address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' #USDC +min_token_units_for_deposit = '100000000' +precision = 6 + diff --git a/lib/protocol-eth b/lib/protocol-eth index 40f2c57fa..77748887d 160000 --- a/lib/protocol-eth +++ b/lib/protocol-eth @@ -1 +1 @@ -Subproject commit 40f2c57fad7aafcd09e15ca99a1513d278e51340 +Subproject commit 77748887d74bf861faf58dacad6d90b0c7224b82 diff --git a/primitives/src/adapter.rs b/primitives/src/adapter.rs index cc3ff58ac..f65f1a3a7 100644 --- a/primitives/src/adapter.rs +++ b/primitives/src/adapter.rs @@ -1,16 +1,21 @@ -use crate::channel::ChannelError; -use crate::channel_validator::ChannelValidator; -use crate::{Channel, DomainError, ValidatorId}; +use crate::{ + channel::ChannelError, channel_v5::Channel, Address, + BigNum, DomainError, ValidatorId, +}; use async_trait::async_trait; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; -use std::convert::From; -use std::fmt; +use std::{collections::HashMap, convert::From, fmt}; pub type AdapterResult = Result>; pub trait AdapterErrorKind: fmt::Debug + fmt::Display {} +#[derive(Debug, Clone, Eq, PartialEq)] +pub struct Deposit { + pub total: BigNum, + pub still_on_create2: BigNum, +} + #[derive(Debug)] pub enum Error { Authentication(String), @@ -70,7 +75,7 @@ pub struct Session { } #[async_trait] -pub trait Adapter: ChannelValidator + Send + Sync + fmt::Debug + Clone { +pub trait Adapter: Send + Sync + fmt::Debug + Clone { type AdapterError: AdapterErrorKind + 'static; /// Unlock adapter @@ -90,12 +95,6 @@ pub trait Adapter: ChannelValidator + Send + Sync + fmt::Debug + Clone { signature: &str, ) -> AdapterResult; - /// Validate a channel - async fn validate_channel<'a>( - &'a self, - channel: &'a Channel, - ) -> AdapterResult; - /// Get user session from token async fn session_from_token<'a>( &'a self, @@ -104,4 +103,11 @@ pub trait Adapter: ChannelValidator + Send + Sync + fmt::Debug + Clone { /// Gets authentication for specific validator fn get_auth(&self, validator_id: &ValidatorId) -> AdapterResult; + + /// Calculates and returns the total spendable amount + async fn get_deposit( + &self, + channel: &Channel, + address: &Address, + ) -> AdapterResult; } diff --git a/primitives/src/address.rs b/primitives/src/address.rs index 8c31a562a..7be07881f 100644 --- a/primitives/src/address.rs +++ b/primitives/src/address.rs @@ -124,9 +124,9 @@ mod de { where D: Deserializer<'de>, { - let validator_id = String::deserialize(deserializer)?; + let address = String::deserialize(deserializer)?; - from_bytes(validator_id, Prefix::Insensitive).map_err(serde::de::Error::custom) + from_bytes(address, Prefix::Insensitive).map_err(serde::de::Error::custom) } } diff --git a/primitives/src/channel.rs b/primitives/src/channel.rs index e991fbfd6..507d4060b 100644 --- a/primitives/src/channel.rs +++ b/primitives/src/channel.rs @@ -21,6 +21,12 @@ pub struct ChannelId( [u8; 32], ); +impl ChannelId { + pub fn as_bytes(&self) -> &[u8; 32] { + &self.0 + } +} + impl fmt::Debug for ChannelId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "ChannelId({})", self) diff --git a/primitives/src/channel_validator.rs b/primitives/src/channel_validator.rs index 18b1e91e6..ecb10e175 100644 --- a/primitives/src/channel_validator.rs +++ b/primitives/src/channel_validator.rs @@ -1,9 +1,11 @@ use crate::channel::{Channel, ChannelError, SpecValidator, SpecValidators}; -use crate::config::Config; +use crate::config::{Config, TokenInfo}; +use crate::Address; use crate::BigNum; use crate::ValidatorId; use chrono::Utc; use std::cmp::PartialEq; +use std::collections::HashMap; use time::Duration; // @@ -99,11 +101,11 @@ pub fn creator_listed(channel: &Channel, whitelist: &[ValidatorId]) -> bool { whitelist.is_empty() || whitelist.iter().any(|allowed| allowed.eq(&channel.creator)) } -pub fn asset_listed(channel: &Channel, whitelist: &[String]) -> bool { +pub fn asset_listed(channel: &Channel, whitelist: &HashMap) -> bool { // if the list is empty, return true, as we don't have a whitelist to restrict us to // or if we have a list, check if it includes the `channel.deposit_asset` whitelist.is_empty() || whitelist - .iter() - .any(|allowed| allowed == &channel.deposit_asset) + .keys() + .any(|allowed| allowed.to_string() == channel.deposit_asset) } diff --git a/primitives/src/config.rs b/primitives/src/config.rs index 5c7de047e..e353c5601 100644 --- a/primitives/src/config.rs +++ b/primitives/src/config.rs @@ -1,9 +1,11 @@ use crate::event_submission::RateLimit; -use crate::{BigNum, ValidatorId}; +use crate::{Address, BigNum, ValidatorId}; use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Deserializer, Serialize}; use serde_hex::{SerHex, StrictPfx}; +use std::collections::HashMap; use std::fs; +use std::num::NonZeroU8; lazy_static! { static ref DEVELOPMENT_CONFIG: Config = @@ -14,6 +16,12 @@ lazy_static! { .expect("Failed to parse prod.toml config file"); } +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct TokenInfo { + pub min_token_units_for_deposit: BigNum, + pub precision: NonZeroU8, +} + #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all(serialize = "SCREAMING_SNAKE_CASE"))] pub struct Config { @@ -34,14 +42,52 @@ pub struct Config { pub creators_whitelist: Vec, pub minimal_deposit: BigNum, pub minimal_fee: BigNum, - pub token_address_whitelist: Vec, + #[serde(deserialize_with = "deserialize_token_whitelist")] + pub token_address_whitelist: HashMap, + /// DEPRECATED since this is v4! + #[deprecated(note = "REMOVE, this is V4")] #[serde(with = "SerHex::")] pub ethereum_core_address: [u8; 20], + #[serde(with = "SerHex::")] + pub outpace_address: [u8; 20], + #[serde(with = "SerHex::")] + pub sweeper_address: [u8; 20], pub ethereum_network: String, pub ethereum_adapter_relayer: String, pub validators_whitelist: Vec, } +#[derive(Serialize, Deserialize, Debug, Clone)] +struct ConfigWhitelist { + address: Address, + min_token_units_for_deposit: BigNum, + precision: NonZeroU8, +} + +fn deserialize_token_whitelist<'de, D>( + deserializer: D, +) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + let array: Vec = Deserialize::deserialize(deserializer)?; + + let tokens_whitelist: HashMap = array + .into_iter() + .map(|i| { + ( + i.address, + TokenInfo { + min_token_units_for_deposit: i.min_token_units_for_deposit, + precision: i.precision, + }, + ) + }) + .collect(); + + Ok(tokens_whitelist) +} + #[derive(Serialize, Deserialize, Debug, Clone)] pub enum ConfigError { InvalidFile(String), diff --git a/scripts/ethereum/ganache-cli.sh b/scripts/ethereum/ganache-cli.sh index 525ef5859..f20c1153a 100755 --- a/scripts/ethereum/ganache-cli.sh +++ b/scripts/ethereum/ganache-cli.sh @@ -2,14 +2,17 @@ # We use shell (`/bin/sh`) since the Docker image doesn't contain `/bin/bash` # runs in Docker, so leave default port and export it instead of setting it up here + +# Address 0: 0xDf08F82De32B8d460adbE8D72043E3a7e25A3B39 +# Address 1: 0x5a04A8fB90242fB7E1db7d1F51e268A03b7f93A5 +# Address 2: 0xe3896ebd3F32092AFC7D27e9ef7b67E26C49fB02 +# Address 3: 0x0E45891a570Af9e5A962F181C219468A6C9EB4e1 +# Address 4: 0x8c4B95383a46D30F056aCe085D8f453fCF4Ed66d +# Address 5: 0x1059B025E3F8b8f76A8120D6D6Fd9fBa172c80b8 node /app/ganache-core.docker.cli.js --gasLimit 0xfffffffffffff \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501203,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501204,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501205,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501206,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501207,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501208,9000000000000000000000000000" \ - --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501209,9000000000000000000000000000" + --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,9000000000000000000000000000" \ + --account="0xd66ecc35fe42ae2063888bfd11c4573db08bdbd5c2b9b835deef05beb43b407f,9000000000000000000000000000" \ + --account="0x1d00a65debb6143cebc3b48b11db2ddfa81411c1f7c443f706d4f2bd8145ee4a,9000000000000000000000000000" \ + --account="0x30e87297872f658845b755fe9e5ff319605a2513177a871110e25aebfe115f0f,9000000000000000000000000000" \ + --account="0xe001626993056febeae724da4cb5c1028a55ac40ce5df4b0c7441d51a843e3fc,9000000000000000000000000000" \ + --account="0xcb5158eccfe180f35d4c05483cfaf3f769210ade3fd1f281737d10d491b5be40,9000000000000000000000000000" \ diff --git a/sentry/src/routes/channel.rs b/sentry/src/routes/channel.rs index 9c485d78f..7ad81a370 100644 --- a/sentry/src/routes/channel.rs +++ b/sentry/src/routes/channel.rs @@ -49,9 +49,10 @@ pub async fn create_channel( let channel = serde_json::from_slice::(&body) .map_err(|e| ResponseError::FailedValidation(e.to_string()))?; - if let Err(e) = app.adapter.validate_channel(&channel).await { - return Err(ResponseError::BadRequest(e.to_string())); - } + // TODO AIP#61: No longer needed, remove! + // if let Err(e) = app.adapter.validate_channel(&channel).await { + // return Err(ResponseError::BadRequest(e.to_string())); + // } let error_response = ResponseError::BadRequest("err occurred; please try again later".into());