-
Notifications
You must be signed in to change notification settings - Fork 976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multitoken transfer and query #359
Conversation
pls update wasm |
apps/src/lib/client/rpc.rs
Outdated
match token::is_any_multitoken_balance_key(&key) { | ||
Some((sub_prefix, o)) if *o == owner => { | ||
writeln!( | ||
w, | ||
"{} with {}: {}", | ||
currency_code, sub_prefix, balance | ||
) | ||
.unwrap(); | ||
found_any = true; | ||
} | ||
Some(_) => {} | ||
None => { | ||
if let Some(o) = | ||
token::is_any_token_balance_key(&key) | ||
{ | ||
if *o == owner { | ||
writeln!( | ||
w, | ||
"{}: {}", | ||
currency_code, balance | ||
) | ||
.unwrap(); | ||
found_any = true; | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code block exists three times identically. Maybe use a helper func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added print_balances
func.
shared/src/types/token.rs
Outdated
// token, balance, owner | ||
return None; | ||
} | ||
match key.get_at(len - 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use ?
and I think it will simplify the code a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I tried to use a delimiter to simplify it.
shared/src/types/token.rs
Outdated
Some(DbKeySeg::StringSeg(balance)) | ||
if balance == BALANCE_STORAGE_KEY => | ||
{ | ||
match key.segments.last() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, ?
should tighten this up
); | ||
None | ||
} | ||
Err(_) => None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come we ignore the error here now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question!
query_storage_prefix
is called for the balance read.
The error message frequently appears when the validity predicate is read even though we want to read just Amount
.
I think it is more readable without the error message.
I am testing this out now with the Ethereum bridge multitoken functionality. I think there is some code/terminology we can standardize or share between IBC multitoken and Ethereum bridge multitoken, that can be a later PR/issue though. Specifically I'd suggest we use a similar sort of terminology to https://eips.ethereum.org/EIPS/eip-1155#abstract. |
I tried out For ERC20 tokens, checking balances will look like: namadac balance \
--token atest1v9hx7w36g42ysgzzwf5kgem9ypqkgerjv4ehxgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpq8f99ew \
--sub-prefix ERC20/0x6b175474e89094c44da98b954eedeac495271d0f Transfers will look like namadac transfer \
--token atest1v9hx7w36g42ysgzzwf5kgem9ypqkgerjv4ehxgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpq8f99ew \
--sub-prefix ERC20/0x6b175474e89094c44da98b954eedeac495271d0f
--source "${VALIDATOR_ADDR}" \
--target "${RECEIVER_ADDR}" \
--amount 10 |
1380a90
to
a360b02
Compare
pls update wasm |
Draft drifted somewhat over this release cycle. We can clear this up with a merge-and-delete. * draft: (373 commits) changelog: add #452 feat: rocksdb use jemalloc feat: update rocksdb version [ci] wasm checksums update changelog: add #501 fix e2e tests fix e2e tests Misc refactoring Uses `end_epoch` in `query_proposal_result` Refactors governance e2e tests [ci] wasm checksums update changelog: #503 [ci] wasm checksums update remove unfinished lazy_set, lazy_hashset and lazy_hashmap for now ledger/storage/lazy: update lazy_set for updated trait LazyCollection Fixes specs [ci] wasm checksums update fix display proposal result in cli fix proposal_submission e2e test [misc] rebase ledger/storage/lazy: remove unused error cases WIP: Nested LazyMap validation and testing WIP: validation for lazy_map WIP: StateMachine tests for lazy_vec validation update wasm checksums changelog: add #500 remove intent gossiper, matchmaker and their deps Adds `max_proposal_period` governance parameter Removes `max_proposal_fund_transfer` parameter Use proposal `end_epoch` instead of `start_epoch` for voting power Skip tx whitelist for proposal code Rename `Treasury` to `SlashFund` fmt and fix clippy Speeds up testing Fixes `safe_exit` call only if `force` is not set [misc]: remove logs [fix]: votes accumulation Fixes test artifacts folder persistence Fixes e2e tests [fix]: e2e test [fix]: e2e test [misc]: clippy, fmt [fix]: error println [feat]: vote transaction validation [fix]: governance vp author address, proposal submission validation [fix]: bad validation condition [fix]: clippy, fmt [fix]: clippy, fmt [misc]: clippy, fmt [feat]: added total votes to query [fix]: governance overflow, proposal validation fixup! Merge branch 'yuji/multitoken' (#359) fixup! rustdoc: fix more broken links fixup! Sync with 'main' rustdoc: fix more broken links fixup! Sync with 'main' [ci] wasm checksums update changelog: add #359 change the balance format update a test wasm remove an error message [ci skip] wasm checksums update multitoken transfer and query post-conditions for Transition::Update + some comments quick bug and documentation fix update after rebase on #458, #465 storage/lazy_vec: add state machine test for lazy vec API storage/lazy_vec/validation: disallow unrecognized keys matching prefix impl LazyCollection trait for all the collections + refactor storage_api/collections/lazy: allow nested lazy collections in LazyMap add lazy_vec validation fix clippy storage_api/collections/lazy: add basic tests and missing methods cargo test test_lazy_vec_basics update lazy for explicit lifetime in StorageRead trait storage: add `Key::last` method, impl KeySeg for all ints Switch to use storage::KeySeg and add LazySet add lazy map without hashing refactored lazy collections, replaced hasher, added iter fmt && clippy add fn get_elem_key_by_hash to LazyMap lazy hash map first commit add lazy set (WIP), make LazyVec.get public add lazy vector create lazy data structures for storage access rustdoc: resolve ambiguous link changelog: add #465 fixup! Merge branch 'namada/tomas/sorted-prefix-iter' (#458) [ci skip] wasm checksums update ledger: use storage_api::Error in VpEnv and TxEnv instead of generic [ci skip] wasm checksums update changelog: add #458 tests: extend prefix iter tests for reverse order add support for rev_iter_prefix in storage and VP and tx envs test/vm_host_env: check prefix iter order in tx and VP shared/storage/key: add support for int/uint keys that maintain order deps: replace hex with data-encoding update wasm checksums changelog: add #380 changelog: add #384 ...
closes #132
split #297 which has lots IBC related changes
based on #442