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

feat: Import all SMT files into cosmos-sdk without any build errors #232

Closed
wants to merge 14 commits into from

Conversation

Manav-Aggarwal
Copy link
Member

@Manav-Aggarwal Manav-Aggarwal commented Jul 15, 2022

Description

Closes: #231

For Cevmos' Block Fraud Proofs we need to have a SMT based store. We want to try and backport the one from v0.46.x.

Follow up would be in ##111

Please use manav/backport_smt-add_files...vulcanize:cosmos-sdk:release-v0.46.0-smt-0.0.5-alpha for comparing this to the vulcanize implementation if useful for review


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)

@Manav-Aggarwal Manav-Aggarwal changed the title Manav/backport smt add files feat: Import all SMT files into cosmos-sdk without any build errors Jul 15, 2022
@Manav-Aggarwal Manav-Aggarwal linked an issue Jul 15, 2022 that may be closed by this pull request
@Manav-Aggarwal Manav-Aggarwal self-assigned this Jul 15, 2022
@Manav-Aggarwal Manav-Aggarwal added the block-fraud-proofs Block Fraud Proofs (Generation and verification) label Jul 15, 2022
@Manav-Aggarwal Manav-Aggarwal marked this pull request as ready for review July 15, 2022 21:39
@liamsi liamsi requested a review from adlerjohn July 17, 2022 13:30
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

It looks like the bulk changes here are from https://github.com/vulcanize/cosmos-sdk/releases/tag/v0.46.0-smt-0.0.5-alpha?

Can we instead cherry-pick changes and then resolve merge conflicts? Even if github does not give any real guarantees about the commits being the same it will help reviewing the PR a bit IMO.

@jbowen93
Copy link

It looks like the bulk changes here are from https://github.com/vulcanize/cosmos-sdk/releases/tag/v0.46.0-smt-0.0.5-alpha?

Can we instead cherry-pick changes and then resolve merge conflicts? Even if github does not give any real guarantees about the commits being the same it will help reviewing the PR a bit IMO.

Would you prefer cherry picking the commits from Vulkanize and then layering commits on top of that to resolve changes needed for v0.46 -> v0.45?

@Manav-Aggarwal Manav-Aggarwal force-pushed the manav/backport_smt-add_files branch 4 times, most recently from 68ab1f1 to 9aa377e Compare July 22, 2022 03:44
@Manav-Aggarwal Manav-Aggarwal added the C: Cevmos Changes related to the cevmos branches label Jul 22, 2022
@Manav-Aggarwal Manav-Aggarwal force-pushed the manav/backport_smt-add_files branch 3 times, most recently from e37f7c9 to a292da8 Compare July 22, 2022 09:19
@Manav-Aggarwal Manav-Aggarwal changed the title feat: Import all SMT files into cosmos-sdk without any build errors !feat: Import all SMT files into cosmos-sdk without any build errors Jul 22, 2022
@Manav-Aggarwal Manav-Aggarwal changed the title !feat: Import all SMT files into cosmos-sdk without any build errors feat: Import all SMT files into cosmos-sdk without any build errors Jul 22, 2022
@Manav-Aggarwal
Copy link
Member Author

Manav-Aggarwal commented Jul 22, 2022

Looks like there's a race condition in a test sometimes but unable to reproduce locally. Will move on to #111 and build on top of this for now. Please feel free to suggest any possible ways to resolve this.

Things tried: adding a sync.Mutex lock/unlock around write and GetKVStore in cache_store.go

@Manav-Aggarwal
Copy link
Member Author

@Manav-Aggarwal
Copy link
Member Author

It looks like the bulk changes here are from https://github.com/vulcanize/cosmos-sdk/releases/tag/v0.46.0-smt-0.0.5-alpha?

Can we instead cherry-pick changes and then resolve merge conflicts? Even if github does not give any real guarantees about the commits being the same it will help reviewing the PR a bit IMO.

