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 can't be used with different cosmos-sdk versions #1154

Merged
merged 15 commits into from
Sep 11, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Sep 6, 2023

Closes: #1152

Solution:

  • remove memiavl's dependency on cosmos-sdk, only the store package depends on sdk version

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

@yihuang yihuang requested a review from a team as a code owner September 6, 2023 10:47
@yihuang yihuang requested review from mmsqe and JayT106 and removed request for a team September 6, 2023 10:47
Closes: #1152

Solution:
- remove memiavl's dependency on cosmos-sdk, only the store package depends on sdk version
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: yihuang <huang@crypto.com>
return &MultiTreeImporter{
dir: dir,
height: int64(height),
snapshotDir: snapshotName(int64(height)),

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
}
return &MultiTreeImporter{
dir: dir,
height: int64(height),

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
}
mtree, err = LoadMultiTree(filepath.Join(db.dir, snapshotName(int64(version))), true, 0)
mtree, err = LoadMultiTree(filepath.Join(dir, snapshotName(int64(version))), true, 0)

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
if height > math.MaxUint32 {
return fmt.Errorf("height overflows uint32: %d", height)
}
version := uint32(height)

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
node := &memiavl.ExportNode{
Key: item.IAVL.Key,
Value: item.IAVL.Value,
Height: int8(item.IAVL.Height),

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Merging #1154 (daeb499) into main (32e01be) will decrease coverage by 0.02%.
The diff coverage is 63.63%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1154      +/-   ##
==========================================
- Coverage   46.62%   46.60%   -0.02%     
==========================================
  Files         104      105       +1     
  Lines        7900     7884      -16     
==========================================
- Hits         3683     3674       -9     
  Misses       3843     3843              
+ Partials      374      367       -7     
Files Changed Coverage Δ
versiondb/client/verify.go 0.00% <0.00%> (ø)
memiavl/types.go 50.00% <50.00%> (ø)
memiavl/db.go 59.19% <64.00%> (-0.69%) ⬇️
memiavl/multitree.go 71.33% <66.66%> (-0.57%) ⬇️
memiavl/import.go 70.55% <68.42%> (+5.90%) ⬆️
memiavl/export.go 66.66% <74.07%> (+8.23%) ⬆️
memiavl/snapshot.go 55.86% <75.00%> (ø)
memiavl/iterator.go 79.71% <100.00%> (ø)
memiavl/tree.go 78.12% <100.00%> (ø)

memiavl/import.go Outdated Show resolved Hide resolved
yihuang and others added 2 commits September 7, 2023 08:53
Co-authored-by: mmsqe <mavis@crypto.com>
Signed-off-by: yihuang <huang@crypto.com>
@yihuang yihuang enabled auto-merge September 7, 2023 01:20
@yihuang yihuang disabled auto-merge September 7, 2023 05:32
@yihuang yihuang enabled auto-merge September 7, 2023 10:14
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.

Problem: memiavl can't be used by chains using different cosmos-sdk
3 participants