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

Nonce Filter Is Ignored on /api/v1/transactions/{hash} #9715

Open
jnels124 opened this issue Nov 7, 2024 · 5 comments · May be fixed by #9842
Open

Nonce Filter Is Ignored on /api/v1/transactions/{hash} #9715

jnels124 opened this issue Nov 7, 2024 · 5 comments · May be fixed by #9842
Assignees
Labels
bug Type: Something isn't working good first issue candidate Issues that can become a good first issue but need more description/context. good first issue Good for newcomers rest Area: REST API
Milestone

Comments

@jnels124
Copy link
Contributor

jnels124 commented Nov 7, 2024

Description

The nonce query param is only respected when making request with the transaction id and not when request is made with transaction hash.

Steps to reproduce

Given the following request:

 curl -X 'GET' \                                                                                                                                                                                        
'https://testnet.mirrornode.hedera.com/api/v1/transactions/r6rpaXaYCvy9pPnCfO0f64IoDf0TrnNU0dHfFFbeOeBvhivdO+rcP134dCb44LkA?nonce=0' \
 -H 'accept: application/json'

The following result will be returned(correct):

{"transactions":[{"bytes":null,"charged_tx_fee":207448,"consensus_timestamp":"1730913223.447111312","entity_id":null,"max_fee":"2655000000","memo_base64":"","name":"ETHEREUMTRANSACTION","nft_transfers":[],"node":"0.0.3","nonce":0,"parent_consensus_timestamp":null,"result":"WRONG_NONCE","scheduled":false,"staking_reward_transfers":[],"token_transfers":[],"transaction_hash":"r6rpaXaYCvy9pPnCfO0f64IoDf0TrnNU0dHfFFbeOeBvhivdO+rcP134dCb44LkA","transaction_id":"0.0.902-1730913210-989942481","transfers":[{"account":"0.0.3","amount":7413,"is_approval":false},{"account":"0.0.98","amount":180032,"is_approval":false},{"account":"0.0.800","amount":20003,"is_approval":false},{"account":"0.0.902","amount":-207448,"is_approval":false}],"valid_duration_seconds":"120","valid_start_timestamp":"1730913210.989942481"}]}

However with the following request with the wrong nonce filter still returns the result

curl -X 'GET' \                                                                                                              
'https://testnet.mirrornode.hedera.com/api/v1/transactions/r6rpaXaYCvy9pPnCfO0f64IoDf0TrnNU0dHfFFbeOeBvhivdO+rcP134dCb44LkA?nonce=1000' \
 -H 'accept: application/json'

Additional context

No response

Hedera network

testnet

Version

v0.117.0

Operating system

None

@jnels124 jnels124 added bug Type: Something isn't working good first issue Good for newcomers rest Area: REST API labels Nov 7, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Mirror Node Nov 7, 2024
@steven-sheehy steven-sheehy added the good first issue candidate Issues that can become a good first issue but need more description/context. label Nov 8, 2024
@AsfarHorani
Copy link

Hi @jnels124 can u assign it to me? I am willing to solve it

@steven-sheehy steven-sheehy moved this from 📋 Backlog to 🏃‍♀ Sprint backlog in Mirror Node Nov 10, 2024
@jnels124 jnels124 moved this from 👀 In review to 👷 In progress in Mirror Node Nov 12, 2024
@HarshSawarkar
Copy link
Contributor

HarshSawarkar commented Nov 27, 2024

Hi,I would like to work on this issue if no one else is working on it currently.

@HarshSawarkar
Copy link
Contributor

Hi @jnels124, I have raised a PR. Could you please review it?

@HarshSawarkar
Copy link
Contributor

I also tried to run the transactions.test.js class extractSqlFromTransactionsByIdOrHashRequest test, but I kept getting the following error. Could you guide me on how to resolve it? Here’s the error I’m encountering:
`
● Test suite failed to run

Jest encountered an unexpected token

Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

By default "node_modules" folder is ignored by transformers.

Here's what you can do:
 • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
 • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
 • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
 • If you need a custom transformation specify a "transform" option in your config.
 • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation

Details:

D:\Hedera-Mirror-Node\hedera-mirror-rest\__tests__\jestSetup.js:17
import { jest } from '@jest/globals';
^^^^^^

SyntaxError: Cannot use import statement outside a module

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)

`

@steven-sheehy steven-sheehy moved this from 👷 In progress to 👀 In review in Mirror Node Dec 3, 2024
@steven-sheehy steven-sheehy added this to the 0.120.0 milestone Dec 3, 2024
@xin-hedera
Copy link
Collaborator

I also tried to run the transactions.test.js class extractSqlFromTransactionsByIdOrHashRequest test, but I kept getting the following error. Could you guide me on how to resolve it? Here’s the error I’m encountering: ` ● Test suite failed to run

Jest encountered an unexpected token

Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

By default "node_modules" folder is ignored by transformers.

Here's what you can do:
 • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
 • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
 • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
 • If you need a custom transformation specify a "transform" option in your config.
 • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation

Details:

D:\Hedera-Mirror-Node\hedera-mirror-rest\__tests__\jestSetup.js:17
import { jest } from '@jest/globals';
^^^^^^

SyntaxError: Cannot use import statement outside a module

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)

`

What is the command you used to run the test? can you try this instead?

 npm test -- __tests__/transactions.test.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Something isn't working good first issue candidate Issues that can become a good first issue but need more description/context. good first issue Good for newcomers rest Area: REST API
Projects
Status: 👀 In review
5 participants