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

api: enhance missing node error log at stateAtBlock #2103

Merged
merged 1 commit into from Jan 31, 2024

Conversation

yoomee1313
Copy link
Contributor

@yoomee1313 yoomee1313 commented Jan 31, 2024

Proposed changes

  • historical state unavailable error is returned by trace apis when tracing is not possible due to the state missing. Here, state refers to information like balance. State can be stored for each block. During tracing, the required state can be regenerated from the closest saved state. The reexec value in the tracing config specifies the maximum range to look up.
  • There's two cases when state is missing. First, whole states could be deleted due to state migration or state pruning. Second, the global state saving interval in the database, determined by the block-interval flag, is not the default value of 128.
  • This PR enhance the missing node error log in trace api for clarity and reduced ambiguity.

dev

> debug.traceBlockByNumber(5000, {reexec:128})
Error: required historical state unavailable (reexec=128)
        at web3.js:6810:9(39)
        at send (web3.js:5221:62(29))
        at <eval>:1:25(6)

PR

> debug.traceBlockByNumber(5000, {reexec:128})
Error: historical state unavailable. tried regeneration but not possible, possibly due to state migration/pruning or global state saving interval is bigger than reexec value (reexec=128)
        at web3.js:6810:9(39)
        at send (web3.js:5221:62(29))
        at <eval>:1:25(6)

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@blukat29 blukat29 merged commit c4e3de2 into klaytn:dev Jan 31, 2024
11 checks passed
@yoomee1313 yoomee1313 deleted the enhance-error-log branch April 8, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants