From 2f270252319757de9aa0c98ae35aceb9f183a58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos=20Bezerra?= Date: Wed, 28 Aug 2024 15:39:37 -0300 Subject: [PATCH] chore: bump sqlx version due to security alert also had to bump tempfile for it to work --- Cargo.lock | 200 +++++++++++++++-------------- Cargo.toml | 4 +- src/eth/primitives/address.rs | 6 +- src/eth/primitives/block_number.rs | 6 +- src/eth/primitives/hash.rs | 9 +- src/eth/primitives/slot_index.rs | 8 +- src/eth/primitives/slot_value.rs | 9 +- src/eth/primitives/wei.rs | 12 +- 8 files changed, 123 insertions(+), 131 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c6b55ec8..23c8279f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,7 +24,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom", "once_cell", "version_check", "zerocopy", @@ -301,7 +300,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -312,7 +311,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -348,7 +347,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -452,10 +451,12 @@ dependencies = [ [[package]] name = "bigdecimal" -version = "0.3.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" +checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee" dependencies = [ + "autocfg", + "libm", "num-bigint", "num-integer", "num-traits", @@ -508,7 +509,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -628,12 +629,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -711,10 +713,10 @@ version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -739,6 +741,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "console-api" version = "0.6.0" @@ -951,7 +962,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -962,7 +973,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -1021,7 +1032,7 @@ checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -1098,7 +1109,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -1166,7 +1177,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -1273,9 +1284,14 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.3" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] [[package]] name = "fake" @@ -1487,7 +1503,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -1688,9 +1704,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -1698,11 +1714,11 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.4" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -1718,15 +1734,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.5.0" @@ -2089,7 +2096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] @@ -2154,9 +2161,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.28" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -2428,9 +2435,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", @@ -2550,7 +2557,7 @@ checksum = "4259040465c955f9f2f1a4a8a16dc46726169bca0f88e8fb2dbeced487c3e828" dependencies = [ "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "metrics", "num_cpus", "quanta", @@ -2777,7 +2784,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -2858,7 +2865,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -3012,6 +3019,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.1" @@ -3132,7 +3145,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -3199,7 +3212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -3252,9 +3265,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -3296,7 +3309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck 0.5.0", + "heck", "itertools 0.12.1", "log", "multimap", @@ -3306,7 +3319,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.48", + "syn 2.0.76", "tempfile", ] @@ -3320,7 +3333,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -3628,7 +3641,7 @@ dependencies = [ "derive_more", "dyn-clone", "enumn", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "hex", "once_cell", "serde", @@ -4237,7 +4250,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -4300,7 +4313,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -4411,6 +4424,9 @@ name = "smallvec" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +dependencies = [ + "serde", +] [[package]] name = "socket2" @@ -4476,9 +4492,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" +checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" dependencies = [ "sqlx-core", "sqlx-macros", @@ -4489,11 +4505,10 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" dependencies = [ - "ahash", "atoi", "bigdecimal", "byteorder", @@ -4507,6 +4522,7 @@ dependencies = [ "futures-intrusive", "futures-io", "futures-util", + "hashbrown 0.14.5", "hashlink", "hex", "indexmap 2.2.6", @@ -4530,26 +4546,26 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 1.0.109", + "syn 2.0.76", ] [[package]] name = "sqlx-macros-core" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" dependencies = [ "dotenvy", "either", - "heck 0.4.1", + "heck", "hex", "once_cell", "proc-macro2", @@ -4561,7 +4577,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 1.0.109", + "syn 2.0.76", "tempfile", "tokio", "url", @@ -4569,12 +4585,12 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" dependencies = [ "atoi", - "base64 0.21.7", + "base64 0.22.1", "bigdecimal", "bitflags 2.6.0", "byteorder", @@ -4613,12 +4629,12 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" dependencies = [ "atoi", - "base64 0.21.7", + "base64 0.22.1", "bigdecimal", "bitflags 2.6.0", "byteorder", @@ -4654,9 +4670,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" dependencies = [ "atoi", "flume", @@ -4669,11 +4685,11 @@ dependencies = [ "log", "percent-encoding", "serde", + "serde_urlencoded", "sqlx-core", "time", "tracing", "url", - "urlencoding", ] [[package]] @@ -4806,11 +4822,11 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -4851,9 +4867,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" dependencies = [ "proc-macro2", "quote", @@ -4895,9 +4911,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", @@ -4922,7 +4938,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -5058,7 +5074,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -5209,7 +5225,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -5264,7 +5280,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -5413,12 +5429,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - [[package]] name = "unicode-xid" version = "0.2.4" @@ -5462,12 +5472,6 @@ dependencies = [ "serde", ] -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - [[package]] name = "utf8parse" version = "0.2.1" @@ -5574,7 +5578,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", "wasm-bindgen-shared", ] @@ -5608,7 +5612,7 @@ checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5895,7 +5899,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] @@ -5915,7 +5919,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.76", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e4f6b1ea6..cbe7a7aef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,7 @@ tracing-serde = "=0.1.3" # storage redis = "=0.26.0" rocksdb = { version = "=0.22.0", features = ["multi-threaded-cf"] } -sqlx = { version = "=0.7.4", features = [ +sqlx = { version = "=0.8.2", features = [ "runtime-tokio", "postgres", "bigdecimal", @@ -141,7 +141,7 @@ console-subscriber = { git = "https://github.com/tokio-rs/console.git", rev = "8 binary_macros = "=1.0.0" fancy-duration = "=0.9.2" stringreader = "=0.1.1" -tempfile = "=3.10.0" +tempfile = "=3.10.1" # ------------------------------------------------------------------------------ # Build dependencies diff --git a/src/eth/primitives/address.rs b/src/eth/primitives/address.rs index 78c116126..cbe5df66f 100644 --- a/src/eth/primitives/address.rs +++ b/src/eth/primitives/address.rs @@ -10,8 +10,6 @@ use ethers_core::types::NameOrAddress; use fake::Dummy; use fake::Faker; use hex_literal::hex; -use sqlx::database::HasArguments; -use sqlx::database::HasValueRef; use sqlx::encode::IsNull; use sqlx::error::BoxDynError; use sqlx::postgres::PgHasArrayType; @@ -115,7 +113,7 @@ impl TryFrom> for Address { // sqlx traits // ----------------------------------------------------------------------------- impl<'r> sqlx::Decode<'r, sqlx::Postgres> for Address { - fn decode(value: >::ValueRef) -> Result { + fn decode(value: ::ValueRef<'r>) -> Result { let value = <[u8; 20] as Decode>::decode(value)?; Ok(value.into()) } @@ -140,7 +138,7 @@ impl AsRef<[u8]> for Address { } impl<'q> sqlx::Encode<'q, sqlx::Postgres> for Address { - fn encode_by_ref(&self, buf: &mut >::ArgumentBuffer) -> IsNull { + fn encode_by_ref(&self, buf: &mut ::ArgumentBuffer<'q>) -> Result { self.0 .0.encode(buf) } } diff --git a/src/eth/primitives/block_number.rs b/src/eth/primitives/block_number.rs index c6e599c3b..9b5c8e7a1 100644 --- a/src/eth/primitives/block_number.rs +++ b/src/eth/primitives/block_number.rs @@ -9,8 +9,6 @@ use ethereum_types::U64; use ethers_core::utils::keccak256; use fake::Dummy; use fake::Faker; -use sqlx::database::HasArguments; -use sqlx::database::HasValueRef; use sqlx::encode::IsNull; use sqlx::error::BoxDynError; use sqlx::postgres::PgHasArrayType; @@ -182,7 +180,7 @@ impl From for [u8; 8] { // sqlx traits // ----------------------------------------------------------------------------- impl<'r> sqlx::Decode<'r, sqlx::Postgres> for BlockNumber { - fn decode(value: >::ValueRef) -> Result { + fn decode(value: ::ValueRef<'r>) -> Result { let value = >::decode(value)?; Ok(value.try_into()?) } @@ -195,7 +193,7 @@ impl sqlx::Type for BlockNumber { } impl<'q> sqlx::Encode<'q, sqlx::Postgres> for BlockNumber { - fn encode_by_ref(&self, buf: &mut >::ArgumentBuffer) -> IsNull { + fn encode_by_ref(&self, buf: &mut ::ArgumentBuffer<'q>) -> Result { BigDecimal::from(u64::from(*self)).encode(buf) } } diff --git a/src/eth/primitives/hash.rs b/src/eth/primitives/hash.rs index 37e70c2a5..28ab410e5 100644 --- a/src/eth/primitives/hash.rs +++ b/src/eth/primitives/hash.rs @@ -6,8 +6,7 @@ use display_json::DebugAsJson; use ethereum_types::H256; use fake::Dummy; use fake::Faker; -use sqlx::database::HasValueRef; -use sqlx::error::BoxDynError; +use sqlx::encode::IsNull; use sqlx::postgres::PgHasArrayType; use crate::gen_newtype_from; @@ -84,21 +83,21 @@ impl FromStr for Hash { // sqlx traits // ----------------------------------------------------------------------------- impl<'r> sqlx::Decode<'r, sqlx::Postgres> for Hash { - fn decode(value: >::ValueRef) -> Result { + fn decode(value: ::ValueRef<'r>) -> Result { let value = <[u8; 32] as sqlx::Decode>::decode(value)?; Ok(value.into()) } } impl<'q> sqlx::Encode<'q, sqlx::Postgres> for Hash { - fn encode(self, buf: &mut >::ArgumentBuffer) -> sqlx::encode::IsNull + fn encode(self, buf: &mut ::ArgumentBuffer<'q>) -> Result where Self: Sized, { <&[u8; 32] as sqlx::Encode>::encode(self.0.as_fixed_bytes(), buf) } - fn encode_by_ref(&self, buf: &mut >::ArgumentBuffer) -> sqlx::encode::IsNull { + fn encode_by_ref(&self, buf: &mut ::ArgumentBuffer<'q>) -> Result { <&[u8; 32] as sqlx::Encode>::encode(self.0.as_fixed_bytes(), buf) } } diff --git a/src/eth/primitives/slot_index.rs b/src/eth/primitives/slot_index.rs index 758003f20..44db6be90 100644 --- a/src/eth/primitives/slot_index.rs +++ b/src/eth/primitives/slot_index.rs @@ -7,8 +7,6 @@ use ethereum_types::U256; use ethers_core::utils::keccak256; use fake::Dummy; use fake::Faker; -use sqlx::database::HasArguments; -use sqlx::database::HasValueRef; use sqlx::encode::IsNull; use sqlx::error::BoxDynError; use sqlx::postgres::PgHasArrayType; @@ -129,7 +127,7 @@ impl From for ethereum_types::U256 { // sqlx traits // ----------------------------------------------------------------------------- impl<'r> sqlx::Decode<'r, sqlx::Postgres> for SlotIndex { - fn decode(value: >::ValueRef) -> Result { + fn decode(value: ::ValueRef<'r>) -> Result { let value = <[u8; 32] as Decode>::decode(value)?; Ok(value.into()) } @@ -142,11 +140,11 @@ impl sqlx::Type for SlotIndex { } impl<'q> sqlx::Encode<'q, sqlx::Postgres> for SlotIndex { - fn encode_by_ref(&self, buf: &mut >::ArgumentBuffer) -> IsNull { + fn encode_by_ref(&self, buf: &mut ::ArgumentBuffer<'q>) -> Result { <[u8; 32] as sqlx::Encode>::encode((*self).into(), buf) } - fn encode(self, buf: &mut >::ArgumentBuffer) -> IsNull + fn encode(self, buf: &mut ::ArgumentBuffer<'q>) -> Result where Self: Sized, { diff --git a/src/eth/primitives/slot_value.rs b/src/eth/primitives/slot_value.rs index 35049c090..feb7a8600 100644 --- a/src/eth/primitives/slot_value.rs +++ b/src/eth/primitives/slot_value.rs @@ -5,10 +5,7 @@ use display_json::DebugAsJson; use ethereum_types::U256; use fake::Dummy; use fake::Faker; -use sqlx::database::HasArguments; -use sqlx::database::HasValueRef; use sqlx::encode::IsNull; -use sqlx::error::BoxDynError; use sqlx::postgres::PgHasArrayType; use sqlx::Decode; @@ -110,7 +107,7 @@ impl FromStr for SlotValue { // sqlx traits // ----------------------------------------------------------------------------- impl<'r> sqlx::Decode<'r, sqlx::Postgres> for SlotValue { - fn decode(value: >::ValueRef) -> Result { + fn decode(value: ::ValueRef<'r>) -> Result { let value = <[u8; 32] as Decode>::decode(value)?; Ok(value.into()) } @@ -123,11 +120,11 @@ impl sqlx::Type for SlotValue { } impl<'q> sqlx::Encode<'q, sqlx::Postgres> for SlotValue { - fn encode_by_ref(&self, buf: &mut >::ArgumentBuffer) -> IsNull { + fn encode_by_ref(&self, buf: &mut ::ArgumentBuffer<'q>) -> Result { <[u8; 32] as sqlx::Encode>::encode((*self).into(), buf) } - fn encode(self, buf: &mut >::ArgumentBuffer) -> IsNull + fn encode(self, buf: &mut ::ArgumentBuffer<'q>) -> Result where Self: Sized, { diff --git a/src/eth/primitives/wei.rs b/src/eth/primitives/wei.rs index 4df614a64..1c9f7f664 100644 --- a/src/eth/primitives/wei.rs +++ b/src/eth/primitives/wei.rs @@ -5,8 +5,6 @@ use ethabi::Token; use ethereum_types::U256; use fake::Dummy; use fake::Faker; -use sqlx::database::HasArguments; -use sqlx::database::HasValueRef; use sqlx::encode::IsNull; use sqlx::error::BoxDynError; use sqlx::postgres::PgHasArrayType; @@ -79,7 +77,7 @@ impl TryFrom for Wei { // sqlx traits // ----------------------------------------------------------------------------- impl<'r> sqlx::Decode<'r, sqlx::Postgres> for Wei { - fn decode(value: >::ValueRef) -> Result { + fn decode(value: ::ValueRef<'r>) -> Result { let value = >::decode(value)?; Ok(value.try_into()?) } @@ -92,17 +90,17 @@ impl sqlx::Type for Wei { } impl<'q> sqlx::Encode<'q, sqlx::Postgres> for Wei { - fn encode_by_ref(&self, buf: &mut >::ArgumentBuffer) -> IsNull { + fn encode_by_ref(&self, buf: &mut ::ArgumentBuffer<'q>) -> Result { match BigDecimal::try_from(*self) { Ok(res) => res.encode(buf), Err(e) => { tracing::error!(reason = ?e, "failed to encode gas"); - IsNull::Yes + Ok(IsNull::Yes) } } } - fn encode(self, buf: &mut >::ArgumentBuffer) -> IsNull + fn encode(self, buf: &mut ::ArgumentBuffer<'q>) -> Result where Self: Sized, { @@ -110,7 +108,7 @@ impl<'q> sqlx::Encode<'q, sqlx::Postgres> for Wei { Ok(res) => res.encode(buf), Err(e) => { tracing::error!(reason = ?e, "failed to encode gas"); - IsNull::Yes + Ok(IsNull::Yes) } } }