-
Notifications
You must be signed in to change notification settings - Fork 78
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
Eth connector statistic #104
Eth connector statistic #104
Conversation
…hub.com:aurora-is-near/aurora-engine into eth-connector-statistic
tests/test_connector.rs
Outdated
.unwrap() | ||
.parse() | ||
.unwrap(); | ||
assert_eq!(counter, 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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
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.
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
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.
Generally looks good to me. Please see my note about extending the test.
tests/test_connector.rs
Outdated
.unwrap() | ||
.parse() | ||
.unwrap(); | ||
assert_eq!(counter, 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.
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