From 0c3194f445a252d1a106d9619c5775805be7f848 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Wed, 26 Oct 2022 22:29:38 +0000 Subject: [PATCH] upgrades and todo cleanup --- Cargo.lock | 448 ++++++++++++++++++------------- TODO.md | 50 ++-- redis-rate-limiter/Cargo.toml | 2 +- web3_proxy/Cargo.toml | 2 +- web3_proxy/src/block_number.rs | 13 +- web3_proxy/src/frontend/users.rs | 19 +- 6 files changed, 306 insertions(+), 228 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 90613217..53e207a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,11 +34,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "opaque-debug 0.3.0", ] +[[package]] +name = "aes" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe0133578c0986e1fe3dfcd4af1cc5b2dd6c3dbf534d69916ce16a2701d40ba" +dependencies = [ + "cfg-if", + "cipher 0.4.3", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.7.6" @@ -289,6 +300,18 @@ dependencies = [ "syn", ] +[[package]] +name = "auto_impl" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "auto_impl" version = "1.0.1" @@ -521,7 +544,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -542,7 +565,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.5", + "generic-array 0.14.6", ] [[package]] @@ -551,7 +574,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "generic-array 0.14.5", + "generic-array 0.14.6", ] [[package]] @@ -601,9 +624,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" dependencies = [ "serde", ] @@ -716,7 +739,17 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" dependencies = [ - "generic-array 0.14.5", + "generic-array 0.14.6", +] + +[[package]] +name = "cipher" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +dependencies = [ + "crypto-common", + "inout", ] [[package]] @@ -776,13 +809,13 @@ dependencies = [ "bincode", "bs58", "coins-core", - "digest 0.10.3", + "digest 0.10.5", "getrandom", "hmac", "k256", "lazy_static", "serde", - "sha2 0.10.2", + "sha2 0.10.6", "thiserror", ] @@ -799,7 +832,7 @@ dependencies = [ "hmac", "pbkdf2 0.11.0", "rand 0.8.5", - "sha2 0.10.2", + "sha2 0.10.6", "thiserror", ] @@ -813,28 +846,17 @@ dependencies = [ "base64 0.12.3", "bech32", "blake2", - "digest 0.10.3", - "generic-array 0.14.5", + "digest 0.10.5", + "generic-array 0.14.6", "hex", "ripemd", "serde", "serde_derive", - "sha2 0.10.2", + "sha2 0.10.6", "sha3", "thiserror", ] -[[package]] -name = "colored" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] - [[package]] name = "combine" version = "4.6.4" @@ -846,7 +868,7 @@ dependencies = [ "memchr", "pin-project-lite", "tokio", - "tokio-util 0.7.2", + "tokio-util", ] [[package]] @@ -912,9 +934,12 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "convert_case" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "core-foundation-sys" @@ -1031,7 +1056,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" dependencies = [ - "generic-array 0.14.5", + "generic-array 0.14.6", "subtle", ] @@ -1041,7 +1066,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f2b443d17d49dad5ef0ede301c3179cc923b8822f3393b4d2c28c269dd4a122" dependencies = [ - "generic-array 0.14.5", + "generic-array 0.14.6", "rand_core 0.6.3", "subtle", "zeroize", @@ -1053,17 +1078,17 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ - "generic-array 0.14.5", + "generic-array 0.14.6", "typenum", ] [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.3", ] [[package]] @@ -1082,9 +1107,9 @@ dependencies = [ [[package]] name = "deadpool-redis" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a62ebf187bc30bfc1a14bed4073912b988551d111208fe800b27c32df282481" +checksum = "8cb2945e05eeebc0f99795a135b2b15c038646d8292946621840d3cbff296e20" dependencies = [ "deadpool", "redis", @@ -1200,14 +1225,14 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.5", + "generic-array 0.14.6", ] [[package]] name = "digest" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" dependencies = [ "block-buffer 0.10.2", "crypto-common", @@ -1253,17 +1278,11 @@ version = "0.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03d8c417d7a8cb362e0c37e5d815f5eb7c37f79ff93707329d5a194e42e54ca0" -[[package]] -name = "dtoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" - [[package]] name = "dunce" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541" +checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" [[package]] name = "ecdsa" @@ -1285,16 +1304,16 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "elliptic-curve" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47abd0a791d2ac0c7aa1118715f85b83689e4522c4e3a244e159d4fc9848a8d" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint 0.4.8", "der 0.6.0", - "digest 0.10.3", + "digest 0.10.5", "ff", - "generic-array 0.14.5", + "generic-array 0.14.6", "group", "pkcs8 0.9.0", "rand_core 0.6.3", @@ -1347,21 +1366,21 @@ dependencies = [ [[package]] name = "eth-keystore" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aff9543a3535519a0d2ebbb6ae0afd58175258162e2fa4c1b57981edaad60fcb" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ - "aes", + "aes 0.8.1", "ctr", - "digest 0.10.3", + "digest 0.10.5", "hex", "hmac", - "pbkdf2 0.10.1", + "pbkdf2 0.11.0", "rand 0.8.5", "scrypt", "serde", "serde_json", - "sha2 0.10.2", + "sha2 0.10.6", "sha3", "thiserror", "uuid 0.8.2", @@ -1369,9 +1388,9 @@ dependencies = [ [[package]] name = "ethabi" -version = "17.1.0" +version = "17.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f186de076b3e77b8e6d73c99d1b52edc2a229e604f4b5eb6992c06c11d79d537" +checksum = "e4966fba78396ff92db3b817ee71143eccd98acf0f876b8d600e585a670c5d1b" dependencies = [ "ethereum-types", "hex", @@ -1392,8 +1411,10 @@ checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" dependencies = [ "crunchy", "fixed-hash", + "impl-codec", "impl-rlp", "impl-serde", + "scale-info", "tiny-keccak", ] @@ -1405,17 +1426,19 @@ checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" dependencies = [ "ethbloom", "fixed-hash", + "impl-codec", "impl-rlp", "impl-serde", "primitive-types", + "scale-info", "uint", ] [[package]] name = "ethers" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16142eeb3155cfa5aec6be3f828a28513a28bd995534f945fa70e7d608f16c10" +checksum = "b2f6be73d1978a881402f8ca28466199156b560ac36527224bbe632b14faa373" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1429,9 +1452,9 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e23f8992ecf45ea9dd2983696aabc566c108723585f07f5dc8c9efb24e52d3db" +checksum = "b4b8c9da375d178d59a50f9a5d31ede4475a0f60cd5184c3db00f172b25f7e11" dependencies = [ "ethers-core", "once_cell", @@ -1441,11 +1464,12 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0010fffc97c5abcf75a30fd75676b1ed917b2b82beb8270391333618e2847d" +checksum = "002a0d58a7d921b496f5f19b5b9508d01d25fbe25078286b1fcb6f4e7562acf7" dependencies = [ "ethers-contract-abigen", + "ethers-contract-derive", "ethers-core", "ethers-providers", "futures-util", @@ -1459,9 +1483,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda76ce804d524f693a898dc5857d08f4db443f3da64d0c36237fa05c0ecef30" +checksum = "486f389525de61c1c4807fddc804a151ca3c5a5b6f2dc759689424777b7ba617" dependencies = [ "Inflector", "cfg-if", @@ -1472,6 +1496,7 @@ dependencies = [ "hex", "proc-macro2", "quote", + "regex", "reqwest", "serde", "serde_json", @@ -1481,23 +1506,38 @@ dependencies = [ ] [[package]] -name = "ethers-core" -version = "0.17.0" +name = "ethers-contract-derive" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ebdd63c828f58aa067f40f9adcbea5e114fb1f90144b3a1e2858e0c9b1ff4e8" +checksum = "445276414690c97d88638d22dd5f89ba919d7dcea36de4825896d52280c704c7" +dependencies = [ + "ethers-contract-abigen", + "ethers-core", + "hex", + "proc-macro2", + "quote", + "serde_json", + "syn", +] + +[[package]] +name = "ethers-core" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06338c311c6a0a7ed04877d0fb0f0d627ed390aaa3429b4e041b8d17348a506d" dependencies = [ "arrayvec", "bytes", "cargo_metadata 0.15.0", "chrono", - "convert_case 0.5.0", + "convert_case 0.6.0", "elliptic-curve", "ethabi", - "fastrlp", - "generic-array 0.14.5", + "generic-array 0.14.6", "hex", "k256", "once_cell", + "open-fastrlp", "proc-macro2", "rand 0.8.5", "rlp", @@ -1514,9 +1554,9 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b279a3d00bd219caa2f9a34451b4accbfa9a1eaafc26dcda9d572591528435f0" +checksum = "6c3acd2c48d240ae13a4ed3ac88dc15b31bc1ba9513a072e080d4a32fda1637b" dependencies = [ "ethers-core", "getrandom", @@ -1531,11 +1571,12 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e7e8632d28175352b9454bbcb604643b6ca1de4d36dc99b3f86860d75c132b" +checksum = "f51bc2555522673e8a890b79615e04dd9ef40f0ab0a73e745024fdda15710d69" dependencies = [ "async-trait", + "auto_impl 0.5.0", "ethers-contract", "ethers-core", "ethers-etherscan", @@ -1556,12 +1597,12 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46482e4d1e79b20c338fd9db9e166184eb387f0a4e7c05c5b5c0aa2e8c8900c" +checksum = "6cc65f79e2168aac5ca4a659bb6639c78164a6a5b18c954cc7699b6ce5ac6275" dependencies = [ "async-trait", - "auto_impl", + "auto_impl 1.0.1", "base64 0.13.0", "ethers-core", "futures-channel", @@ -1593,9 +1634,9 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73a72ecad124e8ccd18d6a43624208cab0199e59621b1f0fa6b776b2e0529107" +checksum = "f1f97da069cd77dd91a0a7f0c979f063a4bf9d2533b277ff5ccb19b7ac348376" dependencies = [ "async-trait", "coins-bip32", @@ -1605,18 +1646,17 @@ dependencies = [ "ethers-core", "hex", "rand 0.8.5", - "sha2 0.10.2", + "sha2 0.10.6", "thiserror", ] [[package]] name = "ethers-solc" -version = "0.17.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5db405d0e584aa8dae154ffebb90f2305cae588fd11d9f6b857ebe3a79294" +checksum = "1ed856e3e0d07a0ffbc79157e3dd0ed10b45b6736eff6a878d40a1e57f224988" dependencies = [ "cfg-if", - "colored", "dunce", "ethers-core", "getrandom", @@ -1639,6 +1679,7 @@ dependencies = [ "tokio", "tracing", "walkdir", + "yansi", ] [[package]] @@ -1672,31 +1713,6 @@ dependencies = [ "instant", ] -[[package]] -name = "fastrlp" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "089263294bb1c38ac73649a6ad563dd9a5142c8dc0482be15b8b9acb22a1611e" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", - "ethereum-types", - "fastrlp-derive", -] - -[[package]] -name = "fastrlp-derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fa41ebc231af281098b11ad4a4f6182ec9096902afffe948034a20d4e1385a" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "fdlimit" version = "0.2.1" @@ -1984,9 +2000,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -2043,7 +2059,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.2", + "tokio-util", "tracing", ] @@ -2167,14 +2183,14 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] name = "home" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" +checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" dependencies = [ "winapi", ] @@ -2377,6 +2393,15 @@ dependencies = [ "libc", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "instant" version = "0.1.12" @@ -2453,7 +2478,7 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "sha2 0.10.2", + "sha2 0.10.6", "sha3", ] @@ -2578,11 +2603,11 @@ checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" [[package]] name = "md-5" -version = "0.10.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658646b21e0b72f7866c7038ab086d3d5e1cd6271f060fd37defb241949d0582" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -2884,9 +2909,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" +checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "opaque-debug" @@ -2900,6 +2925,31 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "open-fastrlp" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "131de184f045153e72c537ef4f1d57babddf2a897ca19e67bdff697aebba7f3d" +dependencies = [ + "arrayvec", + "auto_impl 1.0.1", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "os_str_bytes" version = "6.1.0" @@ -3049,9 +3099,9 @@ checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" [[package]] name = "path-slash" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54014ba3c1880122928735226f78b6f5bf5bd1fed15e41e92cf7aa20278ce28" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" [[package]] name = "pbkdf2" @@ -3059,10 +3109,10 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "hmac", "password-hash 0.3.2", - "sha2 0.10.2", + "sha2 0.10.6", ] [[package]] @@ -3071,10 +3121,10 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "hmac", "password-hash 0.4.2", - "sha2 0.10.2", + "sha2 0.10.6", ] [[package]] @@ -3311,6 +3361,7 @@ dependencies = [ "impl-codec", "impl-rlp", "impl-serde", + "scale-info", "uint", ] @@ -3356,9 +3407,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.42" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -3578,20 +3629,20 @@ dependencies = [ [[package]] name = "redis" -version = "0.21.5" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a80b5f38d7f5a020856a0e16e40a9cfabf88ae8f0e4c2dcd8a3114c1e470852" +checksum = "513b3649f1a111c17954296e4a3b9eecb108b766c803e2b99f179ebe27005985" dependencies = [ "async-trait", "bytes", "combine", - "dtoa", "futures-util", - "itoa 0.4.8", + "itoa 1.0.2", "percent-encoding", "pin-project-lite", + "ryu", "tokio", - "tokio-util 0.6.10", + "tokio-util", "url", ] @@ -3737,7 +3788,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1facec54cb5e0dc08553501fa740091086d0259ad0067e0d4103448e4cb22ed3" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -3768,7 +3819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b" dependencies = [ "byteorder", - "digest 0.10.3", + "digest 0.10.5", "num-bigint-dig", "num-integer", "num-iter", @@ -3783,9 +3834,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.25.0" +version = "1.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34a3bb58e85333f1ab191bf979104b586ebd77475bc6681882825f4532dfe87c" +checksum = "ee9164faf726e4f3ece4978b25ca877ddc6802fa77f38cdccb32c7f805ecd70c" dependencies = [ "arrayvec", "num-traits", @@ -3854,11 +3905,11 @@ checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "salsa20" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher", + "cipher 0.4.3", ] [[package]] @@ -3870,6 +3921,30 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scale-info" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "scheduled-thread-pool" version = "0.2.6" @@ -3887,15 +3962,14 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scrypt" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73d6d7c6311ebdbd9184ad6c4447b2f36337e327bda107d3ba9e3c374f9d325" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" dependencies = [ "hmac", - "password-hash 0.3.2", - "pbkdf2 0.10.1", + "pbkdf2 0.11.0", "salsa20", - "sha2 0.10.2", + "sha2 0.10.6", ] [[package]] @@ -4076,7 +4150,7 @@ checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ "base16ct", "der 0.6.0", - "generic-array 0.14.5", + "generic-array 0.14.6", "pkcs8 0.9.0", "subtle", "zeroize", @@ -4084,9 +4158,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" dependencies = [ "serde", ] @@ -4211,9 +4285,9 @@ dependencies = [ [[package]] name = "serde-aux" -version = "3.1.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a77223b653fa95f3f9864f3eb25b93e4ed170687eb42d85b6b98af21d5e1de" +checksum = "c79c1a5a310c28bf9f7a4b9bd848553051120d80a5952f993c7eb62f6ed6e4c5" dependencies = [ "serde", "serde_json", @@ -4276,7 +4350,7 @@ checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -4287,7 +4361,7 @@ checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -4317,13 +4391,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -4332,7 +4406,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaedf34ed289ea47c2b741bb72e5357a209512d67bcd4bda44359e5bf0470f56" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "keccak", ] @@ -4360,7 +4434,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "rand_core 0.6.3", ] @@ -4449,9 +4523,9 @@ dependencies = [ [[package]] name = "solang-parser" -version = "0.1.16" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f68b8280e3f354d5646218319bcee4febe42833cef5ebf653cfc49d0a94409" +checksum = "ac8ac4bfef383f368bd9bb045107a501cd9cd0b64ad1983e1b7e839d6a44ecad" dependencies = [ "itertools", "lalrpop", @@ -4530,7 +4604,7 @@ dependencies = [ "chrono", "crc", "crossbeam-queue", - "digest 0.10.3", + "digest 0.10.5", "dotenvy", "either", "event-listener", @@ -4538,7 +4612,7 @@ dependencies = [ "futures-core", "futures-intrusive", "futures-util", - "generic-array 0.14.5", + "generic-array 0.14.6", "hashlink", "hex", "indexmap", @@ -4558,7 +4632,7 @@ dependencies = [ "serde", "serde_json", "sha1", - "sha2 0.10.2", + "sha2 0.10.6", "smallvec", "sqlformat", "sqlx-rt", @@ -4584,7 +4658,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "sha2 0.10.2", + "sha2 0.10.6", "sqlx-core", "sqlx-rt", "syn", @@ -4673,9 +4747,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "svm-rs" -version = "0.2.13" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55e00b6f95abd889ce398bd7eab2a9c62cd27281cf1bfba70847340557434cf" +checksum = "4e4cdcf91153dc0e4e0637f26f042ada32a3b552bc8115935c7bf96f80132b0a" dependencies = [ "anyhow", "cfg-if", @@ -4704,9 +4778,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.98" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -4794,18 +4868,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", @@ -4947,7 +5021,7 @@ dependencies = [ "futures-core", "pin-project-lite", "tokio", - "tokio-util 0.7.2", + "tokio-util", ] [[package]] @@ -4966,20 +5040,6 @@ dependencies = [ "webpki-roots", ] -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.2" @@ -5268,9 +5328,9 @@ checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unicode_categories" @@ -5663,6 +5723,12 @@ dependencies = [ "tap", ] +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + [[package]] name = "zeroize" version = "1.5.7" @@ -5675,7 +5741,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf225bcf73bb52cbb496e70475c7bd7a3f769df699c0020f6c7bd9a96dcf0b8d" dependencies = [ - "aes", + "aes 0.7.5", "byteorder", "bzip2", "constant_time_eq", diff --git a/TODO.md b/TODO.md index 6f159590..fcc7f817 100644 --- a/TODO.md +++ b/TODO.md @@ -194,9 +194,8 @@ These are roughly in order of completition - [x] config to allow origins even on the anonymous endpoints - [x] send logs to sentry - [x] login should return the user id -- [-] ability to domain lock or ip lock said key - - the code to check the database and use these entries already exists, but users don't have a way to set them -- [-] new endpoints for users (not totally sure about the exact paths, but these features are all needed): +- [x] when we show keys, also show the key's id +- [x] new endpoints for users (not totally sure about the exact paths, but these features are all needed): - [x] sign in - [x] sign out - [x] GET profile endpoint @@ -205,13 +204,12 @@ These are roughly in order of completition - [x] display distribution of methods per api key (eth_call, eth_getLogs, etc.) (only with authentication!) - [x] get aggregate stats endpoint - [x] display requests per second per api key (only with authentication!) - - [ ] POST key endpoint - - [ ] generate a new key from a web endpoint - - [ ] modifying key settings such as private relay, revert logging, ip/origin/etc checks + - [x] POST key endpoint + - [x] generate a new key from a web endpoint + - [x] modifying key settings such as private relay, revert logging, ip/origin/etc checks - [x] GET logged reverts on an endpoint that **requires authentication**. - [ ] add config for concurrent requests from public requests -- [ ] per-user stats should probably be locked behind authentication. the code is written but disabled for easy development - - if we do this, we should also have an admin-only endpoint for seeing these for support requests +- [ ] document url params with examples - [ ] display concurrent requests per api key (only with authentication!) - [ ] endpoint for creating/modifying api keys and their advanced security features - [ ] include if archive query or not in the stats @@ -222,13 +220,7 @@ These are roughly in order of completition - [-] let users choose a % to log (or maybe x/second). someone like curve logging all reverts will be a BIG database very quickly - this must be opt-in or spawned since it will slow things down and will make their calls less private - [ ] we currently default to 0.0 and don't expose a way to edit it. we have a database row, but we don't use it -- [ ] document url params with examples - [ ] endpoint to list keys without having to sign a message to log in again -- [ ] when we show keys, also show the key's id -- [ ] WARN http_request:request: web3_proxy::block_number: could not get block from params err=unexpected params length id=01GF4HTRKM4JV6NX52XSF9AYMW method=POST authorized_request=User(Some(SqlxMySqlPoolConnection), AuthorizedKey { ip: 10.11.12.15, origin: None, user_key_id: 4, log_revert_chance: 0.0000 }) -- ERROR http_request:request:try_send_all_upstream_servers: web3_proxy::rpcs::request: bad response! err=JsonRpcClientError(JsonRpcError(JsonRpcError { code: -32000, message: "INTERNAL_ERROR: existing tx with same hash", data: None })) method=eth_sendRawTransaction rpc=local_erigon_alpha_archive id=01GF4HV03Y4ZNKQV8DW5NDQ5CG method=POST authorized_request=User(Some(SqlxMySqlPoolConnection), AuthorizedKey { ip: 10.11.12.15, origin: None, user_key_id: 4, log_revert_chance: 0.0000 }) self=Web3Connections { conns: {"local_erigon_alpha_archive_ws": Web3Connection { name: "local_erigon_alpha_archive_ws", blocks: "all", .. }, "local_geth_ws": Web3Connection { name: "local_geth_ws", blocks: 64, .. }, "local_erigon_alpha_archive": Web3Connection { name: "local_erigon_alpha_archive", blocks: "all", .. }}, .. } authorized_request=Some(User(Some(SqlxMySqlPoolConnection), AuthorizedKey { ip: 10.11.12.15, origin: None, user_key_id: 4, log_revert_chance: 0.0000 })) request=JsonRpcRequest { id: RawValue(39), method: "eth_sendRawTransaction", .. } request_metadata=Some(RequestMetadata { datetime: 2022-10-11T22:14:57.406829095Z, period_seconds: 60, request_bytes: 633, backend_requests: 0, no_servers: 0, error_response: false, response_bytes: 0, response_millis: 0 }) block_needed=None - - why is it failing to get the block from params when its set to None? That should be the simple case -- [ ] if user-specific caches have evictions that aren't from timeouts, log a warning - [ ] make the "not synced" error more verbose - I think there is a bug in our synced_rpcs filtering. likely in has_block_data - seeing "not synced" when I load https://vfat.tools/esd/ @@ -241,16 +233,6 @@ These are roughly in order of completition - [ ] if no bearer token found in redis (likely because it expired), send 401 unauthorized - [ ] user create script should allow multiple keys per user - [ ] somehow the proxy thought latest was hours behind. need internal health check that forces reconnect if this happens -- [ ] WARN http_request: web3_proxy::frontend::errors: anyhow err=UserKey was not a ULID or UUID id=01GER4VBTS0FDHEBR96D1JRDZF method=POST - - if invalid user id given, we give a 500. should be a different error code instead -- [ ] BUG: i think if all backend servers stop, the server doesn't properly reconnect. It appears to stop listening on 8854, but not shut down. -- [ ] BUG? WARN web3_proxy::rpcs::blockchain: Missing connection_head_block in block_hashes. Fetching now connection_head_hash=0x4b7a…14b5 conn_name=local_erigon_alpha_archive rpc=local_erigon_alpha_archive - - i see this a lot more than expected. why is it happening so much? better logs needed -- [ ] from what i thought, /status should show hashes > numbers! - - but block numbers count is maxed out (10k) - - and block hashes count is tiny (83) - - what is going on? when the server fist launches they are in sync -- [ ] after adding semaphores (or maybe something else), CPU load seems a lot higher. investigate - [ ] Ulid instead of Uuid for database ids - might have to use Uuid in sea-orm and then convert to Ulid on display - [ ] add pruning or aggregating or something to log revert trace. otherwise our databases are going to grow really big @@ -260,6 +242,25 @@ These are roughly in order of completition These are not yet ordered. +- [ ] BUG! if sending transactions gets "INTERNAL_ERROR: existing tx with same hash", fake a success message + - ERROR http_request:request:try_send_all_upstream_servers: web3_proxy::rpcs::request: bad response! err=JsonRpcClientError(JsonRpcError(JsonRpcError { code: -32000, message: "INTERNAL_ERROR: existing tx with same hash", data: None })) method=eth_sendRawTransaction rpc=local_erigon_alpha_archive id=01GF4HV03Y4ZNKQV8DW5NDQ5CG method=POST authorized_request=User(Some(SqlxMySqlPoolConnection), AuthorizedKey { ip: 10.11.12.15, origin: None, user_key_id: 4, log_revert_chance: 0.0000 }) self=Web3Connections { conns: {"local_erigon_alpha_archive_ws": Web3Connection { name: "local_erigon_alpha_archive_ws", blocks: "all", .. }, "local_geth_ws": Web3Connection { name: "local_geth_ws", blocks: 64, .. }, "local_erigon_alpha_archive": Web3Connection { name: "local_erigon_alpha_archive", blocks: "all", .. }}, .. } authorized_request=Some(User(Some(SqlxMySqlPoolConnection), AuthorizedKey { ip: 10.11.12.15, origin: None, user_key_id: 4, log_revert_chance: 0.0000 })) request=JsonRpcRequest { id: RawValue(39), method: "eth_sendRawTransaction", .. } request_metadata=Some(RequestMetadata { datetime: 2022-10-11T22:14:57.406829095Z, period_seconds: 60, request_bytes: 633, backend_requests: 0, no_servers: 0, error_response: false, response_bytes: 0, response_millis: 0 }) block_needed=None +- [ ] BUG? WARN http_request:request: web3_proxy::block_number: could not get block from params err=unexpected params length id=01GF4HTRKM4JV6NX52XSF9AYMW method=POST authorized_request=User(Some(SqlxMySqlPoolConnection), AuthorizedKey { ip: 10.11.12.15, origin: None, user_key_id: 4, log_revert_chance: 0.0000 }) + - why is it failing to get the block from params when its set to None? That should be the simple case +- [ ] BUG: i think if all backend servers stop, the server doesn't properly reconnect. It appears to stop listening on 8854, but not shut down. +- [ ] if user-specific caches have evictions that aren't from timeouts, log a warning +- [ ] make sure the email address is valid. probably have a "verified" column in the database +- [ ] if invalid user id given, we give a 500. should be a different error code instead + - WARN http_request: web3_proxy::frontend::errors: anyhow err=UserKey was not a ULID or UUID id=01GER4VBTS0FDHEBR96D1JRDZF method=POST +- [ ] admin-only endpoint for seeing a user's stats for support requests +- [ ] from what i thought, /status should show hashes > numbers! + - but block numbers count is maxed out (10k) + - and block hashes count is tiny (83) + - what is going on? when the server fist launches they are in sync + - [ ] related BUG? WARN web3_proxy::rpcs::blockchain: Missing connection_head_block in block_hashes. Fetching now connection_head_hash=0x4b7a…14b5 conn_name=local_erigon_alpha_archive rpc=local_erigon_alpha_archive + - i see this a lot more than expected. why is it happening so much? better logs needed + +- [ ] after adding semaphores (or maybe something else), CPU load seems a lot higher. investigate +- [ ] proper support for Finalized and Safe block queries - [ ] admin-only page for viewing user stat pages - [ ] geth sometimes gives an empty response instead of an error response. figure out a good way to catch this and not serve it - [ ] GET balance endpoint @@ -463,3 +464,4 @@ in another repo: event subscriber - [ ] having tons of worker threads can actually make us slower if they keep waking to steal work from eachother. need benchmarks - [ ] change the wrk data to log requests and errors to a file - [ ] if redis is not set and login page is visited, users get a 502. should be 501 +- [ ] allow passing the authorization header to the anonymous rpc endpoint diff --git a/redis-rate-limiter/Cargo.toml b/redis-rate-limiter/Cargo.toml index 01bf401a..48ecb4a4 100644 --- a/redis-rate-limiter/Cargo.toml +++ b/redis-rate-limiter/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" [dependencies] anyhow = "1.0.66" -deadpool-redis = { version = "0.10.2", features = ["rt_tokio_1", "serde"] } +deadpool-redis = { version = "0.11.0", features = ["rt_tokio_1", "serde"] } tracing = "0.1.37" tokio = "1.21.2" diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index 4fe67fee..0ca81f9c 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -30,7 +30,7 @@ chrono = "0.4.22" counter = "0.5.7" derive_more = "0.99.17" dotenv = "0.15.0" -ethers = { version = "0.17.0", features = ["rustls", "ws"] } +ethers = { version = "1.0.0", features = ["rustls", "ws"] } fdlimit = "0.2.1" flume = "0.10.14" futures = { version = "0.3.25", features = ["thread-pool"] } diff --git a/web3_proxy/src/block_number.rs b/web3_proxy/src/block_number.rs index 455047fd..6bef5de6 100644 --- a/web3_proxy/src/block_number.rs +++ b/web3_proxy/src/block_number.rs @@ -14,9 +14,12 @@ pub fn block_num_to_u64(block_num: BlockNumber, latest_block: U64) -> U64 { // modified is false because we want the backend to see "pending" U64::zero() } + BlockNumber::Finalized => { + warn!("finalized block requested! not yet implemented!"); + latest_block - 10 + } BlockNumber::Latest => { // change "latest" to a number - // modified is true because we want the backend to see the height and not "latest" latest_block } BlockNumber::Number(x) => { @@ -25,9 +28,12 @@ pub fn block_num_to_u64(block_num: BlockNumber, latest_block: U64) -> U64 { } BlockNumber::Pending => { // TODO: think more about how to handle Pending - // modified is false because we want the backend to see "pending" latest_block } + BlockNumber::Safe => { + warn!("finalized block requested! not yet implemented!"); + latest_block - 3 + } } } @@ -134,7 +140,8 @@ pub async fn block_needed( let block_num = block_num_to_u64(block_num, head_block_num); - *x = serde_json::to_value(block_num).expect("U64 can always be a serde_json::Value"); + *x = + serde_json::to_value(block_num).expect("U64 can always be a serde_json::Value"); // TODO: maybe don't return. instead check toBlock too? // TODO: if there is a very wide fromBlock and toBlock, we need to check that our rpcs have both! diff --git a/web3_proxy/src/frontend/users.rs b/web3_proxy/src/frontend/users.rs index 18113f5f..eb603b74 100644 --- a/web3_proxy/src/frontend/users.rs +++ b/web3_proxy/src/frontend/users.rs @@ -363,7 +363,6 @@ pub async fn user_get( /// the JSON input to the `post_user` handler. #[derive(Deserialize)] pub struct UserPost { - // TODO: make sure the email address is valid. probably have a "verified" column in the database email: Option, } @@ -419,6 +418,8 @@ pub async fn user_balance_get( Extension(app): Extension>, TypedHeader(Authorization(bearer)): TypedHeader>, ) -> FrontendResult { + let (user, _semaphore) = app.bearer_is_authorized(bearer).await?; + todo!("user_balance_get"); } @@ -432,8 +433,10 @@ pub async fn user_balance_get( #[debug_handler] pub async fn user_balance_post( Extension(app): Extension>, - TypedHeader(Authorization(bearer_token)): TypedHeader>, + TypedHeader(Authorization(bearer)): TypedHeader>, ) -> FrontendResult { + let (user, _semaphore) = app.bearer_is_authorized(bearer).await?; + todo!("user_balance_post"); } @@ -443,9 +446,9 @@ pub async fn user_balance_post( #[debug_handler] pub async fn user_keys_get( Extension(app): Extension>, - TypedHeader(Authorization(bearer_token)): TypedHeader>, + TypedHeader(Authorization(bearer)): TypedHeader>, ) -> FrontendResult { - let (user, _semaphore) = app.bearer_is_authorized(bearer_token).await?; + let (user, _semaphore) = app.bearer_is_authorized(bearer).await?; let db_conn = app.db_conn().context("getting db to fetch user's keys")?; @@ -492,10 +495,10 @@ pub struct UserKeysPost { #[debug_handler] pub async fn user_keys_post( Extension(app): Extension>, - TypedHeader(Authorization(bearer_token)): TypedHeader>, + TypedHeader(Authorization(bearer)): TypedHeader>, Json(payload): Json, ) -> FrontendResult { - let (user, _semaphore) = app.bearer_is_authorized(bearer_token).await?; + let (user, _semaphore) = app.bearer_is_authorized(bearer).await?; let db_conn = app.db_conn().context("getting db for user's keys")?; @@ -667,10 +670,10 @@ pub async fn user_keys_post( #[debug_handler] pub async fn user_revert_logs_get( Extension(app): Extension>, - TypedHeader(Authorization(bearer_token)): TypedHeader>, + TypedHeader(Authorization(bearer)): TypedHeader>, Query(params): Query>, ) -> FrontendResult { - let (user, _semaphore) = app.bearer_is_authorized(bearer_token).await?; + let (user, _semaphore) = app.bearer_is_authorized(bearer).await?; let chain_id = get_chain_id_from_params(app.as_ref(), ¶ms)?; let query_start = get_query_start_from_params(¶ms)?;