Skip to content

feat(queries): Transaction and block predicates#5025

Merged
mversic merged 5 commits intohyperledger-iroha:mainfrom
DCNick3:transaction-and-block-predicates
Sep 5, 2024
Merged

feat(queries): Transaction and block predicates#5025
mversic merged 5 commits intohyperledger-iroha:mainfrom
DCNick3:transaction-and-block-predicates

Conversation

@DCNick3
Copy link
Copy Markdown
Contributor

@DCNick3 DCNick3 commented Sep 2, 2024

Context

Closes #5017, Closes #4985.

Solution

With the new predicates, you can now filter blocks by their hash and transactions:

  • by their hash
  • by hash of their block
  • by the account id of the transaction submitter

Or any boolean combination of the above.

This removes FindTransactionsByAccountId, FindTransactionByHash and FindBlockHeaderByHash.

Migration Guide

  • FindTransactionsByAccountId:
query(FindTransactions::new()).filter_with(|tx| tx.transaction.value.authority.eq(needle_account_id))
  • FindTransactionByHash:
query(FindTransactions::new()).filter_with(|tx| tx.transaction.value.hash.eq(needle_hash))
  • FindBlockHeaderByHash:
query(FindBlockHeaders::new()).filter_with(|header| header.hash.eq(needle_hash))

Checklist

@github-actions github-actions bot added the api-changes Changes in the API for client libraries label Sep 2, 2024
@DCNick3 DCNick3 self-assigned this Sep 3, 2024
@Erigara Erigara self-assigned this Sep 3, 2024
@DCNick3 DCNick3 added the queries label Sep 3, 2024
@DCNick3 DCNick3 force-pushed the transaction-and-block-predicates branch from 97a47de to 5b63359 Compare September 4, 2024 06:36
Comment thread data_model/src/query/predicate/predicate_atoms/block.rs
Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
- based on the hash of the transaction
- based on the hash of the block
- based on whether it has finished with an error

Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
…and blocks

Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
…, update tests, regenerate schema

Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
@mversic mversic force-pushed the transaction-and-block-predicates branch from 5b63359 to bff9350 Compare September 5, 2024 05:44
@mversic mversic merged commit 8bc3064 into hyperledger-iroha:main Sep 5, 2024
@alexstroke1 alexstroke1 self-assigned this Oct 9, 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.

Implement query predicates for transactions and blocks [feature request] Support filtering transactions by block hash

4 participants