cargo upgrade and update

moka 0.12 required some migration help: https://github.com/moka-rs/moka/blob/main/MIGRATION-GUIDE.md
This commit is contained in:
Bryan Stitt 2023-09-18 11:04:22 -07:00
parent c72db731bd
commit a68a98ce41
11 changed files with 84 additions and 113 deletions

152
Cargo.lock generated

@ -63,9 +63,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
version = "1.0.5"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783"
checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0"
dependencies = [
"memchr",
]
@ -188,7 +188,7 @@ dependencies = [
"argh_shared",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -350,7 +350,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -438,7 +438,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -480,7 +480,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -622,7 +622,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -975,9 +975,9 @@ dependencies = [
[[package]]
name = "chrono"
version = "0.4.30"
version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877"
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
dependencies = [
"android-tzdata",
"iana-time-zone",
@ -1017,9 +1017,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.4.3"
version = "4.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84ed82781cea27b43c9b106a979fe450a13a31aab0500595fb3fc06616de08e6"
checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136"
dependencies = [
"clap_builder",
"clap_derive 4.4.2",
@ -1027,9 +1027,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.4.2"
version = "4.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08"
checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56"
dependencies = [
"anstream",
"anstyle",
@ -1068,7 +1068,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -1987,7 +1987,7 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
"syn 2.0.33",
"syn 2.0.37",
"toml 0.7.8",
"walkdir",
]
@ -2005,7 +2005,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde_json",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -2031,7 +2031,7 @@ dependencies = [
"serde",
"serde_json",
"strum",
"syn 2.0.33",
"syn 2.0.37",
"tempfile",
"thiserror",
"tiny-keccak",
@ -2463,7 +2463,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3112,7 +3112,7 @@ checksum = "ce243b1bfa62ffc028f1cc3b6034ec63d649f3031bc8a4fbbb004e1ac17d1f68"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3556,12 +3556,12 @@ dependencies = [
[[package]]
name = "moka"
version = "0.11.3"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa6e72583bf6830c956235bff0d5afec8cf2952f579ebad18ae7821a917d950f"
checksum = "8dc65d4615c08c8a13d91fd404b5a2a4485ba35b4091e3315cf8798d280c2f29"
dependencies = [
"async-io",
"async-lock",
"async-trait",
"crossbeam-channel",
"crossbeam-epoch",
"crossbeam-utils",
@ -3570,7 +3570,6 @@ dependencies = [
"parking_lot",
"quanta",
"rustc_version",
"scheduled-thread-pool",
"skeptic",
"smallvec 1.11.0",
"tagptr",
@ -3784,7 +3783,7 @@ dependencies = [
"proc-macro-crate 1.3.1",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3850,7 +3849,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3936,7 +3935,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -3959,7 +3958,7 @@ checksum = "bd10bab2b6df910bbe6c4987d76aa4221235103d9a9c000cfabcee6a6abc8f7a"
dependencies = [
"reqwest",
"serde",
"time 0.3.20",
"time",
"url",
]
@ -4129,7 +4128,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4193,7 +4192,7 @@ dependencies = [
"phf_shared 0.11.2",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4231,7 +4230,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -4314,7 +4313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d"
dependencies = [
"proc-macro2",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -5176,20 +5175,11 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "scheduled-thread-pool"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19"
dependencies = [
"parking_lot",
]
[[package]]
name = "schemars"
version = "0.8.13"
version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "763f8cd0d4c71ed8389c90cb8100cba87e763bd01a8e614d4f0af97bcd50a161"
checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c"
dependencies = [
"dyn-clone",
"schemars_derive",
@ -5199,9 +5189,9 @@ dependencies = [
[[package]]
name = "schemars_derive"
version = "0.8.13"
version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0f696e21e10fa546b7ffb1c9672c6de8fbc7a81acf59524386d8639bf12737"
checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c"
dependencies = [
"proc-macro2",
"quote",
@ -5247,7 +5237,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -5272,7 +5262,7 @@ dependencies = [
"sqlx",
"strum",
"thiserror",
"time 0.3.20",
"time",
"tracing",
"url",
"uuid 1.4.1",
@ -5285,7 +5275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e3f0ff2fa5672e2e7314d107c6498a18e469beeb340a0ed84e3075fce73c2cd"
dependencies = [
"chrono",
"clap 4.4.3",
"clap 4.4.4",
"dotenvy",
"glob",
"regex",
@ -5305,7 +5295,7 @@ dependencies = [
"proc-macro2",
"quote",
"sea-bae",
"syn 2.0.33",
"syn 2.0.37",
"unicode-ident",
]
@ -5316,7 +5306,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21f673fcefb3a7e7b89a12b6c0e854ec0be14367635ac3435369c8ad7f11e09e"
dependencies = [
"async-trait",
"clap 4.4.3",
"clap 4.4.4",
"dotenvy",
"futures",
"sea-orm",
@ -5340,7 +5330,7 @@ dependencies = [
"rust_decimal",
"sea-query-derive",
"serde_json",
"time 0.3.20",
"time",
"uuid 1.4.1",
]
@ -5356,7 +5346,7 @@ dependencies = [
"sea-query",
"serde_json",
"sqlx",
"time 0.3.20",
"time",
"uuid 1.4.1",
]
@ -5574,7 +5564,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror",
"time 0.3.20",
"time",
"url",
"uuid 1.4.1",
]
@ -5618,7 +5608,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -5826,7 +5816,7 @@ dependencies = [
"num-bigint",
"num-traits",
"thiserror",
"time 0.3.20",
"time",
]
[[package]]
@ -5849,7 +5839,7 @@ dependencies = [
"serde",
"sha3",
"thiserror",
"time 0.3.20",
"time",
]
[[package]]
@ -6055,7 +6045,7 @@ dependencies = [
"smallvec 1.11.0",
"sqlformat",
"thiserror",
"time 0.3.20",
"time",
"tokio",
"tokio-stream",
"tracing",
@ -6144,7 +6134,7 @@ dependencies = [
"sqlx-core",
"stringprep",
"thiserror",
"time 0.3.20",
"time",
"tracing",
"uuid 1.4.1",
"whoami",
@ -6189,7 +6179,7 @@ dependencies = [
"sqlx-core",
"stringprep",
"thiserror",
"time 0.3.20",
"time",
"tracing",
"uuid 1.4.1",
"whoami",
@ -6214,7 +6204,7 @@ dependencies = [
"percent-encoding",
"serde",
"sqlx-core",
"time 0.3.20",
"time",
"tracing",
"url",
"uuid 1.4.1",
@ -6281,7 +6271,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -6323,9 +6313,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.33"
version = "2.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9caece70c63bfba29ec2fed841a09851b14a235c60010fa4de58089b6c025668"
checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
dependencies = [
"proc-macro2",
"quote",
@ -6417,7 +6407,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -6441,17 +6431,6 @@ dependencies = [
"once_cell",
]
[[package]]
name = "time"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "time"
version = "0.3.20"
@ -6571,7 +6550,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -6826,7 +6805,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -6967,9 +6946,9 @@ dependencies = [
[[package]]
name = "typenum"
version = "1.16.0"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "ucd-trie"
@ -7185,12 +7164,6 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@ -7218,7 +7191,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
"wasm-bindgen-shared",
]
@ -7252,7 +7225,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -7365,8 +7338,7 @@ dependencies = [
"siwe",
"strum",
"test-log",
"time 0.1.45",
"time 0.3.20",
"time",
"tokio",
"tokio-console",
"tokio-stream",
@ -7619,7 +7591,7 @@ checksum = "56097d5b91d711293a42be9289403896b68654625021732067eac7a4ca388a1f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.33",
"syn 2.0.37",
]
[[package]]
@ -7644,7 +7616,7 @@ dependencies = [
"hmac",
"pbkdf2 0.11.0",
"sha1",
"time 0.3.20",
"time",
"zstd",
]

@ -7,6 +7,6 @@ edition = "2021"
[dependencies]
tracing = "0.1"
moka = { version = "0.11.3", default-features = false, features = ["atomic64", "future", "parking_lot", "quanta", "triomphe"] }
moka = { version = "0.12.0", default-features = false, features = ["atomic64", "future", "quanta"] }
serde = "1"
tokio = { version = "1.32.0", features = ["full"] }

@ -10,6 +10,6 @@ redis-rate-limiter = { path = "../redis-rate-limiter" }
anyhow = "1.0.75"
hashbrown = "0.14.0"
log = "0.4.20"
moka = { version = "0.11.3", features = ["future"] }
moka = { version = "0.12.0", features = ["future"] }
tokio = "1.32.0"
tracing = "0.1.37"

@ -10,7 +10,7 @@ path = "src/lib.rs"
[dependencies]
tokio = { version = "1.32.0", features = ["full", "tracing"] }
chrono = "0.4.30"
chrono = "0.4.31"
sea-orm = { version = "0.12.2", features = ["with-chrono"]}
[dependencies.sea-orm-migration]

@ -6,6 +6,6 @@ edition = "2021"
[dependencies]
anyhow = "1.0.75"
chrono = "0.4.30"
chrono = "0.4.31"
deadpool-redis = { version = "0.12.0", features = ["rt_tokio_1", "serde"] }
tokio = "1.32.0"

@ -45,7 +45,7 @@ axum-client-ip = "0.4.2"
axum-macros = "0.3.8"
base64 = "0.21.4"
check-if-email-exists = "0.9.0"
chrono = { version = "0.4.30" }
chrono = { version = "0.4.31" }
console-subscriber = { version = "0.1.10", features = ["env-filter", "parking_lot"], optional = true }
counter = "0.5.7"
derivative = "2.2.0"
@ -66,7 +66,7 @@ ipnet = { version = "2.8.0", features = ["json"] }
itertools = "0.11.0"
listenfd = "1.0.1"
mimalloc = { version = "0.1.39", optional = true}
moka = { version = "0.11.3", default-features = false, features = ["atomic64", "future", "parking_lot", "quanta", "triomphe"] }
moka = { version = "0.12.0", default-features = false, features = ["atomic64", "future", "quanta"] }
nanorand = { version = "0.7.0", default-features = false, features = ["std", "tls", "wyrand"] }
num = { version = "0.4.1" }
num-traits = "0.2.16"
@ -86,8 +86,7 @@ serde-inline-default = "0.1.1"
serde_json = { version = "1.0.107", default-features = false, features = ["raw_value"] }
serde_prometheus = "0.2.4"
strum = { version = "0.25.0", features = ["derive"] }
time_01 = { package = "time", version = "0.1.45" }
time_03 = { package = "time", version = "0.3" }
time = { version = "0.3" }
tokio = { version = "1.32.0", features = ["full", "tracing"] }
tokio-console = { version = "0.1.9", optional = true }
tokio-stream = { version = "0.1.14", features = ["sync"] }

@ -35,7 +35,7 @@ use siwe::{Message, VerificationOpts};
use std::ops::Add;
use std::str::FromStr;
use std::sync::Arc;
use time_03::{Duration, OffsetDateTime};
use time::{Duration, OffsetDateTime};
use tracing::{info, trace, warn};
use ulid::Ulid;

@ -28,7 +28,7 @@ use std::collections::BTreeMap;
use std::ops::Add;
use std::str::FromStr;
use std::sync::Arc;
use time_03::{Duration, OffsetDateTime};
use time::{Duration, OffsetDateTime};
use tracing::{error, trace, warn};
use ulid::Ulid;

@ -8,7 +8,7 @@ use std::{
hash::{Hash, Hasher},
panic::PanicInfo,
};
use time_03::OffsetDateTime;
use time::OffsetDateTime;
use tracing::{debug, error, warn};
/*

@ -300,7 +300,7 @@ impl JsonRpcResponseWeigher {
mod tests {
use super::JsonRpcResponseEnum;
use crate::response_cache::JsonRpcResponseWeigher;
use moka::future::{Cache, CacheBuilder, ConcurrentCacheExt};
use moka::future::{Cache, CacheBuilder};
use serde_json::value::RawValue;
use std::{sync::Arc, time::Duration};
@ -340,25 +340,25 @@ mod tests {
test_cache.insert(0, small_data).await;
test_cache.get(&0).unwrap();
test_cache.get(&0).await.unwrap();
test_cache.insert(1, max_sized_data).await;
test_cache.get(&0).unwrap();
test_cache.get(&1).unwrap();
test_cache.get(&0).await.unwrap();
test_cache.get(&1).await.unwrap();
test_cache.insert(2, oversized_data).await;
test_cache.get(&0).unwrap();
test_cache.get(&1).unwrap();
test_cache.get(&0).await.unwrap();
test_cache.get(&1).await.unwrap();
// oversized data will be in the cache temporarily (it should just be an arc though, so that should be fine)
test_cache.get(&2).unwrap();
test_cache.get(&2).await.unwrap();
// sync should do necessary cleanup
test_cache.sync();
test_cache.run_pending_tasks().await;
// now it should be empty
assert!(test_cache.get(&2).is_none());
assert!(test_cache.get(&2).await.is_none());
}
}

@ -237,7 +237,7 @@ impl Web3Rpcs {
.await;
// try to check the parent of this ancestor
if let Some(ancestor_block) = self.blocks_by_hash.get(&ancestor.hash) {
if let Some(ancestor_block) = self.blocks_by_hash.get(&ancestor.hash).await {
match ancestor_block.number().checked_sub(1.into()) {
None => break,
Some(ancestor_parent_num) => {
@ -273,7 +273,7 @@ impl Web3Rpcs {
// first, try to get the hash from our cache
// the cache is set last, so if its here, its everywhere
// TODO: use try_get_with
if let Some(block) = self.blocks_by_hash.get(hash) {
if let Some(block) = self.blocks_by_hash.get(hash).await {
// double check that it matches the blocks_by_number cache
let cached_hash = self
.blocks_by_number
@ -351,7 +351,7 @@ impl Web3Rpcs {
// TODO: if theres multiple, use petgraph to find the one on the main chain (and remove the others if they have enough confirmations)
// try to get the hash from our cache
if let Some(block_hash) = self.blocks_by_number.get(num) {
if let Some(block_hash) = self.blocks_by_number.get(num).await {
// TODO: sometimes this needs to fetch the block. why? i thought block_numbers would only be set if the block hash was set
// TODO: configurable max wait and rpc
return self.block(&block_hash, None, None).await;