hashgraph / hedera-mirror-node

Hedera Mirror Node archives data from consensus nodes and serves it via an API
Apache License 2.0
128 stars 108 forks source link

Return empty contract results instead of code 404 when block not found #9354

Closed xin-hedera closed 2 weeks ago

xin-hedera commented 2 weeks ago

Description:

This PR changes /contracts/results and /contracts/{id}/results to return empty contract results with code 200 when the block by block.number=X or block.hash=X query param doesn't exist.

Related issue(s):

Fixes #9353

Notes for reviewer:

The bug was triggered because I added integration tests to cover 404 for the above scenarios. However it only failed after merging to main because in my PR branch openapi validator was disabled and only when it's enabled later and detects 404 is not a valid return code for the /contracts/results endpoint per our openapi spec.

Checklist

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.51%. Comparing base (307c002) to head (329e062). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #9354 +/- ## ============================================ - Coverage 93.15% 92.51% -0.65% - Complexity 1092 7012 +5920 ============================================ Files 363 904 +541 Lines 11285 29669 +18384 Branches 1642 3751 +2109 ============================================ + Hits 10513 27449 +16936 - Misses 633 1450 +817 - Partials 139 770 +631 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.