From fa962338be0b3f185731ca3d3a987aca67ec48c2 Mon Sep 17 00:00:00 2001 From: shaorongqiang Date: Fri, 20 Oct 2023 10:18:49 +0800 Subject: [PATCH] fix lint --- src/components/abciapp/Cargo.toml | 4 +-- src/components/config/Cargo.toml | 2 +- src/components/contracts/baseapp/Cargo.toml | 2 +- .../contracts/modules/account/Cargo.toml | 2 +- .../contracts/modules/evm/Cargo.toml | 2 +- .../modules/evm/precompile/anemoi/Cargo.toml | 2 +- .../contracts/primitives/mocks/Cargo.toml | 2 +- .../contracts/primitives/types/Cargo.toml | 4 +-- src/components/finutils/Cargo.toml | 6 ++-- src/components/finutils/src/common/utils.rs | 2 +- .../finutils/src/txn_builder/mod.rs | 11 +++--- src/components/wallet_mobile/Cargo.toml | 6 ++-- src/components/wasm/Cargo.toml | 6 ++-- src/ledger/Cargo.toml | 12 +++---- src/ledger/src/store/mod.rs | 36 ++++++++++--------- 15 files changed, 50 insertions(+), 49 deletions(-) diff --git a/src/components/abciapp/Cargo.toml b/src/components/abciapp/Cargo.toml index ac9e74ec6..7ebfdfc17 100644 --- a/src/components/abciapp/Cargo.toml +++ b/src/components/abciapp/Cargo.toml @@ -42,13 +42,13 @@ percent-encoding = "2.1.0" nix = "0.22.1" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } ruc = { version = "1.0.5", default-features = false, features = ["compact"] } abci = { git = "https://github.com/FindoraNetwork/tendermint-abci", tag = "0.7.6" } config = { path = "../config"} ledger = { path = "../../ledger" } -globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "develop" } +globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "fix_dep" } cryptohash = { git = "https://github.com/FindoraNetwork/platform-lib-cryptohash", branch = "develop" } finutils = { path = "../finutils" } diff --git a/src/components/config/Cargo.toml b/src/components/config/Cargo.toml index fc41b5e6b..42bd55711 100644 --- a/src/components/config/Cargo.toml +++ b/src/components/config/Cargo.toml @@ -16,7 +16,7 @@ serde_json = "1.0" serde-strz = "1.1.1" toml = "0.5.8" -globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "develop" } +globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "fix_dep" } [target.'cfg(target_os= "linux")'.dependencies] btm = "0.1.6" diff --git a/src/components/contracts/baseapp/Cargo.toml b/src/components/contracts/baseapp/Cargo.toml index 77b194e45..fd261f1bf 100644 --- a/src/components/contracts/baseapp/Cargo.toml +++ b/src/components/contracts/baseapp/Cargo.toml @@ -25,7 +25,7 @@ serde_json = "1.0.40" storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.9" } fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.9" } sha3 = "0.10" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } config = { path = "../../config"} diff --git a/src/components/contracts/modules/account/Cargo.toml b/src/components/contracts/modules/account/Cargo.toml index 30b2361c6..b1f2ef4ff 100644 --- a/src/components/contracts/modules/account/Cargo.toml +++ b/src/components/contracts/modules/account/Cargo.toml @@ -24,7 +24,7 @@ fp-traits = { path = "../../primitives/traits" } fp-types = { path = "../../primitives/types" } enterprise-web3 = { path = "../../primitives/enterprise-web3" } config = { path = "../../../config"} -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } [dev-dependencies] rand_chacha = "0.3" diff --git a/src/components/contracts/modules/evm/Cargo.toml b/src/components/contracts/modules/evm/Cargo.toml index 671c80958..3dd939638 100644 --- a/src/components/contracts/modules/evm/Cargo.toml +++ b/src/components/contracts/modules/evm/Cargo.toml @@ -24,7 +24,7 @@ serde_json = "1.0.64" sha3 = { version = "0.10", default-features = false } hex = "0.4.3" ethabi = "17.1.0" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } protobuf = "2.16" # primitives, don't depend on any modules diff --git a/src/components/contracts/modules/evm/precompile/anemoi/Cargo.toml b/src/components/contracts/modules/evm/precompile/anemoi/Cargo.toml index c8e970ed0..b9fd92c47 100644 --- a/src/components/contracts/modules/evm/precompile/anemoi/Cargo.toml +++ b/src/components/contracts/modules/evm/precompile/anemoi/Cargo.toml @@ -16,7 +16,7 @@ evm-precompile-utils = { path = "../utils"} tracing = "0.1" module-evm = { path = "../../../../modules/evm"} num_enum = { version = "0.5.4", default-features = false } -platform-lib-noah = { git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +platform-lib-noah = { git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } [dev-dependencies] baseapp = { path = "../../../../baseapp" } diff --git a/src/components/contracts/primitives/mocks/Cargo.toml b/src/components/contracts/primitives/mocks/Cargo.toml index 681dc54b4..7c254e66a 100644 --- a/src/components/contracts/primitives/mocks/Cargo.toml +++ b/src/components/contracts/primitives/mocks/Cargo.toml @@ -18,7 +18,7 @@ rand_chacha = "0.3" rlp = "0.5" serde_json = "1.0" sha3 = "0.10" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } # primitives fp-traits = { path = "../traits" } diff --git a/src/components/contracts/primitives/types/Cargo.toml b/src/components/contracts/primitives/types/Cargo.toml index 497e24d50..dc957f79a 100644 --- a/src/components/contracts/primitives/types/Cargo.toml +++ b/src/components/contracts/primitives/types/Cargo.toml @@ -13,7 +13,7 @@ bech32 = "0.7.2" ethereum = { version = "0.12.0", default-features = false, features = ["with-serde"] } hex = "0.4.3" -globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "develop" } +globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "fix_dep" } libsecp256k1 = { version = "0.7", features = ["static-context", "hmac"] } primitive-types = { version = "0.11.1", default-features = false, features = ["rlp", "byteorder", "serde"] } @@ -22,7 +22,7 @@ serde = { version = "1.0.124", features = ["derive"] } serde_json = "1.0" serde-big-array = "0.4" sha3 = "0.10" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } fixed-hash = "0.8.0" # primitives diff --git a/src/components/finutils/Cargo.toml b/src/components/finutils/Cargo.toml index dfc905db1..0cc585fa0 100644 --- a/src/components/finutils/Cargo.toml +++ b/src/components/finutils/Cargo.toml @@ -25,13 +25,13 @@ digest = '0.10' parking_lot = "0.12" getrandom = "0.2" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } ruc = "1.0" rucv4 = { package = "ruc", version = "4.0" } nix = "0.25" ledger = { path = "../../ledger", default-features = false } -globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "develop" } -credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "develop" } +globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "fix_dep" } +credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "fix_dep" } eth_checksum = { version = "0.1.2", optional = true } fp-core = { path = "../contracts/primitives/core", default-features = false } diff --git a/src/components/finutils/src/common/utils.rs b/src/components/finutils/src/common/utils.rs index ba97a5ede..978cc8b4c 100644 --- a/src/components/finutils/src/common/utils.rs +++ b/src/components/finutils/src/common/utils.rs @@ -1165,7 +1165,7 @@ pub fn get_claim_on_contract_address(url: &str, staking_address: H160) -> Result #[allow(missing_docs)] pub fn mapping_address(pk: &XfrPublicKey) -> H160 { - let result = ::digest(pk.as_bytes()); + let result = ::digest(pk.to_bytes()); H160::from_slice(&result.as_slice()[..20]) } diff --git a/src/components/finutils/src/txn_builder/mod.rs b/src/components/finutils/src/txn_builder/mod.rs index 0ab44add2..c5d3a35f7 100644 --- a/src/components/finutils/src/txn_builder/mod.rs +++ b/src/components/finutils/src/txn_builder/mod.rs @@ -6,7 +6,6 @@ #![allow(clippy::needless_borrow)] use { - credentials::CredUserSecretKey, curve25519_dalek::scalar::Scalar, digest::Digest, fp_types::{crypto::MultiSigner, H160}, @@ -53,7 +52,7 @@ use { noah_api::{ anon_creds::{ ac_confidential_open_commitment, ACCommitment, ACCommitmentKey, - ConfidentialAC, Credential, + ACUserSecretKey, ConfidentialAC, Credential, }, anon_xfr::{ abar_to_abar::{finish_anon_xfr_note, init_anon_xfr_note, AXfrPreNote}, @@ -1303,7 +1302,7 @@ impl TransferOperationBuilder { asset_record_template: &AssetRecordTemplate, tracing_policies: Option, identity_commitment: Option, - credential_record: Option<(&CredUserSecretKey, &Credential, &ACCommitmentKey)>, + credential_record: Option<(&ACUserSecretKey, &Credential, &ACCommitmentKey)>, ) -> Result<&mut Self> { let prng = &mut ChaChaRng::from_entropy(); if self.transfer.is_some() { @@ -1318,7 +1317,7 @@ impl TransferOperationBuilder { AssetRecord::from_template_with_identity_tracing( prng, asset_record_template, - user_secret_key.get_ref(), + user_secret_key, credential, commitment_key, ) @@ -1337,7 +1336,7 @@ impl TransferOperationBuilder { pub fn add_output_and_store_blinds( &mut self, asset_record_template: &AssetRecordTemplate, - credential_record: Option<(&CredUserSecretKey, &Credential, &ACCommitmentKey)>, + credential_record: Option<(&ACUserSecretKey, &Credential, &ACCommitmentKey)>, prng: &mut R, blinds: &mut ((Scalar, Scalar), Scalar), ) -> Result<&mut Self> { @@ -1364,7 +1363,7 @@ impl TransferOperationBuilder { Some(reveal_policy) => { let conf_ac = ac_confidential_open_commitment( prng, - user_secret_key.get_ref(), + user_secret_key, credential, commitment_key, &policy.enc_keys.attrs_enc_key, diff --git a/src/components/wallet_mobile/Cargo.toml b/src/components/wallet_mobile/Cargo.toml index 78472bc71..a909b6455 100644 --- a/src/components/wallet_mobile/Cargo.toml +++ b/src/components/wallet_mobile/Cargo.toml @@ -32,13 +32,13 @@ ruc = "1.0" serde = { version = "1.0.124", features = ["derive"] } serde_derive = "^1.0.59" serde_json = "1.0" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } finutils = { path = "../finutils", default-features = false, features = []} fp-types = { path = "../contracts/primitives/types" } fp-utils = { path = "../contracts/primitives/utils" } -globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "develop" } -credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "develop" } +globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "fix_dep" } +credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "fix_dep" } cryptohash = { git = "https://github.com/FindoraNetwork/platform-lib-cryptohash", branch = "develop" } ledger = { path = "../../ledger" } diff --git a/src/components/wasm/Cargo.toml b/src/components/wasm/Cargo.toml index 6feae46eb..7cb88fe33 100644 --- a/src/components/wasm/Cargo.toml +++ b/src/components/wasm/Cargo.toml @@ -35,12 +35,12 @@ bs58 = "0.4" # OR the compiling will fail. getrandom = { version = "0.2", features = ["js"] } -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } finutils = { path = "../finutils", default-features = false } -globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "develop" } -credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "develop" } +globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "fix_dep" } +credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "fix_dep" } cryptohash = { git = "https://github.com/FindoraNetwork/platform-lib-cryptohash", branch = "develop" } ledger = { path = "../../ledger" } diff --git a/src/ledger/Cargo.toml b/src/ledger/Cargo.toml index 5e9afe6af..75b77bbbe 100644 --- a/src/ledger/Cargo.toml +++ b/src/ledger/Cargo.toml @@ -32,17 +32,17 @@ config = { path = "../components/config" } fp-types = { path = "../components/contracts/primitives/types" } fp-utils = { path = "../components/contracts/primitives/utils" } ruc = "1.0" -zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "develop" } +zei = { package="platform-lib-noah", git = "https://github.com/FindoraNetwork/platform-lib-noah", branch = "main" } bulletproofs = { package = "bulletproofs", git = "https://github.com/FindoraNetwork/bp", rev = "57633a", features = ["yoloproofs"] } itertools = "0.10" fbnc = { version = "0.2.9", default-features = false} once_cell = "1" num-bigint = "0.4.3" -globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "develop" } +globutils = { git = "https://github.com/FindoraNetwork/platform-lib-utils", branch = "fix_dep" } bitmap = { git = "https://github.com/FindoraNetwork/platform-lib-bitmap", branch = "develop" } cryptohash = { git = "https://github.com/FindoraNetwork/platform-lib-cryptohash", branch = "develop" } -credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "develop" } +credentials = { git = "https://github.com/FindoraNetwork/platform-lib-credentials", branch = "fix_dep" } merkle_tree = { git = "https://github.com/FindoraNetwork/platform-lib-merkle", branch = "develop" } sliding_set = { git = "https://github.com/FindoraNetwork/platform-lib-slidingset", branch = "develop" } @@ -63,9 +63,9 @@ features = ["f16", "serde"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies] parking_lot = "0.12" fs2 = "0.4" -storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.6", optional = true } -fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.6", optional = true } -sparse_merkle_tree = { git = "https://github.com/FindoraNetwork/platform-lib-sparse-merkle", branch = "develop" } +storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.9", optional = true } +fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.9", optional = true } +sparse_merkle_tree = { git = "https://github.com/FindoraNetwork/platform-lib-sparse-merkle", branch = "main" } [target.'cfg(target_arch = "wasm32")'.dependencies] parking_lot = { version = "0.11.1", features = ["wasm-bindgen"] } diff --git a/src/ledger/src/store/mod.rs b/src/ledger/src/store/mod.rs index 28a2f42c8..2256742a9 100644 --- a/src/ledger/src/store/mod.rs +++ b/src/ledger/src/store/mod.rs @@ -584,6 +584,7 @@ impl LedgerState { fdb, "abar_db".to_string(), VERSION_WINDOW, + false, ))); Ok(State::new(cs, false)) } @@ -1547,22 +1548,22 @@ impl LedgerStatus { // Asset issuance should match the currently registered key } - let get_effect_asset = - |derived_asset_code: &AssetTypeCode| -> Option { - for (code, asset) in &txn_effect.new_asset_codes { - let dc = AssetTypeCode::from_prefix_and_raw_asset_type_code( - AssetTypePrefix::UserDefined, - &code, - &CFG.checkpoint, - self.td_commit_height, - ); - if dc == *derived_asset_code { - return Some(asset.clone()); - } - } - None - }; - + // let get_effect_asset = + // |derived_asset_code: &AssetTypeCode| -> Option { + // for (code, asset) in &txn_effect.new_asset_codes { + // let dc = AssetTypeCode::from_prefix_and_raw_asset_type_code( + // AssetTypePrefix::UserDefined, + // &code, + // &CFG.checkpoint, + // self.td_commit_height, + // ); + // if dc == *derived_asset_code { + // return Some(asset.clone()); + // } + // } + // None + // }; + // New issuance numbers // (1) Must refer to a created asset type // - NOTE: if the asset type is created in this transaction, this @@ -1576,7 +1577,8 @@ impl LedgerStatus { let asset_type = self .asset_types .get(&code) - .or_else(|| get_effect_asset(&code)) + .or_else(|| txn_effect.new_asset_codes.get(&code).cloned()) + // .or_else(|| get_effect_asset(&code)) .c(d!())?; let proper_key = asset_type.properties.issuer; if *iss_key != proper_key {