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

Add snapshotter extension #4723

Merged
merged 32 commits into from
Nov 1, 2023
Merged

Conversation

trinitys7
Copy link
Contributor

Description

This PR is to add the snapshotter extension to sync wasm directory :

  • Move default wasm directory from runtime dictionary into chain home folder, ibc_08-wasm_client_data will be subfolder of ~/.simapp
  • Add IteratorCode function to iterate wasmcode that saved in chain state.
  • Testing: setup testing app with snapshot extension enable.

closes: #4275


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@trinitys7
Copy link
Contributor Author

hi @damiannolan, now this PR allows edit from maintainers.

@alpe
Copy link
Contributor

alpe commented Sep 22, 2023

This code looks familiar ;-)

testing/simapp/app.go Outdated Show resolved Hide resolved
@DimitrisJim
Copy link
Contributor

full review pending on merge of #4292

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Reviewed everything except the iterate code. Thanks @trinitys7 for getting this work started and @DimitrisJim for pushing it along 🙏

modules/light-clients/08-wasm/keeper/snapshotter.go Outdated Show resolved Hide resolved
modules/light-clients/08-wasm/keeper/snapshotter.go Outdated Show resolved Hide resolved
modules/light-clients/08-wasm/keeper/snapshotter.go Outdated Show resolved Hide resolved
},

{
name: "multiple contract",
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate contract test case? Or are we assuming a node would never be provided such a snapshot?

Copy link
Member

@damiannolan damiannolan Oct 31, 2023

Choose a reason for hiding this comment

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

duplicate contract test would fail with the current test structure on the initial store code call in 08-wasm here: https://github.com/cosmos/ibc-go/blob/feat/wasm-clients/modules/light-clients/08-wasm/keeper/keeper.go#L103-L105

We might be able to work around it tho.

But that being said, all calls to the vm StoreCode are idempotent so it should just behave as if its a no-op if its ever reached. I think it would be quite hard for a node to obtain a snapshot with duplicate contracts, impossible even?

@damiannolan damiannolan self-assigned this Oct 31, 2023
@damiannolan
Copy link
Member

Hey @trinitys7, apologies that this PR has been waiting in the wings so long! Finally we can pick up the remaining work on this. I will resolve the conflicts and can contribute some commits to pushing this forward. Thank you for getting this started ❤️

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Amazing work! Everything looks great to me, only comment would be to add an assertion that the dest wasm app has no contracts before the snapshots are restored

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Dropping my approval on this now, I think its looking pretty good. I'd like to try to improve the tests in future but I think this is good to move forward with for now.

Thank you for collaboration on this PR @trinitys7 @DimitrisJim, and @colin-axner for reviews ❤️ ❤️ ❤️

@DimitrisJim DimitrisJim merged commit fe602e0 into cosmos:feat/wasm-clients Nov 1, 2023
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants