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 gaps endpoint #4234

Merged
merged 5 commits into from
Jun 29, 2022
Merged

Nonce gaps endpoint #4234

merged 5 commits into from
Jun 29, 2022

Conversation

sstanculeanu
Copy link
Contributor

@sstanculeanu sstanculeanu commented Jun 28, 2022

Changes
  • added new endpoint for nonce gaps by sender "/pool/by-sender/nonce-gaps/:sender"
  • small refactor to remove code duplicate + for further improvements. Now txCache returns a slice of entire wrapped transactions which have all the info needed(hashes, nonces, etc)
  • now received wrapped txs from all txCaches are merged and sorted on apiTransactionProcessor

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

  1. start a local 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
    • 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
    • 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-account --num-accounts 10
  4. run ./scripts/badNonce.sh
  5. make a Get request to the node: http://127.0.0.1:node-port/transaction/pool to get tx pool
  6. copy one hash and get the tx details via http://127.0.0.1:node-port/transaction/your-hash
  7. copy the tx sender and get nonce gaps from this new endpoint: http://127.0.0.1:node-port/transaction/pool/by-sender/nonce-gaps/your-sender(if the provided alter example is used, one who tests should see many gaps of 3 nonces)

…e code duplicate and for further improvements
@sstanculeanu sstanculeanu self-assigned this Jun 28, 2022
@sstanculeanu sstanculeanu marked this pull request as ready for review June 28, 2022 11:05
@dragos-rebegea dragos-rebegea self-requested a review June 28, 2022 11:08
dragos-rebegea
dragos-rebegea previously approved these changes Jun 29, 2022
@ssd04 ssd04 self-requested a review June 29, 2022 11:40
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (feat/new-tx-api@4cf8fa1). Click here to learn what that means.
The diff coverage is n/a.

@@                Coverage Diff                 @@
##             feat/new-tx-api    #4234   +/-   ##
==================================================
  Coverage                   ?   75.88%           
==================================================
  Files                      ?      645           
  Lines                      ?    85413           
  Branches                   ?        0           
==================================================
  Hits                       ?    64814           
  Misses                     ?    15795           
  Partials                   ?     4804           

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 4cf8fa1...c6cd460. Read the comment docs.

@sstanculeanu sstanculeanu merged commit 28688d3 into feat/new-tx-api Jun 29, 2022
@sstanculeanu sstanculeanu deleted the nonce-gaps branch June 29, 2022 13:28
@sstanculeanu sstanculeanu added the ignore-for-release-notes Do not include item in release notes label Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-for-release-notes Do not include item in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants