Skip to content

feat: update store module for new iavl#15568

Merged
cool-develope merged 27 commits into
mainfrom
store/new_iavl
Jun 6, 2023
Merged

feat: update store module for new iavl#15568
cool-develope merged 27 commits into
mainfrom
store/new_iavl

Conversation

@cool-develope

Copy link
Copy Markdown
Contributor

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@cool-develope cool-develope requested a review from a team March 28, 2023 12:49
@cool-develope cool-develope marked this pull request as draft March 28, 2023 12:49
@ghost ghost requested review from a team, facundomedica and likhita-809 and removed request for a team March 28, 2023 12:50
@github-actions

This comment has been minimized.

@kocubinski kocubinski self-assigned this Mar 28, 2023
@cool-develope cool-develope marked this pull request as ready for review March 29, 2023 20:42
@ghost ghost self-requested a review March 29, 2023 20:42
Comment thread store/rootmulti/store_test.go Outdated
Comment thread store/iavl/store.go Outdated

@tac0turtle tac0turtle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

before merging this we need an issue on how to do migrations

@elias-orijtech elias-orijtech left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM apart from nits.

Comment thread store/pruning/manager.go
Comment thread store/rootmulti/store_test.go Outdated
@tac0turtle

Copy link
Copy Markdown
Contributor

build doesnt pass

@tac0turtle

tac0turtle commented Apr 17, 2023

Copy link
Copy Markdown
Contributor

waiting to merge this until we have migrations tested as this merge would signify the adoption of this in the Eden release

@odeke-em odeke-em left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for this change @cool-develope, I've added my first round of review, please take a look.

Comment thread store/pruning/manager.go Outdated
Comment thread store/pruning/manager.go Outdated
@tac0turtle tac0turtle added the S:blocked Status: Blocked label Apr 25, 2023
@github-actions github-actions Bot added C:CLI C:collections C:Confix C:Cosmovisor Issues and PR related to Cosmovisor C:Hubl Tool: Hubl C:Keys Keybase, KMS and HSMs labels Apr 26, 2023
Comment thread store/iavl/tree.go Outdated
LazyLoadVersionForOverwriting(targetVersion int64) (int64, error)
LoadVersionForOverwriting(targetVersion int64) error
TraverseStateChanges(startVersion, endVersion int64, fn func(version int64, changeSet *iavl.ChangeSet) error) error
SaveChangeSet(changeSet *iavl.ChangeSet) (int64, error)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we still need this api change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it can be useful when create the migrating tool of the archived node.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since users can get this api from iavl lets remove it for now

@julienrbrt julienrbrt Jun 3, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is still unimplemented.

Comment thread store/iavl/tree.go
Comment thread store/iavl/store.go
@cool-develope

Copy link
Copy Markdown
Contributor Author

@tac0turtle , we need new tag of iavl

@tac0turtle

Copy link
Copy Markdown
Contributor

this is unblocked and can use v1.0.0-beta.2 of iavl


// "restart"
ms = newMultiStoreWithMounts(db, pruningtypes.NewCustomPruningOptions(2, 11))
ms.SetSnapshotInterval(3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i think we should still keep this so we dont break pruning dependence on snapshot intervals

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for now, the snapshot interval doesn't affect the pruning strategy if we don't call HandleHeightSnapshot.

@tac0turtle tac0turtle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. Been running this on juno for a week now

@tac0turtle

Copy link
Copy Markdown
Contributor

lets resolve the conflicts then we can merge this

Comment thread baseapp/options.go
Comment thread store/CHANGELOG.md Outdated
- Remov `DeleteVersion`, `DeleteVersions`, `LazyLoadVersionForOverwriting` from `iavl` tree API.
- Add `DeleteVersionsTo` and `SaveChangeSet`, since it will keep versions sequentially like `fromVersion` to `toVersion`.
- Refactor the pruning manager to use `DeleteVersionsTo`.
- Remove `IAVLLazyLoading` option from baseapp.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one should be in the main changelog ./CHANGELOG.md instead of under store/CHANGELOG.md

Comment thread store/iavl/tree.go Outdated
LazyLoadVersionForOverwriting(targetVersion int64) (int64, error)
LoadVersionForOverwriting(targetVersion int64) error
TraverseStateChanges(startVersion, endVersion int64, fn func(version int64, changeSet *iavl.ChangeSet) error) error
SaveChangeSet(changeSet *iavl.ChangeSet) (int64, error)

@julienrbrt julienrbrt Jun 3, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is still unimplemented.

Comment thread store/pruning/manager.go
if err != nil {
return err
// Consider the snapshot height
pruneHeight := height - 1 - int64(m.opts.KeepRecent) // we should keep the current height at least

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if pruneHeight gets negative?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this will be checked in PruneStores when pruning in rootmulti

Comment thread store/go.mod Outdated
github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/iavl v0.21.0
github.com/cosmos/iavl v1.0.0-beta.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit, use v1.0.0-beta.2

@julienrbrt julienrbrt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

utACK, few nits

@alexanderbez

Copy link
Copy Markdown
Contributor

Let's get @julienrbrt's suggestions in and we can merge. The conflicts should be trivial to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants