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

RPC API Batch 1 - Acceptance Test - Improvement #1050

Merged
merged 4 commits into from
Apr 13, 2023

Conversation

AlfredoG87
Copy link
Collaborator

@AlfredoG87 AlfredoG87 commented Apr 12, 2023

Description:
changed the hardcoded value of "blocksBehindLatest" from 40 to 10, since is enough for the purpose of the test and gives higher chances that even if the tests and the hardware used to run the tests improves in the future, the test will continue to work.

Update:
Only if currentBlock is bigger than 10, we fetch past 10 blocks, otherwise we fetch everything since the block 0.

Related issue(s):

Fixes #1049

Notes for reviewer:

Checklist

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

…nce is enough for the purpose of the test and gives higher chances that even if the tests and the hardware used to run the tests improves in the future, the test will continue to work.

Signed-off-by: Alfredo Gutierrez <[email protected]>
Signed-off-by: Alfredo Gutierrez <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (a53d454) 74.59% compared to head (2fb437d) 74.59%.

❗ Current head 2fb437d differs from pull request most recent head c0f07f6. Consider uploading reports for the commit c0f07f6 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1050   +/-   ##
=======================================
  Coverage   74.59%   74.59%           
=======================================
  Files          31       31           
  Lines        2035     2035           
  Branches      387      387           
=======================================
  Hits         1518     1518           
  Misses        410      410           
  Partials      107      107           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@AlfredoG87 AlfredoG87 marked this pull request as ready for review April 12, 2023 01:08
@Nana-EC Nana-EC added P2 process Build, test and deployment-process related tasks enhancement New feature or request labels Apr 12, 2023
@Nana-EC Nana-EC added this to the 0.22.0 milestone Apr 12, 2023
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

Single consideration to make check more robust

@@ -281,7 +281,8 @@ describe('@api-batch-1 RPC Server Acceptance Tests', function () {
//for the purpose of the test, we are settings limit to 2, and fetching all.
//setting mirror node limit to 2 for this test only
process.env['MIRROR_NODE_LIMIT_PARAM'] = '2';
const blocksBehindLatest = Number(await relay.call('eth_blockNumber', [], requestId)) - 40;
// 10 is an arbitrary number and might be changed in the future for a smaller number in case test fails due to negative number in the fromBlock param
const blocksBehindLatest = Number(await relay.call('eth_blockNumber', [], requestId)) - 10;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth making sure the block count is always above this arbitrary number to avoid a negative number as you noted?

Suggested change
const blocksBehindLatest = Number(await relay.call('eth_blockNumber', [], requestId)) - 10;
const blockOffset = 10;
const latestBlockNum = await relay.call('eth_blockNumber', [], requestId))
const minBlockNum = min(latestBlockNum, blockOffset); // not sure if a further offset of 1 is needed
const blocksBehindLatest = minBlockNum - blockOffset;

Copy link
Collaborator Author

@AlfredoG87 AlfredoG87 Apr 12, 2023

Choose a reason for hiding this comment

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

I've changed it to check if CurrentBlock is bigger than 10, otherwise fetch from block 0 (the beginning).
also, the test needs at least 3 or more to pass.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@AlfredoG87 AlfredoG87 requested a review from Nana-EC April 12, 2023 15:55
Copy link
Contributor

@ebadiere ebadiere left a comment

Choose a reason for hiding this comment

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

LGTM.

@AlfredoG87 AlfredoG87 merged commit 0fc591b into main Apr 13, 2023
@AlfredoG87 AlfredoG87 deleted the 1049-improve-api-batch1-acceptancetest branch April 13, 2023 15:53
Nana-EC pushed a commit that referenced this pull request Apr 15, 2023
* changed the hardcoded value of "blocksBehindLatest" from 40 to 10, since is enough for the purpose of the test and gives higher chances that even if the tests and the hardware used to run the tests improves in the future, the test will continue to work.

Signed-off-by: Alfredo Gutierrez <[email protected]>

* adding comments to change

Signed-off-by: Alfredo Gutierrez <[email protected]>

* further improve test to fetch from beginning in case currentBlock is less than 10

Signed-off-by: Alfredo Gutierrez <[email protected]>

* avoid double call of eth_blockNumber

Signed-off-by: Alfredo Gutierrez <[email protected]>

---------

Signed-off-by: Alfredo Gutierrez <[email protected]>
Nana-EC pushed a commit that referenced this pull request Apr 15, 2023
* changed the hardcoded value of "blocksBehindLatest" from 40 to 10, since is enough for the purpose of the test and gives higher chances that even if the tests and the hardware used to run the tests improves in the future, the test will continue to work.

Signed-off-by: Alfredo Gutierrez <[email protected]>

* adding comments to change

Signed-off-by: Alfredo Gutierrez <[email protected]>

* further improve test to fetch from beginning in case currentBlock is less than 10

Signed-off-by: Alfredo Gutierrez <[email protected]>

* avoid double call of eth_blockNumber

Signed-off-by: Alfredo Gutierrez <[email protected]>

---------

Signed-off-by: Alfredo Gutierrez <[email protected]>
Nana-EC added a commit that referenced this pull request Apr 15, 2023
* changed the hardcoded value of "blocksBehindLatest" from 40 to 10, since is enough for the purpose of the test and gives higher chances that even if the tests and the hardware used to run the tests improves in the future, the test will continue to work.



* adding comments to change



* further improve test to fetch from beginning in case currentBlock is less than 10



* avoid double call of eth_blockNumber



---------

Signed-off-by: Alfredo Gutierrez <[email protected]>
Co-authored-by: Alfredo Gutierrez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 process Build, test and deployment-process related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RPC API Batch 1 Test is intermittently failing on CI/CD
4 participants