Eth connector statistic#104
Conversation
…hub.com:aurora-is-near/aurora-engine into eth-connector-statistic
| .unwrap() | ||
| .parse() | ||
| .unwrap(); | ||
| assert_eq!(counter, 2); |
There was a problem hiding this comment.
Why is the value 2? I only see one call to deposit so I would only expect there to be one account.
There was a problem hiding this comment.
Please look to that test:
#[test]
fn test_near_deposit_balance_total_supply() {
let (master_account, contract) = init(CUSTODIAN_ADDRESS);
call_deposit_near(&contract, CONTRACT_ACC);
let balance = get_near_balance(&master_account, DEPOSITED_RECIPIENT, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT - DEPOSITED_FEE);
let balance = get_near_balance(&master_account, CONTRACT_ACC, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_FEE);
There was a problem hiding this comment.
Right, there is a fee as well, so one deposit creates two accounts. Thanks for clarifying; it might be worth saying this in a comment as well.
Also, I recommend extending the test to have a transfer between those two accounts after the deposit, and confirm that the count does not change (because the number of unique accounts is the same).
sept-en
left a comment
There was a problem hiding this comment.
LGTM!
Still, let's put some attention to storage keys, otherwise, this could be quite confusing and hard to support later.
…hub.com:aurora-is-near/aurora-engine into eth-connector-statistic
birchmd
left a comment
There was a problem hiding this comment.
Generally looks good to me. Please see my note about extending the test.
| .unwrap() | ||
| .parse() | ||
| .unwrap(); | ||
| assert_eq!(counter, 2); |
There was a problem hiding this comment.
Right, there is a fee as well, so one deposit creates two accounts. Thanks for clarifying; it might be worth saying this in a comment as well.
Also, I recommend extending the test to have a transfer between those two accounts after the deposit, and confirm that the count does not change (because the number of unique accounts is the same).
Imptove comments Co-authored-by: Michael Birch <michael@near.org>
* Adde improvements afterreview - account checking, msg len check, json lib * Added json parser. Changed balance_of * Fixed balance_of test * json for ft_transfer & fix test * Json args for ft_transfer_call & fixed tests * Added json for FT storage methods * Fix ft_resolve transfer promise result check. Removed total_supply_near * Fix to NEP-145: storage_balance_of * Fix storage_balance_of to NEP-145 * Eth connector statistic (#104) * Added get_accounts_counter & tests * Clippy fix * Fixed: check accounts_contains_key & added comments * Lint: cargo fmt * Chanched key for Statistics * Update src/connector.rs Imptove comments Co-authored-by: Michael Birch <michael@near.org> * Changed: - get_accounts_counter - return le_bytes Added: - test_get_accounts_counter_and_transfer - check recalculation accounts Co-authored-by: Michael Birch <michael@near.org> Co-authored-by: Michael Birch <michael@near.org>
* Eugene's review 2021-05-08 * Eth connector improvements after review 2021-05-18 (#98) * Adde improvements afterreview - account checking, msg len check, json lib * Added json parser. Changed balance_of * Fixed balance_of test * json for ft_transfer & fix test * Json args for ft_transfer_call & fixed tests * Added json for FT storage methods * Fix ft_resolve transfer promise result check. Removed total_supply_near * Fix to NEP-145: storage_balance_of * Fix storage_balance_of to NEP-145 * Eth connector statistic (#104) * Added get_accounts_counter & tests * Clippy fix * Fixed: check accounts_contains_key & added comments * Lint: cargo fmt * Chanched key for Statistics * Update src/connector.rs Imptove comments Co-authored-by: Michael Birch <michael@near.org> * Changed: - get_accounts_counter - return le_bytes Added: - test_get_accounts_counter_and_transfer - check recalculation accounts Co-authored-by: Michael Birch <michael@near.org> Co-authored-by: Michael Birch <michael@near.org> Co-authored-by: Evgeny Ukhanov <mrlsd@ya.ru> Co-authored-by: Michael Birch <michael@near.org>
Calculate total unique accounts.
Added method:
Covered with test