Closed karim-en closed 4 months ago
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.
I guess we can use the HashMap
and don't care about the gas usage since it will be invoked only once.
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.
Performance / NEAR gas cost considerations
The borsh is used instead of JSON to decrease gas usage and migrate more accounts in one batch.
Testing
Added a test to the crate
aurora-engine-tests
, notaurora-engine-tests-connector
because the second one is enabled just for silo builds.How should this be reviewed
Additional information
It's controversial whether to use
HashMap<AccountId, Balance>
orVec<(AccountId, Balance)>
; theHashMap
prevents duplication, but on the other side, it increases gas usage.