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

Problem: memiavl api don't work with FinalizeBlock #1149

Merged
merged 9 commits into from
Sep 1, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Aug 31, 2023

FinalizeBlock in abci 2.0 need the WorkingHash API.

Solution:

  • redesign the internals APIs to support WorkingHash. instead of exposing a single Commit API, now we exposes separate APIs for ApplyChangeSets and Commit.

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

store/rootmulti/store.go Fixed Show fixed Hide fixed
FinalizeBlock in abci 2.0 need the WorkingHash API.

Solution:
- redesign the internals APIs to support WorkingHash.
  instead of exposing a single `Commit` API, now we exposes separate APIs for `ApplyChangeSets` and `Commit`.
@yihuang yihuang marked this pull request as ready for review August 31, 2023 09:12
@yihuang yihuang requested a review from a team as a code owner August 31, 2023 09:12
@yihuang yihuang requested review from mmsqe and devashishdxt and removed request for a team August 31, 2023 09:12
Comment on lines +109 to +113
for _, store := range rs.stores {
if store.GetStoreType() != types.StoreTypeIAVL {
_ = store.Commit()
}
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

the value in the range statement should be _ unless copying a map: want: for key := range m
Comment on lines +109 to +113
for _, store := range rs.stores {
if store.GetStoreType() != types.StoreTypeIAVL {
_ = store.Commit()
}
}

Check warning

Code scanning / CodeQL

Iteration over map

Iteration over map may be a possible source of non-determinism
@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #1149 (c076680) into main (a31b865) will increase coverage by 0.11%.
The diff coverage is 66.66%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1149      +/-   ##
==========================================
+ Coverage   46.43%   46.54%   +0.11%     
==========================================
  Files         105      105              
  Lines        7859     7923      +64     
==========================================
+ Hits         3649     3688      +39     
- Misses       3837     3856      +19     
- Partials      373      379       +6     
Files Changed Coverage Δ
versiondb/client/verify.go 0.00% <0.00%> (ø)
memiavl/db.go 59.87% <63.76%> (+<0.01%) ⬆️
memiavl/multitree.go 71.89% <65.78%> (-0.14%) ⬇️
memiavl/tree.go 78.12% <100.00%> (-0.28%) ⬇️

memiavl/db.go Show resolved Hide resolved
memiavl/tree.go Show resolved Hide resolved
memiavl/db.go Show resolved Hide resolved
memiavl/db.go Show resolved Hide resolved
store/rootmulti/store.go Show resolved Hide resolved
Copy link

@yzang2019 yzang2019 left a comment

Choose a reason for hiding this comment

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

Confirmed this solve the problem

@yihuang yihuang enabled auto-merge September 1, 2023 01:56
@yihuang yihuang added this pull request to the merge queue Sep 1, 2023
@yihuang yihuang removed this pull request from the merge queue due to a manual request Sep 1, 2023
@yihuang yihuang added this pull request to the merge queue Sep 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 1, 2023
@yihuang yihuang added this pull request to the merge queue Sep 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Sep 1, 2023
@yihuang yihuang enabled auto-merge September 1, 2023 11:10
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.

3 participants