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] readState support to non-rolldpos mode #4247

Merged
merged 4 commits into from
May 7, 2024

Conversation

envestcc
Copy link
Member

Description

STANDALONE and NOOP is easy to use than ROLLDPOS in writing e2etest, and readState is used to checking things in testing. But it's only supported in ROLLDPOS.

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Code refactor or improvement

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

  • [] 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

inputEpochNum := rp.GetEpochNum(inputHeight)
if inputEpochNum < tipEpochNum {
rp := rolldpos.FindProtocol(core.registry)
if rp != nil {
Copy link
Member

Choose a reason for hiding this comment

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

what if rp == nil, still cannot read?

Copy link
Member Author

Choose a reason for hiding this comment

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

it will go to L949 / L957 to read

rp := rolldpos.FindProtocol(core.registry)
if rp != nil {
tipEpochNum := rp.GetEpochNum(tipHeight)
if height != "" {
Copy link
Member

Choose a reason for hiding this comment

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

no need, L932 already checked

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed

tipEpochNum := rp.GetEpochNum(tipHeight)
inputEpochNum := rp.GetEpochNum(inputHeight)
if inputEpochNum < tipEpochNum {
inputHeight = rp.GetEpochHeight(inputEpochNum)
Copy link
Member

Choose a reason for hiding this comment

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

can't understand why the height of state is changed in rp, but the changes are acceptable for me compared to the prev

Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

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

Project coverage is 76.97%. Comparing base (cc526cd) to head (33382b8).
Report is 5 commits behind head on master.

Files Patch % Lines
api/coreservice.go 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4247      +/-   ##
==========================================
- Coverage   77.02%   76.97%   -0.05%     
==========================================
  Files         342      343       +1     
  Lines       29406    29438      +32     
==========================================
+ Hits        22651    22661      +10     
- Misses       5650     5670      +20     
- Partials     1105     1107       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@envestcc envestcc merged commit a4ba831 into iotexproject:master May 7, 2024
2 of 5 checks passed
@envestcc envestcc deleted the pr-readstate branch May 7, 2024 02:23
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.

4 participants