From b095eb76ac92ae3e30c362e20124cf8d4af77e99 Mon Sep 17 00:00:00 2001 From: ssuangchen <ssuangchen@163.com> Date: Sat, 6 Apr 2024 17:17:21 +0800 Subject: [PATCH] Update dependencies. --- explorer/Cargo.toml | 7 +++---- module/Cargo.toml | 8 ++++---- module/src/utils/crypto.rs | 15 +++++++-------- prismer/Cargo.toml | 2 +- scanner/Cargo.toml | 2 +- scanner/src/commands.rs | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/explorer/Cargo.toml b/explorer/Cargo.toml index 0c077f6..5884ddd 100644 --- a/explorer/Cargo.toml +++ b/explorer/Cargo.toml @@ -5,9 +5,8 @@ edition = "2021" [dependencies] -poem = "1.3.36" -poem-openapi = { version = "1.3.30", features = ["swagger-ui"] } -module = { path = "../module" } +poem = "3.0.0" +poem-openapi = { version = "5.0.0", features = ["swagger-ui"] } tokio = { version = "1.0", features = ["full"] } toml = "0.8.12" anyhow = "1.0.52" @@ -27,6 +26,6 @@ sha3 = { version = "0.10.4", default-features = false } hex = "0.4.3" zei = { git = "https://github.com/FindoraNetwork/zei", branch = "stable-main" } - +module = { path = "../module" } scanner = {path = "../scanner"} diff --git a/module/Cargo.toml b/module/Cargo.toml index 315c21a..38fc804 100644 --- a/module/Cargo.toml +++ b/module/Cargo.toml @@ -10,15 +10,15 @@ anyhow = "1.0.52" toml = "0.8.12" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -poem-openapi = {version = "1.2.30"} +poem-openapi = { version = "5.0.0" } rlp = { version = "0.5", default-features = false } ethereum-types = "0.14.1" ethereum = { version = "0.15.0", default-features = false, features = ["with-serde"] } -sha3 = { version = "0.8", default-features = false } +sha3 = { version = "0.10.8", default-features = false } hex = "0.4.3" -libsecp256k1 = { version = "0.5", features = ["static-context", "hmac"] } +libsecp256k1 = { version = "0.7.1", features = ["static-context", "hmac"] } ruc = "1.0" -base64 = "0.10" +base64 = "0.22.0" bech32 = "0.7.2" zei = { git = "https://github.com/FindoraNetwork/zei", branch = "stable-main" } diff --git a/module/src/utils/crypto.rs b/module/src/utils/crypto.rs index 04ba477..3c6a7a5 100644 --- a/module/src/utils/crypto.rs +++ b/module/src/utils/crypto.rs @@ -14,7 +14,7 @@ pub fn recover_signer(transaction: &LegacyTransaction) -> Option<H160> { let pubkey = secp256k1_ecdsa_recover(&sig, &msg).ok()?; Some(H160::from(H256::from_slice( - Keccak256::digest(&pubkey).as_slice(), + Keccak256::digest(pubkey).as_slice(), ))) } @@ -47,6 +47,7 @@ pub fn bech32enc<T: AsRef<[u8]> + ToBase32>(input: &T) -> String { mod test { use super::*; use crate::schema::EvmTx; + use base64::{engine, Engine}; use ruc::{d, RucResult}; use zei::serialization::ZeiFromToBytes; use zei::xfr::sig::XfrPublicKey; @@ -63,13 +64,11 @@ mod test { #[test] fn test_convert_base64_to_bech32() { - let pk = base64::decode_config( - "HZnxwPI5PD_xpQX1NqKTHXqPdHXVXtGe7yQ0JI3MVTs=", - base64::URL_SAFE, - ) - .c(d!()) - .and_then(|bytes| XfrPublicKey::zei_from_bytes(&bytes).c(d!())) - .unwrap(); + let pk = engine::general_purpose::URL_SAFE + .decode("HZnxwPI5PD_xpQX1NqKTHXqPdHXVXtGe7yQ0JI3MVTs=") + .c(d!()) + .and_then(|bytes| XfrPublicKey::zei_from_bytes(&bytes).c(d!())) + .unwrap(); let addr = bech32enc(&XfrPublicKey::zei_to_bytes(&pk)); assert_eq!( addr, diff --git a/prismer/Cargo.toml b/prismer/Cargo.toml index 00dbf05..836166c 100644 --- a/prismer/Cargo.toml +++ b/prismer/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -sqlx = { version = "0.6.0", features = ["runtime-tokio-rustls", "postgres", "chrono", "json"] } +sqlx = { version = "0.7.4", features = ["runtime-tokio-rustls", "postgres", "chrono", "json"] } reqwest = { version = "0.12.3", default-features = false, features = ["json", "rustls-tls"] } ruc = "1.0" base64 = "0.22.0" diff --git a/scanner/Cargo.toml b/scanner/Cargo.toml index 9ff9962..999d418 100644 --- a/scanner/Cargo.toml +++ b/scanner/Cargo.toml @@ -11,7 +11,7 @@ path = "src/bin/scanner.rs" [dependencies] serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -sqlx = { version = "0.6.0", features = ["runtime-tokio-rustls", "postgres", "chrono", "json"] } +sqlx = { version = "0.7.4", features = ["runtime-tokio-rustls", "postgres", "chrono", "json"] } reqwest = { version = "0.12.3", default-features = false, features = ["json", "rustls-tls"] } ethereum-types = "0.14.1" ethereum = { version = "0.15.0", default-features = false, features = ["with-serde"] } diff --git a/scanner/src/commands.rs b/scanner/src/commands.rs index 702a775..c476b36 100644 --- a/scanner/src/commands.rs +++ b/scanner/src/commands.rs @@ -233,7 +233,7 @@ impl Migrate { let mut cursor = sqlx::query("SELECT tx_hash,block_hash,height,timestamp,ty,value FROM transaction") - .fetch(&mut conn); + .fetch(&mut *conn); while let Some(row) = cursor.try_next().await? { let tx: String = row.try_get("tx_hash")?; let block: String = row.try_get("block_hash")?;