diff --git a/Cargo.lock b/Cargo.lock index d3bfc6b3..48949462 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -671,9 +671,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.3" +version = "4.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8d93d855ce6a0aa87b8473ef9169482f40abaa2e9e0993024c35c902cbd5920" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" dependencies = [ "bitflags", "clap_derive 4.1.0", @@ -817,6 +817,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "core-foundation" version = "0.9.3" @@ -835,9 +841,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "coset" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604cb30f7b6f4fee05b9ddf88cf6d3c0af0f98d9099e6f6a050e81e7a7cb938b" +checksum = "c765a4e852cef25c69a48e9fcd60995a7fecabf0134a0021e7181452c4a60f95" dependencies = [ "ciborium", "ciborium-io", @@ -975,7 +981,7 @@ dependencies = [ "anyhow", "async-trait", "atty", - "clap 4.1.3", + "clap 4.1.4", "console", "cucumber-codegen", "cucumber-expressions", @@ -1246,8 +1252,10 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ + "convert_case", "proc-macro2", "quote", + "rustc_version", "syn", ] @@ -1504,9 +1512,9 @@ dependencies = [ [[package]] name = "fixed" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1965703169d4c3581f1d853e6a0bacf2ad9ba5d161f58ac331de95b37584a50" +checksum = "ad45f1b686656281ac6a3b7eaf487be0e9e69fe4678f8497c84beb5f0fab7dae" dependencies = [ "az", "bytemuck", @@ -2483,7 +2491,7 @@ dependencies = [ [[package]] name = "many-client" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "anyhow", "async-trait", @@ -2526,7 +2534,7 @@ dependencies = [ [[package]] name = "many-client-macros" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "proc-macro2", "quote", @@ -2536,7 +2544,7 @@ dependencies = [ [[package]] name = "many-error" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "minicbor", "num-derive", @@ -2547,7 +2555,7 @@ dependencies = [ [[package]] name = "many-identity" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "base32", "coset", @@ -2567,7 +2575,7 @@ dependencies = [ [[package]] name = "many-identity-dsa" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "asn1 0.8.7", "base32", @@ -2595,7 +2603,7 @@ dependencies = [ [[package]] name = "many-identity-hsm" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "asn1 0.10.0", "coset", @@ -2615,7 +2623,7 @@ dependencies = [ [[package]] name = "many-identity-webauthn" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "authenticator-ctap2-2021", "base64 0.13.1", @@ -2681,6 +2689,7 @@ dependencies = [ name = "many-ledger" version = "0.1.0" dependencies = [ + "async-channel", "async-trait", "base64 0.20.0", "bip39-dict", @@ -2741,6 +2750,7 @@ dependencies = [ name = "many-ledger-test-utils" version = "0.1.0" dependencies = [ + "async-channel", "coset", "cucumber", "itertools", @@ -2765,8 +2775,9 @@ dependencies = [ [[package]] name = "many-macros" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ + "async-channel", "inflections", "proc-macro2", "quote", @@ -2778,7 +2789,7 @@ dependencies = [ [[package]] name = "many-migration" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "many-error", "minicbor", @@ -2791,8 +2802,9 @@ dependencies = [ [[package]] name = "many-modules" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ + "async-channel", "async-trait", "coset", "derive_builder 0.11.2", @@ -2812,8 +2824,9 @@ dependencies = [ [[package]] name = "many-protocol" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ + "async-channel", "base64 0.13.1", "coset", "derive_builder 0.10.2", @@ -2836,7 +2849,7 @@ dependencies = [ [[package]] name = "many-server" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "anyhow", "asn1 0.11.0", @@ -2885,10 +2898,11 @@ dependencies = [ [[package]] name = "many-types" version = "0.1.0" -source = "git+https://github.com/liftedinit/many-rs.git?rev=0db81ac956bc68c5c43f3f16ede9435ecceb4801#0db81ac956bc68c5c43f3f16ede9435ecceb4801" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" dependencies = [ "base64 0.20.0", "coset", + "derive_more", "fixed", "hex", "many-error", @@ -3117,18 +3131,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4001,9 +4015,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645926f31b250a2dca3c232496c2d898d91036e45ca0e97e0e2390c54e11be36" +checksum = "7c4437699b6d34972de58652c68b98cb5b53a4199ab126db8e20ec8ded29a721" dependencies = [ "bitflags", "core-foundation", @@ -5413,3 +5427,13 @@ dependencies = [ "syn", "synstructure", ] + +[[patch.unused]] +name = "many" +version = "0.1.0" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" + +[[patch.unused]] +name = "many-mock" +version = "0.1.0" +source = "git+https://github.com/MavenRain/many-rs/?branch=oobi/proof#576f50d5c4718c890bae54fd00a51a71bf3e65f3" diff --git a/Cargo.toml b/Cargo.toml index 1c107a3d..ddb8a5c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,23 @@ incremental = false #many-server = { path = "../many-rs/src/many-server" } #many-types = { path = "../many-rs/src/many-types" } +[patch."https://github.com/liftedinit/many-rs.git"] +many = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-client = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-client-macros = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-error = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-identity = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-identity-dsa = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-identity-hsm = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-identity-webauthn = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-macros = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-migration = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-mock = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-modules = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-protocol = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-server = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } +many-types = { git = "https://github.com/MavenRain/many-rs/", branch = "oobi/proof" } + [patch.crates-io] ciborium = { git = "https://github.com/enarx/ciborium", rev = "2ca375e6b33d1ade5a5798792278b35a807b748e" } ciborium-io = { git = "https://github.com/enarx/ciborium", rev = "2ca375e6b33d1ade5a5798792278b35a807b748e" } diff --git a/src/many-ledger/Cargo.toml b/src/many-ledger/Cargo.toml index 7f65148f..ca1f3e2a 100644 --- a/src/many-ledger/Cargo.toml +++ b/src/many-ledger/Cargo.toml @@ -17,6 +17,7 @@ name = "many-ledger" doc = false [dependencies] +async-channel = "1.8" async-trait = "0.1.51" base64 = "0.20.0-alpha.1" bip39-dict = "0.1" diff --git a/src/many-ledger/src/module/ledger.rs b/src/many-ledger/src/module/ledger.rs index 86b353aa..a75c0139 100644 --- a/src/many-ledger/src/module/ledger.rs +++ b/src/many-ledger/src/module/ledger.rs @@ -2,6 +2,7 @@ use crate::module::LedgerModuleImpl; use many_error::ManyError; use many_identity::Address; use many_modules::ledger; +use many_protocol::context::Context; use std::collections::BTreeSet; use tracing::info; @@ -34,17 +35,19 @@ impl ledger::LedgerModuleBackend for LedgerModuleImpl { fn balance( &self, sender: &Address, - args: ledger::BalanceArgs, + ledger::BalanceArgs { account, symbols }: ledger::BalanceArgs, + context: Context, ) -> Result { - let ledger::BalanceArgs { account, symbols } = args; - let identity = account.as_ref().unwrap_or(sender); let storage = &self.storage; let symbols = symbols.unwrap_or_default().0; - let balances = storage - .get_multiple_balances(identity, &BTreeSet::from_iter(symbols.clone().into_iter()))?; + let balances = storage.get_multiple_balances( + identity, + &BTreeSet::from_iter(symbols.clone().into_iter()), + context, + )?; info!("balance({}, {:?}): {:?}", identity, &symbols, &balances); Ok(ledger::BalanceReturns { balances }) } diff --git a/src/many-ledger/src/module/ledger_mintburn.rs b/src/many-ledger/src/module/ledger_mintburn.rs index 271691e9..f0933d80 100644 --- a/src/many-ledger/src/module/ledger_mintburn.rs +++ b/src/many-ledger/src/module/ledger_mintburn.rs @@ -7,15 +7,17 @@ use many_identity::Address; use many_modules::events::EventInfo; use many_modules::ledger; use many_modules::ledger::{TokenBurnArgs, TokenBurnReturns, TokenMintArgs, TokenMintReturns}; +use many_protocol::context::Context; use many_types::ledger::Symbol; use std::collections::BTreeSet; /// Check if a symbol exists in the storage fn check_symbol_exists(symbol: &Symbol, symbols: BTreeSet) -> Result<(), ManyError> { if !symbols.contains(symbol) { - return Err(error::symbol_not_found(symbol.to_string())); + Err(error::symbol_not_found(symbol.to_string())) + } else { + Ok(()) } - Ok(()) } impl ledger::LedgerMintBurnModuleBackend for LedgerModuleImpl { @@ -23,6 +25,7 @@ impl ledger::LedgerMintBurnModuleBackend for LedgerModuleImpl { &mut self, sender: &Address, args: TokenMintArgs, + context: Context, ) -> Result { if !self.storage.migrations().is_active(&TOKEN_MIGRATION) { return Err(ManyError::invalid_method_name("tokens.mint")); @@ -44,7 +47,7 @@ impl ledger::LedgerMintBurnModuleBackend for LedgerModuleImpl { check_symbol_exists(&symbol, self.storage.get_symbols()?)?; // Mint into storage - self.storage.mint_token(symbol, &distribution)?; + self.storage.mint_token(symbol, &distribution, context)?; // Log event self.storage.log_event(EventInfo::TokenMint { @@ -60,6 +63,7 @@ impl ledger::LedgerMintBurnModuleBackend for LedgerModuleImpl { &mut self, sender: &Address, args: TokenBurnArgs, + context: Context, ) -> Result { if !self.storage.migrations().is_active(&TOKEN_MIGRATION) { return Err(ManyError::invalid_method_name("tokens.burn")); @@ -89,7 +93,7 @@ impl ledger::LedgerMintBurnModuleBackend for LedgerModuleImpl { } // Burn from storage - self.storage.burn_token(symbol, &distribution)?; + self.storage.burn_token(symbol, &distribution, context)?; // Log event self.storage.log_event(EventInfo::TokenBurn { diff --git a/src/many-ledger/src/storage/ledger.rs b/src/many-ledger/src/storage/ledger.rs index f6453998..2831fa9e 100644 --- a/src/many-ledger/src/storage/ledger.rs +++ b/src/many-ledger/src/storage/ledger.rs @@ -2,8 +2,20 @@ use crate::error; use crate::storage::{key_for_account_balance, LedgerStorage}; use many_error::ManyError; use many_identity::Address; -use many_types::ledger::{Symbol, TokenAmount}; -use merk::{BatchEntry, Op}; +use many_protocol::context::Context; +use many_types::{ + ledger::{Symbol, TokenAmount}, + ProofOperation, +}; +use merk::{ + proofs::{ + Decoder, + Node::{Hash, KVHash, KV}, + Op::{Child, Parent, Push}, + Query, + }, + BatchEntry, Op, +}; use std::collections::{BTreeMap, BTreeSet}; impl LedgerStorage { @@ -36,42 +48,69 @@ impl LedgerStorage { fn get_all_balances( &self, identity: &Address, + context: impl AsRef, ) -> Result, ManyError> { - if identity.is_anonymous() { + Ok(if identity.is_anonymous() { // Anonymous cannot hold funds. - Ok(BTreeMap::new()) + BTreeMap::new() } else { let mut result = BTreeMap::new(); + let mut query = Query::new(); for symbol in self.get_symbols()? { - match self - .persistent_store - .get(&key_for_account_balance(identity, &symbol)) + let key = key_for_account_balance(identity, &symbol); + self.persistent_store + .get(&key) .map_err(error::storage_get_failed)? - { - None => {} - Some(value) => { - result.insert(symbol, TokenAmount::from(value)); - } - } + .map(|value| result.insert(symbol, TokenAmount::from(value))) + .map(|_| ()) + .unwrap_or_default(); + query.insert_key(key) } + context + .as_ref() + .prove(|| { + self.persistent_store + .prove(query) + .and_then(|proof| { + Decoder::new(proof.as_slice()) + .map(|fallible_operation| { + fallible_operation.map(|operation| match operation { + Child => ProofOperation::Child, + Parent => ProofOperation::Parent, + Push(Hash(hash)) => ProofOperation::NodeHash(hash.to_vec()), + Push(KV(key, value)) => { + ProofOperation::KeyValuePair(key.into(), value.into()) + } + Push(KVHash(hash)) => { + ProofOperation::KeyValueHash(hash.to_vec()) + } + }) + }) + .collect::, _>>() + }) + .map_err(|error| ManyError::unknown(error.to_string())) + }) + .map(|error| Err(ManyError::unknown(error.to_string()))) + .unwrap_or(Ok(()))?; - Ok(result) - } + result + }) } pub fn get_multiple_balances( &self, identity: &Address, symbols: &BTreeSet, + context: impl AsRef, ) -> Result, ManyError> { - if symbols.is_empty() { - Ok(self.get_all_balances(identity)?) + let balances = self.get_all_balances(identity, context)?; + Ok(if symbols.is_empty() { + balances } else { - Ok(self - .get_all_balances(identity)? + balances .into_iter() .filter(|(k, _v)| symbols.contains(k)) - .collect()) - } + .collect() + }) } } diff --git a/src/many-ledger/src/storage/ledger_mintburn.rs b/src/many-ledger/src/storage/ledger_mintburn.rs index 27ef6028..a5d106a3 100644 --- a/src/many-ledger/src/storage/ledger_mintburn.rs +++ b/src/many-ledger/src/storage/ledger_mintburn.rs @@ -3,6 +3,7 @@ use crate::storage::ledger_tokens::key_for_symbol; use crate::storage::{key_for_account_balance, LedgerStorage}; use many_error::ManyError; use many_modules::ledger::TokenInfoArgs; +use many_protocol::context::Context; use many_types::ledger::{LedgerTokensAddressMap, Symbol, TokenAmount, TokenInfoSupply}; use merk::{BatchEntry, Op}; use std::collections::BTreeSet; @@ -22,6 +23,7 @@ impl LedgerStorage { &mut self, symbol: Symbol, distribution: &LedgerTokensAddressMap, + context: impl AsRef, ) -> Result<(), ManyError> { let mut batch: Vec = Vec::new(); let mut circulating = TokenAmount::zero(); @@ -44,7 +46,7 @@ impl LedgerStorage { // Store the new balance to the DB let new_balance = self - .get_multiple_balances(address, &BTreeSet::from([symbol]))? + .get_multiple_balances(address, &BTreeSet::from([symbol]), context.as_ref())? .get(&symbol) .map_or(amount.clone(), |b| b + amount); let key = key_for_account_balance(address, &symbol); @@ -79,6 +81,7 @@ impl LedgerStorage { &mut self, symbol: Symbol, distribution: &LedgerTokensAddressMap, + context: impl AsRef, ) -> Result<(), ManyError> { let mut batch: Vec = Vec::new(); let mut circulating = TokenAmount::zero(); @@ -90,7 +93,7 @@ impl LedgerStorage { // Check if we have enough funds let balance_amount = match self - .get_multiple_balances(address, &BTreeSet::from_iter([symbol]))? + .get_multiple_balances(address, &BTreeSet::from_iter([symbol]), context.as_ref())? .get(&symbol) { Some(x) if x < amount => Err(error::missing_funds(symbol, amount, x)), diff --git a/src/many-ledger/test-utils/Cargo.toml b/src/many-ledger/test-utils/Cargo.toml index 34e7550d..a6d20566 100644 --- a/src/many-ledger/test-utils/Cargo.toml +++ b/src/many-ledger/test-utils/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/liftedinit/many-framework" publish = false [dependencies] +async-channel = "1.8" coset = "0.3" cucumber = { version = "0.17.0", features = ["libtest"] } itertools = "0.10.3" diff --git a/src/many-ledger/test-utils/src/lib.rs b/src/many-ledger/test-utils/src/lib.rs index 2c374458..f7c79304 100644 --- a/src/many-ledger/test-utils/src/lib.rs +++ b/src/many-ledger/test-utils/src/lib.rs @@ -1,5 +1,6 @@ pub mod cucumber; +use async_channel::unbounded; use coset::CborSerializable; use itertools::Itertools; use many_error::ManyError; @@ -22,7 +23,7 @@ use many_modules::ledger::{ BalanceArgs, LedgerCommandsModuleBackend, LedgerModuleBackend, TokenCreateArgs, }; use many_modules::{account, events, ledger}; -use many_protocol::ResponseMessage; +use many_protocol::{RequestMessage, ResponseMessage}; use many_types::ledger::{ LedgerTokensAddressMap, Symbol, TokenAmount, TokenInfoSummary, TokenMaybeOwner, }; @@ -249,6 +250,7 @@ impl Setup { account: None, symbols: Some(vec![symbol].into()), }, + (RequestMessage::default(), unbounded().0).into(), )? .balances .get(&symbol) @@ -756,6 +758,7 @@ pub fn verify_balance( account: Some(id), symbols: Some(vec![symbol].into()), }, + (RequestMessage::default(), unbounded().0).into(), ); assert!(result.is_ok()); let balances = result.unwrap(); diff --git a/src/many-ledger/tests/storage.rs b/src/many-ledger/tests/storage.rs index 9e3bcf34..ca96cf9b 100644 --- a/src/many-ledger/tests/storage.rs +++ b/src/many-ledger/tests/storage.rs @@ -1,3 +1,4 @@ +use async_channel::unbounded; use many_identity::testing::identity; use many_identity::Address; use many_ledger::migration::tokens::TOKEN_MIGRATION; @@ -8,6 +9,7 @@ use many_modules::account::features::FeatureInfo; use many_modules::account::AccountModuleBackend; use many_modules::ledger::{LedgerModuleBackend, LedgerTokensModuleBackend, TokenInfoArgs}; use many_modules::{account, ledger}; +use many_protocol::RequestMessage; use std::collections::{BTreeMap, BTreeSet}; /// Verify persistent storage can be re-loaded @@ -57,6 +59,7 @@ fn load() { account: Some(identity(5)), symbols: Some(vec![identity(1000)].into()), }, + (RequestMessage::default(), unbounded().0).into(), ) .unwrap(); assert_eq!( @@ -150,6 +153,7 @@ fn load_symbol_meta() { account: Some(identity(5)), symbols: Some(vec![identity(1000)].into()), }, + (RequestMessage::default(), unbounded().0).into(), ) .unwrap(); assert_eq!(