Skip to content

refactor: Move total asset quantity to asset definition#5029

Merged
DCNick3 merged 2 commits intohyperledger-iroha:mainfrom
DCNick3:move-total-quantity-to-asset-definition
Sep 3, 2024
Merged

refactor: Move total asset quantity to asset definition#5029
DCNick3 merged 2 commits intohyperledger-iroha:mainfrom
DCNick3:move-total-quantity-to-asset-definition

Conversation

@DCNick3
Copy link
Copy Markdown
Contributor

@DCNick3 DCNick3 commented Sep 3, 2024

Context

total_asset_quantity map that we store is somewhat redundant and can be stored in the asset definition. This refactor allows us to remove FindTotalAssetQuantityByAssetDefinitionId query, as the total asset quantity can be found by querying the asset definition itself.

Closes #4934.

Solution

  • remove asset_total_quantities map from WSV
  • add total_quantity field to the AssetDefinition
  • remove FindTotalAssetQuantityByAssetDefinitionId query
  • replace test usages by the filtered FindAssetsDefinitions

Migration Guide

FindTotalAssetQuantityByAssetDefinitionId:

query(FindAssetsDefinitions::new())
  .filter_with(|asset_definition| asset_definition.id.eq(needle_definition_id))
  .execute_single()?
  .total_quantity

Checklist

…efinition itself

Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
…nd replace its usages

Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
@github-actions github-actions bot added the api-changes Changes in the API for client libraries label Sep 3, 2024
@DCNick3 DCNick3 added the queries label Sep 3, 2024
@DCNick3 DCNick3 merged commit 6613210 into hyperledger-iroha:main Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-changes Changes in the API for client libraries queries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move asset_total_amount inside the asset definition

3 participants