-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add api to get ft balances for multiple accounts (#905)
<!-- Thanks for submitting a pull request! Here are some helpful tips: * Always create branches on and target the `develop` branch. * Run all the tests locally and ensure that they are passing. * Run `make format` to ensure that the code is formatted. * Run `make check` to ensure that all checks passed successfully. * Small commits and contributions that attempt one single goal is preferable. * If the idea changes or adds anything functional which will affect users, an AIP discussion is required first on the Aurora forum: https://forum.aurora.dev/discussions/AIPs%20(Aurora%20Improvement%20Proposals). * Avoid breaking the public API (namely in engine/src/lib.rs) unless required. * If your PR is a WIP, ensure that you enable "draft" mode. * Your first PRs won't use the CI automatically unless a maintainer starts. If this is not your first PR, please do NOT abuse the CI resources. Checklist: - [ ] I have performed a self-review of my code - [ ] I have documented my code, particularly in the hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests to prove my fix or new feature is effective and works - [ ] Any dependent changes have been merged - [ ] The PR is targeting the `develop` branch and not `master` - [ ] I have pre-squashed my commits into a single commit and rebased. --> ## Description The PR adds a public method to the engine/internal connector to get balances of multiple accounts. This is needed because we have changed the migration logic to migrate the balances based on the on-chain data, not off-chain. <!-- Provide a general summary of your changes. A clear overview along with an in-depth explanation is beneficial. If this PR closes any issues, be sure to add "closes #<number>" somewhere. --> ## Performance / NEAR gas cost considerations The borsh is used instead of JSON to decrease gas usage and migrate more accounts in one batch. <!-- Performance regressions are not ideal, though we welcome performance improvements. Any PR must be completely mindful of any gas cost increases. The CI will fail if the gas costs change at all. Do update these tests to accommodate for the new gas changes. It is good to explain this change, if necessary. --> ## Testing Added a test to the crate `aurora-engine-tests`, not `aurora-engine-tests-connector` because the second one is enabled just for silo builds. <!-- Please describe the tests that you ran to verify your changes. --> ## How should this be reviewed <!-- Include any recommendations of areas to be careful of to ensure that the reviewers use extra attention. --> ## Additional information It's controversial whether to use `HashMap<AccountId, Balance>` or `Vec<(AccountId, Balance)>`; the `HashMap` prevents duplication, but on the other side, it increases gas usage. <!-- Include any additional information which you think should be in this PR, such as prior arts, future extensions, unresolved problems, or a TODO list which should be followed up. --> --------- Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev> Co-authored-by: Michael Birch <michael.birch@aurora.dev>
- Loading branch information
1 parent
9e6d122
commit 174a6c6
Showing
6 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters