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

New node API endpoints for transactions pool #4231

Merged
merged 41 commits into from
Jul 8, 2022

Conversation

sstanculeanu
Copy link
Contributor

@sstanculeanu sstanculeanu commented Jun 27, 2022

New endpoints:
  • /transaction/pool - to get all hashes from pool
  • /transaction/pool?fields=sender,receiver,gaslimit,gasprice,data,value,receiverusername to get the specified fields for all transactions in pool. They are optional and hashes will be default.
  • /transaction/pool?last-nonce=true - error
  • /transaction/pool?nonce-gaps=true - error
  • /transaction/pool?fields + &last-nonce/&nonce-gaps - error
  • /transaction/pool?by-sender=erd1.... - to get all hashes from pool for a specific sender
  • /transaction/pool?by-sender=erd1...&last-nonce=true - to get last nonce from pool for a specific sender
  • /transaction/pool?by-sender=erd1...&nonce-gaps=true to get any nonce gaps from pool for a specific sender
  • /transaction/pool?by-sender=erd1...&fields=sender,receiver,gaslimit,gasprice,data,value,receiverusername to get the specified fields for all transactions in pool for a specific sender They are optional and hashes will be default.
  • /transaction/pool?by-sender=erd1...&fields + &last-nonce/&nonce-gaps - error

In order to test the changes, the following steps are needed:

  1. start a testnet with this branch
  2. clone elrond-txgen-go and update the following:
    • in cmd/txgen/config/config.toml, leave Scenarios = ["badNonce"], update ProxyServerURL with the port that your local proxy uses, optional update MintingValue to a smaller one. (badNonce scenario is used to create nonce gaps and fill the tx pool)
    • copy from the newly generated node/config/walletKey.pem(local testnet) one of the private keys and paste it into cmd/txgen/config/walletKey.Pem
    • optional only for testing nonce-gaps: alter badNonceSecnario.go file, HandleTransaction method in order to always send bad nonces with gaps(eg. on line 62 you can use b.sendersMap[tx.Sender] = nonceToUse + 3)
  3. cd /cmd/txgen, go build and start txgen ./txgen --new-accounts --num-accounts 10
  4. run ./scripts/badNonce.sh
  5. close the script after few txs and then use the endpoints. In order to test the ones with sender, you first should run a /transaction/pool?fields=sender to get all txs from pool with the sender info, then use one of those addresses.

@sstanculeanu sstanculeanu self-assigned this Jun 27, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2022

Codecov Report

❗ No coverage uploaded for pull request base (rc/2022-july@0e7bddb). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 1bbe5a9 differs from pull request most recent head db4d98d. Consider uploading reports for the commit db4d98d to get more accurate results

@@               Coverage Diff               @@
##             rc/2022-july    #4231   +/-   ##
===============================================
  Coverage                ?   73.69%           
===============================================
  Files                   ?      662           
  Lines                   ?    85880           
  Branches                ?        0           
===============================================
  Hits                    ?    63289           
  Misses                  ?    17836           
  Partials                ?     4755           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e7bddb...db4d98d. Read the comment docs.

sstanculeanu and others added 5 commits July 5, 2022 13:36
…_feat_new_tx_api_2022.07.05

# Conflicts:
#	api/errors/errors.go
#	api/mock/facadeStub.go
#	api/shared/interface.go
#	facade/interface.go
#	facade/mock/apiResolverStub.go
#	facade/nodeFacade_test.go
#	integrationTests/interface.go
#	node/external/transactionAPI/apiTransactionProcessor.go
#	node/external/transactionAPI/apiTransactionProcessor_test.go
#	node/mock/apiTransactionHandlerStub.go
…x_api_2022.07.05

Merge dev into feat new tx api 2022.07.05
@sstanculeanu sstanculeanu changed the base branch from development to rc/2022-july July 7, 2022 07:26
@sstanculeanu sstanculeanu marked this pull request as ready for review July 7, 2022 10:52
Copy link
Contributor

@popenta popenta left a comment

Choose a reason for hiding this comment

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

@@ Log scanner @@

feat/new-tx-api

================================================================================

  • Known Warnings 13
  • New Warnings 0
  • Known Errors 0
  • New Errors 0
  • Panics 0
    ================================================================================
    system test + scenario passed

sstanculeanu and others added 2 commits July 8, 2022 12:43
…ew_tx_api_2022.07.08

Merge rc july into feat new tx api 2022.07.08
sstanculeanu and others added 2 commits July 8, 2022 17:14
…ew_tx_api_2022.07.08_p2

Merge rc july into feat new tx api 2022.07.08 p2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants