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 zero-copy don't work with inter-block cache #1035

Merged
merged 4 commits into from
May 26, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented May 23, 2023

Solution:

  • ignore the inter-block cache silently
  • roll it's own cache in memiavl trees

👮🏻👮🏻👮🏻 !!!! 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! :)

CHANGELOG.md Outdated Show resolved Hide resolved
opts := rs.opts
opts.CreateIfMissing = true
opts.InitialStores = initialStores
opts.TargetVersion = uint32(version)

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
memiavl/db.go Fixed Show fixed Hide fixed
memiavl/db.go Fixed Show fixed Hide fixed
memiavl/db.go Fixed Show fixed Hide fixed
if version >= math.MaxUint32 {
panic("version overflows uint32")
}

return &Tree{
version: uint32(version),
version: uint32(version),

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
@@ -222,7 +225,7 @@
t.trees[i].name = upgrade.Name
default:
// add tree
tree := NewWithInitialVersion(uint32(nextVersion(t.Version(), t.initialVersion)))
tree := NewWithInitialVersion(uint32(nextVersion(t.Version(), t.initialVersion)), t.cacheSize)

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
Solution:
- ignore the inter-block cache silently
- roll it's own cache in memiavl trees

Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>
@yihuang yihuang marked this pull request as ready for review May 26, 2023 02:32
@yihuang yihuang requested a review from a team as a code owner May 26, 2023 02:32
@yihuang yihuang requested review from mmsqe and leejw51crypto and removed request for a team May 26, 2023 02:32
@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #1035 (972bdf9) into main (dfa887d) will decrease coverage by 0.25%.
The diff coverage is 76.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1035      +/-   ##
==========================================
- Coverage   46.55%   46.30%   -0.25%     
==========================================
  Files          82       82              
  Lines        7091     7112      +21     
==========================================
- Hits         3301     3293       -8     
- Misses       3443     3470      +27     
- Partials      347      349       +2     
Impacted Files Coverage Δ
app/memiavl.go 10.52% <0.00%> (-89.48%) ⬇️
versiondb/client/restore_app_db.go 0.00% <0.00%> (ø)
versiondb/client/verify.go 0.00% <0.00%> (ø)
memiavl/tree.go 77.84% <75.00%> (-2.02%) ⬇️
memiavl/db.go 58.10% <88.88%> (+2.31%) ⬆️
app/config/config.go 100.00% <100.00%> (ø)
memiavl/multitree.go 73.40% <100.00%> (+0.18%) ⬆️

... and 1 file with indirect coverage changes

@yihuang yihuang enabled auto-merge May 26, 2023 03:08
@yihuang yihuang added this pull request to the merge queue May 26, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 26, 2023
@yihuang yihuang added this pull request to the merge queue May 26, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 26, 2023
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.

2 participants