Skip to content
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

Updated the query to return all relevant transactions #9719

Conversation

HarshSawarkar
Copy link
Contributor

Description:

Modified the query to return all relevant transaction
Related issue(s):

Fixes #9606

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Harsh Sawarkar <harshsawarkar111@gmail.com>
@HarshSawarkar HarshSawarkar requested a review from a team as a code owner November 10, 2024 17:20
hedera-mirror-rest/transactions.js Outdated Show resolved Hide resolved
@@ -344,7 +345,8 @@ const getTransferDistinctTimestampsQuery = (

// the condition to exclude synthetic transactions attached to a user submitted transaction
const transactionByPayerExcludeSyntheticCondition = `${Transaction.getFullName(Transaction.NONCE)} = 0 or
${Transaction.getFullName(Transaction.PARENT_CONSENSUS_TIMESTAMP)} is not null`;
${Transaction.getFullName(Transaction.PARENT_CONSENSUS_TIMESTAMP)} is not null
or ${Transaction.getFullName(Transaction.TYPE)} in (${typesToInclude.map((type) => `'${type}'`).join(', ')})`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once other comments are addressed, .map can be removed. Also, we should only add condition if array is not empty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should update the hedera-mirror-rest/__tests__/specs/transactions/account-id.json spec test to include these types of transactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@@ -41,6 +41,10 @@ hedera:
username: metrics
uriPath: "/swagger"
ipMetrics: false
transactions:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the protoId of these types. See TransactionType.java.

Copy link
Contributor

@jnels124 jnels124 Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should move this config to be under the query config and change typesToInclude to precedingTransactionTypes and add config prop to configuration.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

…lude these transactions, and revised configuration.md.

Signed-off-by: Harsh Sawarkar <harshsawarkar111@gmail.com>
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.13%. Comparing base (8e18691) to head (a33790b).
Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
hedera-mirror-rest/config.js 80.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (8e18691) and HEAD (a33790b). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (8e18691) HEAD (a33790b)
10 7
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #9719       +/-   ##
=============================================
- Coverage     92.23%   77.13%   -15.11%     
+ Complexity     7628      819     -6809     
=============================================
  Files           937      325      -612     
  Lines         32121    10801    -21320     
  Branches       4070     1464     -2606     
=============================================
- Hits          29626     8331    -21295     
- Misses         1542     2154      +612     
+ Partials        953      316      -637     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@@ -46,6 +46,7 @@ const {
response: {
limit: {default: defaultResponseLimit},
},
transactions: {typesToInclude},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be changed to precedingTransactionTypes

@@ -542,6 +542,7 @@ value, it is recommended to only populate overridden properties in the custom `a
| `hedera.mirror.rest.query.maxTransactionsTimestampRange` | 60d | The maximum timestamp range to list transactions. |
| `hedera.mirror.rest.query.strictTimestampParam` | true | Enables strict checking of timestamp query param (currently only effects /api/v1/accounts/{id}?timestamp={timestamp} |
| `hedera.mirror.rest.query.topicMessageLookup` | false | Enables topic message lookup querying |
| 'hedera.mirror.rest.query.transactions.precedingTransactionTypes' | [11, 15] | An array of protoIds that specifies transactions to be prioritized for inclusion in the response |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to: Array of transaction types to be included in transactions by account id response when there is no parent and nonce is non-zero'

@@ -188,6 +188,13 @@ const parseNetworkConfig = () => {
}
};

const parseTransactionConfig = () => {
Copy link
Contributor

@jnels124 jnels124 Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can parse this in parseQueryConfig

Signed-off-by: Harsh Sawarkar <harshsawarkar111@gmail.com>
Signed-off-by: Harsh Sawarkar <harshsawarkar111@gmail.com>
…evant-Transactions

Signed-off-by: Harsh Vinod Sawarkar <harshsawarkar111@gmail.com>
Signed-off-by: Harsh Sawarkar <harshsawarkar111@gmail.com>
Signed-off-by: Harsh Sawarkar <harshsawarkar111@gmail.com>
Signed-off-by: Harsh Sawarkar <harshsawarkar111@gmail.com>
…turn-All-Relevant-Transactions' into chore-Transactions-API-Should-Return-All-Relevant-Transactions

# Conflicts:
#	docs/configuration.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transactions API Should Return All Relevant Transactions
2 participants