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: Re-enabling gravity bridge conditionally #210

Merged

Conversation

thomas-nguy
Copy link
Collaborator

@thomas-nguy thomas-nguy commented Nov 12, 2021

We probably needs to add more test in case gravity is not enable

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

@thomas-nguy thomas-nguy requested a review from a team as a code owner November 12, 2021 08:35
@thomas-nguy thomas-nguy requested review from yihuang and devashishdxt and removed request for a team November 12, 2021 08:35
@thomas-nguy thomas-nguy changed the title Feat: Re-enabling gravity bridge conditionnally Feat: Re-enabling gravity bridge conditionally Nov 12, 2021
@codecov
Copy link

codecov bot commented Nov 12, 2021

Codecov Report

Merging #210 (59dab41) into main (3ea70c5) will increase coverage by 3.77%.
The diff coverage is 38.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #210      +/-   ##
==========================================
+ Coverage   21.51%   25.29%   +3.77%     
==========================================
  Files          27       34       +7     
  Lines        1729     2554     +825     
==========================================
+ Hits          372      646     +274     
- Misses       1324     1858     +534     
- Partials       33       50      +17     
Impacted Files Coverage Δ
app/prefix.go 0.00% <0.00%> (ø)
app/test_helpers.go 0.00% <0.00%> (ø)
x/cronos/keeper/gravity_hooks.go 0.00% <ø> (ø)
x/cronos/keeper/grpc_query.go 0.00% <ø> (ø)
x/cronos/keeper/ibc.go 83.20% <ø> (+5.01%) ⬆️
x/cronos/keeper/ibc_hooks.go 50.00% <ø> (-8.83%) ⬇️
x/cronos/keeper/keeper.go 64.89% <ø> (-29.45%) ⬇️
x/cronos/keeper/msg_server.go 4.76% <ø> (-1.69%) ⬇️
x/cronos/module.go 57.62% <ø> (-4.20%) ⬇️
x/cronos/proposal_handler.go 6.25% <ø> (ø)
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 087d3cd...59dab41. Read the comment docs.

@thomas-nguy thomas-nguy force-pushed the thomas/reenable-gravity-bridge branch 5 times, most recently from 0cdb96d to f87c9c2 Compare November 15, 2021 01:57
@thomas-nguy
Copy link
Collaborator Author

@tomtau should the ADR be updated as well?

@thomas-nguy thomas-nguy requested a review from tomtau November 15, 2021 02:00
@tomtau
Copy link
Contributor

tomtau commented Nov 15, 2021

@tomtau should the ADR be updated as well?

If there's a need for it, yes: the record doesn't say anything about conditional compilation: https://github.com/crypto-org-chain/cronos/blob/main/docs/architecture/adr-001.md#decision

The original draft had the conditional compilation, but from the discussion, it turned out that there was no need for it:

  • the current "mainnet beta" functionality can be forked into a "release/v0.6.x" branch and potential non-breaking changes from "main" can be cherry-picked in PRs onto it (e.g. switching to the next 0.7 Ethermint upstream release)
  • the latest/testnet development can just continue on main

@thomas-nguy
Copy link
Collaborator Author

thomas-nguy commented Nov 15, 2021

Per discussion, I thought that we wanted the conditional compilation because we still don't know when gravity will be mature enough to be used in production and there are chances that breaking changes will need to be ported to mainnet before that

If we want to avoid maintaining multiple fork or doing cherry picking, this would be the easiest solution?

@thomas-nguy thomas-nguy linked an issue Nov 15, 2021 that may be closed by this pull request
@tomtau
Copy link
Contributor

tomtau commented Nov 15, 2021

Per discussion, I thought that we wanted the conditional compilation because we still don't know when gravity will be mature enough to be used in production and there are chances that breaking changes will need to be ported to mainnet before that

If we want to avoid maintaining multiple fork or doing cherry picking, this would be the easiest solution?

There's a need to maintain a release branch for 0.6.x once "main" runs on the latest Ethermint and has /x/feemarket added. So a release branch is likely expected or unavoidable irrespective of GB.
If we anticipate GB isn't immediately added in a network upgrade altogether with other breaking changes on "main" and we need to keep up the latest development with it (e.g. for testnet binaries)... then yes, conditional feature-guarded compilation makes sense and this clarification should be updated to ADR-001.

@thomas-nguy thomas-nguy force-pushed the thomas/reenable-gravity-bridge branch from f87c9c2 to 0ea07e8 Compare November 15, 2021 08:58
@@ -3,6 +3,7 @@
## Changelog
* 12-10-2021: Initial Draft
* 13-10-2021: Code deletion instead of conditional compilation
* 13-10-2021: Conditional compilation
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* 13-10-2021: Conditional compilation
* 16-11-2021: Conditional compilation

@@ -23,7 +26,17 @@ In addition to that, the "x/cronos" module contains Gravity Bridge-related code

Existing integration tests related to Gravity Bridge can be temporarily disabled and later enabled when Gravity Bridge is added back.

Once the Gravity Bridge code is added back, the x/cronos module `ConsensusVersion` should be increased and the corresponding upgrade handler should be added.
Once the Gravity Bridge code is added back (after mainnet launch), the x/cronos module `ConsensusVersion` should be increased and the corresponding upgrade handler should be added.
Copy link
Contributor

Choose a reason for hiding this comment

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

should those (module version + upgrade handler) be conditionally added/changed as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we can avoid this for now.

We could keep the same consensus version for both binary (with and without gravity) and increase it when we decide to release gravity to mainnet (at that time, we can also remove the conditional compilation)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, then it's good to move or rephrase this sentence

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, changed

Copy link
Collaborator

@yihuang yihuang left a comment

Choose a reason for hiding this comment

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

But I guess the integration tests running in CI only target one of the modes, the other mode will not be tested.
For example if we pick the gravity-bridge mode to be the default one, the non-gravity-bridge mode won't be tested in CI, and could be silently broken.
Unless we run the tests against both modes, will that be overkill?

@thomas-nguy
Copy link
Collaborator Author

Yeah as I mentioned in the PR, we need to open another issue to improve the integration tests.
I guess the easiest way is to add another build + integration tests run in the CI for non gravity bridge binary?

What do you think?

@yihuang
Copy link
Collaborator

yihuang commented Nov 17, 2021

Yeah as I mentioned in the PR, we need to open another issue to improve the integration tests. I guess the easiest way is to add another build + integration tests run in the CI for non gravity bridge binary?

What do you think?

Do you think the two modes are temporary or permanent? my concern is it's not easy to keep both modes working correctly in the long run, and there could be more *_nogravity.go duplicated modules in the future when we add something only for one of the modes.

@thomas-nguy
Copy link
Collaborator Author

Do you think the two modes are temporary or permanent? my concern is it's not easy to keep both modes working correctly in the long run.

I guess once we decide to launch main net with gravity bridge, we don't need the conditional build anymore and can just stick with one version

@yihuang
Copy link
Collaborator

yihuang commented Nov 17, 2021

Do you think the two modes are temporary or permanent? my concern is it's not easy to keep both modes working correctly in the long run.

I guess once we decide to launch main net with gravity bridge, we don't need the conditional build anymore and can just stick with one version

Then I guess using branches should be good enough?

  • Before we decide to use the gravity bridge, we develop that in a feature branch.
  • After we decide to use the gravity bridge, we create a release branch for the non-gravity-bridge version, and merge the gravity bridge version to main branch

@thomas-nguy
Copy link
Collaborator Author

thomas-nguy commented Nov 17, 2021

Yeah this is possible but the conditional build is just to avoid us to jungle with two branches and cherry-pick back and forth for them to stay sync for a certain amount of time.

Also less risk to mess up during the upgrade?

But if we decide to go that way, I can remove the conditional build. What do you think @tomtau @calvinaco

@tomtau
Copy link
Contributor

tomtau commented Nov 17, 2021

if this repo follows TBD, then long-lived feature branches aren't desirable.
if there is a concern for not always building with the feature on, it can be a temporary runtime flag: https://trunkbaseddevelopment.com/feature-flags/ -- and selected E2E or integration tests can be re-executed with that flag on

@yihuang
Copy link
Collaborator

yihuang commented Nov 17, 2021

if this repo follows TBD, then long-lived feature branches aren't desirable.

It's temporary, it'll be merged to the main branch when we decide to use gravity-bridge in the next release.
and after that the non-gravity-bridge branch is only for bug fixes before the mainnet upgraded to gravity-bridge.

@tomtau
Copy link
Contributor

tomtau commented Nov 17, 2021

if temporary feature branch == a few days, then it's all right as TBD: https://trunkbaseddevelopment.com/youre-doing-it-wrong/#duration-of-short-lived-feature-branches

Otherwise, the contribution guidelines may need changes: https://github.com/crypto-org-chain/cronos/blob/main/CONTRIBUTING.md (which branch should one open a PR against if there are two parallel developments? who/when/what back ports changes from one to the other? how are releases made ? ...)

@yihuang
Copy link
Collaborator

yihuang commented Nov 17, 2021

if temporary feature branch == a few days, then it's all right as TBD: https://trunkbaseddevelopment.com/youre-doing-it-wrong/#duration-of-short-lived-feature-branches

Otherwise, the contribution guidelines may need changes: https://github.com/crypto-org-chain/cronos/blob/main/CONTRIBUTING.md (which branch should one open a PR against if there are two parallel developments? who/when/what back ports changes from one to the other? how are releases made ? ...)

I guess before we decide to use gravity bridge, there won't be heavy development on it anyway.
I think the blocker of that decision is to evaluate different gravity bridge forks, right? it seems good to do the evaluation on a feature branch rather than the main branch.

@thomas-nguy thomas-nguy force-pushed the thomas/reenable-gravity-bridge branch 5 times, most recently from f8eadb1 to eafeebe Compare November 22, 2021 05:21
@thomas-nguy thomas-nguy force-pushed the thomas/reenable-gravity-bridge branch 5 times, most recently from 151b8d5 to 18f9bbd Compare November 22, 2021 13:33
Copy link
Collaborator

@yihuang yihuang left a comment

Choose a reason for hiding this comment

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

LGTM

@thomas-nguy thomas-nguy force-pushed the thomas/reenable-gravity-bridge branch from 18f9bbd to 59dab41 Compare December 1, 2021 08:45
@thomas-nguy thomas-nguy merged commit c3a4283 into crypto-org-chain:main Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants