-
Notifications
You must be signed in to change notification settings - Fork 75
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
Conversation
…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 ReportPatch and project coverage have no change.
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. |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
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; |
There was a problem hiding this comment.
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.
…less than 10 Signed-off-by: Alfredo Gutierrez <[email protected]>
Signed-off-by: Alfredo Gutierrez <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
* 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]>
* 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]>
* 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]>
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