Please correct me if I am wrong but wouldn't that mean looking at manav/backport_smt...vulcanize:cosmos-sdk:release-v0.46.0-smt-0.0.5-alpha and cherry-picking commits? It seems like there are 1k+ commits there which might not be worth the effort

Copy link
Member

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

Can you rebase manav/backport_smt against the latest default branch? As-is, this PR is useless since it's based on a stale Cosmos SDK release.

@Manav-Aggarwal Manav-Aggarwal force-pushed the manav/backport_smt-add_files branch 2 times, most recently from e648aa4 to cb35c3a Compare July 25, 2022 07:10
traceContext types.TraceContext
traceWriter io.Writer
traceContext types.TraceContext
traceContextMutex sync.RWMutex
Copy link
Member

Choose a reason for hiding this comment

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

should the mutex be a pointer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should that affect functionality in this case? I tried searching how mutexes are used in the cosmos-sdk currently and it seems like there are plenty of places where they are not pointers:
https://github.com/cosmos/cosmos-sdk/blob/2646b474c7beb0c93d4fafd395ef345f41afc251/snapshots/store.go#L30
https://github.com/cosmos/cosmos-sdk/blob/2646b474c7beb0c93d4fafd395ef345f41afc251/types/config.go#L21

Copy link
Member Author

Choose a reason for hiding this comment

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

Just rebased on top of 0.45.5 instead, and that seems to have fixed the issue. Thanks Evan! Appreciate your help :)

@Manav-Aggarwal
Copy link
Member Author

Can you rebase manav/backport_smt against the latest default branch? As-is, this PR is useless since it's based on a stale Cosmos SDK release.

Rebased to 0.45.5 which is what ethermint uses

@liamsi
Copy link
Member

liamsi commented Jul 31, 2022

What is the status of this PR? Ethermint now uses 0.46

@adlerjohn adlerjohn marked this pull request as draft July 31, 2022 12:43
@Manav-Aggarwal
Copy link
Member Author

What is the status of this PR? Ethermint now uses 0.46

good from my side, waiting on review

@liamsi
Copy link
Member

liamsi commented Aug 1, 2022

I don't really follow. I thought this backports code from 0.46 to an older version of the SDK? Why would that still be necessary when you'd be now using 0.46 directly? Are you sure this is good to go as is @Manav-Aggarwal?

@liamsi
Copy link
Member

liamsi commented Aug 1, 2022

Also, related to this:

Please correct me if I am wrong but wouldn't that mean looking at manav/backport_smt...vulcanize:cosmos-sdk:release-v0.46.0-smt-0.0.5-alpha and cherry-picking commits? It seems like there are 1k+ commits there which might not be worth the effort

You should compare the diff of their work from where they forked off and not against your branch in our fork. If you look at
cosmos/cosmos-sdk@main...vulcanize:cosmos-sdk:release-v0.46.0-smt-0.0.5-alpha you can see they are only 86 commits, and mostly related to the SMT stuff the vlucanize team has been working on only.

As a general note: I would not take the changes of others and commit them under a different account if avoidable (you lose the git history by that and it attributes code to the wrong account). There might be scenarios where this is unavoidable maybe. But git would allow different strategies here at least: merging one branch into another, or the aforementioned cherry-picking. another option is interactive rebase (with picking the relevant changes).

@Manav-Aggarwal
Copy link
Member Author

I don't really follow. I thought this backports code from 0.46 to an older version of the SDK? Why would that still be necessary when you'd be now using 0.46 directly? Are you sure this is good to go as is @Manav-Aggarwal?

Since cosmos-sdk v0.46 supports tendermint v0.34 now, this PR is not needed. We'll be closing this PR and prioritizing #245 directly in cosmos-sdk 0.46

@liamsi liamsi deleted the manav/backport_smt-add_files branch August 2, 2022 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block-fraud-proofs Block Fraud Proofs (Generation and verification) C: Cevmos Changes related to the cevmos branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import all SMT files into cosmos-sdk without any build errors
5 participants