iotex-core icon indicating copy to clipboard operation
iotex-core copied to clipboard

[API]add web3 API debug_traceBlockByNumber,debug_traceBlockByHash

Open millken opened this issue 1 year ago • 3 comments

Description

depent on : https://github.com/iotexproject/iotex-proto/pull/140, CI will not passed before pr merge

debug_traceBlockByNumber 、 debug_traceBlockByHash

Returns tracing results by executing all transactions in the specified block number.

Parameters

  • blockNumber: (string) [required] block number as a hexidecimal string, or one of the string tags latestearliest , or pending, as described in the default block parameters.
  • Optional tracing options object with the following fields:
    • tracer: (string) [optional] type of tracer. Supports callTracer or prestateTracer.
    • tracerConfig: (object) [optional] tracer configuration options:
      • onlyTopCall: (boolean) [optional] when true, will only trace the primary (top-level) call and not any sub-calls. It eliminates the additional processing for each call frame.

Returns

curl http://127.0.0.1:15014/ \
-X POST \
-H "Content-Type: application/json" \
-d '{"method":"debug_traceBlockByNumber","params":["0x12a1c", {"tracer": "callTracer"}],"id":1,"jsonrpc":"2.0"}'

{"jsonrpc":"2.0","id":1,"result":[{"result":{"from":"0x0000000000000000000000000000000000000000","gas":"0x92f6a8","gasUsed":"0x0","to":"0xbd770416a3345f91e4b34576cb804a576fa48eb1","input":"...","output":"..","value":"0x0","type":"CREATE"}}]}

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [x] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

millken avatar Jan 11 '24 09:01 millken

Codecov Report

Attention: Patch coverage is 28.94737% with 81 lines in your changes are missing coverage. Please review.

Project coverage is 75.83%. Comparing base (d716bb9) to head (cb7b307). Report is 26 commits behind head on master.

:exclamation: Current head cb7b307 differs from pull request most recent head 3d4b261. Consider uploading reports for the commit 3d4b261 to get more accurate results

Files Patch % Lines
api/web3server.go 2.77% 70 Missing :warning:
api/coreservice.go 73.80% 9 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4051      +/-   ##
==========================================
- Coverage   76.51%   75.83%   -0.68%     
==========================================
  Files         340      334       -6     
  Lines       29273    28543     -730     
==========================================
- Hits        22397    21646     -751     
- Misses       5761     5795      +34     
+ Partials     1115     1102      -13     

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

codecov[bot] avatar Jan 11 '24 09:01 codecov[bot]

Quality Gate Failed Quality Gate failed

Failed conditions

5.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 22 '24 03:01 sonarqubecloud[bot]

Quality Gate Failed Quality Gate failed

Failed conditions
29.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Apr 15 '24 06:04 sonarqubecloud[bot]