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

fix: added polling logic to ensure the retrieval of fully mature records from MN #3368

Conversation

quiet-node
Copy link
Member

Description:
This PR enhances the retry mechanisms in getContractResultWithRetry() and getContractResultsLogsWithRetry() by adding polling logic to ensure the retrieval of fully mature records. Additionally, the Relay now implements strict error handling to throw exceptions when immature records are encountered. This approach aims to prevent the Cannot read properties of null (reading 'xyz') error caused by improper handling of null checks.

Related issue(s):

Fixes #3366

Notes for reviewer:

Checklist

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

@quiet-node quiet-node added the enhancement New feature or request label Jan 10, 2025
@quiet-node quiet-node added this to the 0.63.1 milestone Jan 10, 2025
@quiet-node quiet-node self-assigned this Jan 10, 2025
@quiet-node quiet-node requested review from a team as code owners January 10, 2025 00:20
Copy link

github-actions bot commented Jan 10, 2025

Test Results

 20 files   -   7  267 suites   - 109   46m 30s ⏱️ - 52m 18s
612 tests  -   3  606 ✅ + 17  4 💤 +1  2 ❌  - 21 
689 runs   - 195  683 ✅  - 172  4 💤 ±0  2 ❌  - 23 

For more details on these failures, see this check.

Results for commit 256a28b. ± Comparison against base commit 16939ff.

This pull request removes 6 and adds 3 tests. Note that renamed tests count towards both.
"before all" hook in "@api-batch-2 RPC Server Acceptance Tests" ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-2 RPC Server Acceptance Tests "before all" hook in "@api-batch-2 RPC Server Acceptance Tests"
"before all" hook in "@tokenmanagement HTS Precompile Token Management Acceptance Tests" ‑ RPC Server Acceptance Tests Acceptance tests @tokenmanagement HTS Precompile Token Management Acceptance Tests "before all" hook in "@tokenmanagement HTS Precompile Token Management Acceptance Tests"
"before all" hook in "HBAR Rate Limit Tests" ‑ RPC Server Acceptance Tests Acceptance tests @hbarlimiter HBAR Limiter Acceptance Tests HBAR Rate Limit Tests "before all" hook in "HBAR Rate Limit Tests"
"before each" hook for "Should eventually exhaust the hbar limit for PRIVILEGED user and still allow another PRIVILEGED user to make calls" ‑ RPC Server Acceptance Tests Acceptance tests @hbarlimiter HBAR Limiter Acceptance Tests HBAR Rate Limit Tests HBAR Rate Limit For Different Spending Plan Tiers @hbarlimiter-batch2 Preconfigured Tiers PRIVILEGED Tier "before each" hook for "Should eventually exhaust the hbar limit for PRIVILEGED user and still allow another PRIVILEGED user to make calls"
"before each" hook for "from/to Addresses in transaction to a contract (deployed through the relay) are in evm and long-zero format" ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-2 RPC Server Acceptance Tests "before each" hook for "from/to Addresses in transaction to a contract (deployed through the relay) are in evm and long-zero format"
"before each" hook for "should execute "eth_getStorageAt" request to get current state changes" ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-2 RPC Server Acceptance Tests "before each" hook for "should execute "eth_getStorageAt" request to get current state changes"
from/to Addresses in transaction to a contract (deployed through HAPI tx) are in evm and long-zero format ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-2 RPC Server Acceptance Tests Formats of addresses in Transaction and Receipt results from/to Addresses in transaction to a contract (deployed through HAPI tx) are in evm and long-zero format
from/to Addresses in transaction to a contract (deployed through the relay) are in evm and long-zero format ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-2 RPC Server Acceptance Tests Formats of addresses in Transaction and Receipt results from/to Addresses in transaction to a contract (deployed through the relay) are in evm and long-zero format
from/to Addresses when transferring HTS tokens to the tokenAddress are in evm and long-zero format ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-2 RPC Server Acceptance Tests Formats of addresses in Transaction and Receipt results from/to Addresses when transferring HTS tokens to the tokenAddress are in evm and long-zero format

♻️ This comment has been updated with latest results.

@quiet-node quiet-node changed the title fix: added polling logic to getContractResultWithRetry() and getContractResultsLogsWithRetry() fix: added polling logic to ensure the retrieval of fully mature records from MN Jan 10, 2025
Copy link
Collaborator

@natanasow natanasow left a comment

Choose a reason for hiding this comment

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

LG

@quiet-node quiet-node merged commit 6e88f01 into main Jan 10, 2025
50 of 52 checks passed
@quiet-node quiet-node deleted the 3366-failed-request-alert-tuning-enhanced-retry-mechanism-for-mn-contract-results-to-poll-until-records-are-fully-mature branch January 10, 2025 17:31
quiet-node added a commit that referenced this pull request Jan 10, 2025
…rds from MN (#3368)

* fix: added polling logic to getContractResultWithRetry() and getContractResultsLogsWithRetry()

Signed-off-by: Logan Nguyen <[email protected]>

* fix: strictly throw errors if immature records found

Signed-off-by: Logan Nguyen <[email protected]>

---------

Signed-off-by: Logan Nguyen <[email protected]>
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 82.22222% with 8 lines in your changes missing coverage. Please review.

Project coverage is 85.00%. Comparing base (16939ff) to head (256a28b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/relay/src/lib/clients/mirrorNodeClient.ts 82.85% 3 Missing and 3 partials ⚠️
packages/relay/src/lib/eth.ts 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3368      +/-   ##
==========================================
+ Coverage   84.79%   85.00%   +0.21%     
==========================================
  Files          69       69              
  Lines        4721     4742      +21     
  Branches     1063     1067       +4     
==========================================
+ Hits         4003     4031      +28     
+ Misses        400      396       -4     
+ Partials      318      315       -3     
Flag Coverage Δ
config-service 98.14% <ø> (ø)
relay 79.56% <82.22%> (+0.06%) ⬆️
server 83.28% <ø> (ø)
ws-server 36.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../lib/services/ethService/ethCommonService/index.ts 90.20% <100.00%> (+0.06%) ⬆️
packages/relay/src/lib/eth.ts 86.23% <75.00%> (+0.08%) ⬆️
packages/relay/src/lib/clients/mirrorNodeClient.ts 89.16% <82.85%> (+0.54%) ⬆️

... and 3 files with indirect coverage changes

quiet-node added a commit that referenced this pull request Jan 10, 2025
…eval of fully mature records from MN (#3370)

fix: added polling logic to ensure the retrieval of fully mature records from MN (#3368)

* fix: added polling logic to getContractResultWithRetry() and getContractResultsLogsWithRetry()



* fix: strictly throw errors if immature records found



---------

Signed-off-by: Logan Nguyen <[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
Projects
None yet
3 participants