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

Upgrade to cosmos sdk v0.46.0-rc1, against main #1443

Closed
wants to merge 40 commits into from

Conversation

faddat
Copy link
Contributor

@faddat faddat commented May 26, 2022

Description

This is a version of #1413 that changes only 69 files, by targeting main. Along the way to making this, I frequently merged in upstream changes like:

git merge upstream/main because that way the scope of the review is limited, and it is more usable. If it didn't reflect changes in the main branch, it really wouldn't be highly suited to use, for example on the cosmos hub.

  • I reduced by a few more files by checking out the main branch's ci folder.
    git checkout upstream/main -- .github
  • I added a few more files by fully removing RegisterRESTRoutes

There are two routes to merging this, one is outlined here, and one is in these PR's, which will give the same result, if they are merged into @crodriguezvega's branch in the following sequence.

#1439 - fumpts @crodriguezvega's v0.46 branch so it will more closely match #1412, reducing the scope of a review.
#1412 - bring @crodriguezvega's v0.46 branch current with main, save for changes made in the past day or two.
#1413 - identical to this PR. The other two above are to make reviewing this one easier.

In both cases, this unblocks work across cosmos using cosmos sdk v0.46.0-rc1.


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.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

dependabot bot and others added 29 commits February 10, 2022 03:04
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.5 to 2.2.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v2.1.5...v2.2.0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…ctions/setup-go-2.2.0

build(deps): bump actions/setup-go from 2.1.5 to 2.2.0
* deps: upgrade of SDK to 0.46 and tendermint to 0.35

* some changes from review comments

* some review comments

* refactor: simplify IBC redundant relay check in given restructure of SDK v0.46 (cosmos#1288)

* refactor: simplify ibc redundancy check used as sdk middleware

Instead of having the function checkRedundancy check if the call is on CheckTx or SimulateTx, only call the function on CheckTx or SimulateTx

* add godoc

* more review comments.

* another review comment

* remove tests since legacy REST endpoints have been removed in SDK 0.46

* chore: update sdk to v0.46.0-beta2

* refactor: ics27 indicator tests of deterministic error codes and message responses (cosmos#1349)

* begin refactoring ack_test

* fix test due to delayed block execution

* refactor: switch ics27 response creation to use new SDK version, update tests

* fix import

* review comment

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* review comment.

* pass nil context

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* review comment

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* remove unused import

* remove unused import

* fix for race condition in tests

* remove replace directive to make it build in pre-monterrey mac OS X

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com>
@faddat faddat requested a review from AdityaSripal as a code owner May 26, 2022 14:12
@codecov-commenter
Copy link

codecov-commenter commented May 26, 2022

Codecov Report

Merging #1443 (6fc548f) into main (b9a9502) will decrease coverage by 0.34%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1443      +/-   ##
==========================================
- Coverage   80.36%   80.02%   -0.35%     
==========================================
  Files         166      165       -1     
  Lines       12105    12064      -41     
==========================================
- Hits         9728     9654      -74     
- Misses       1920     1952      +32     
- Partials      457      458       +1     
Impacted Files Coverage Δ
...27-interchain-accounts/controller/keeper/keeper.go 94.73% <ø> (ø)
.../apps/27-interchain-accounts/host/keeper/keeper.go 83.33% <ø> (ø)
modules/apps/27-interchain-accounts/module.go 58.44% <ø> (+0.74%) ⬆️
modules/apps/29-fee/keeper/keeper.go 92.39% <ø> (ø)
modules/apps/29-fee/module.go 56.60% <ø> (+1.04%) ⬆️
modules/apps/transfer/keeper/keeper.go 94.11% <ø> (ø)
modules/apps/transfer/module.go 59.64% <ø> (+1.02%) ⬆️
modules/core/02-client/proposal_handler.go 77.77% <ø> (ø)
modules/core/02-client/types/codec.go 77.77% <ø> (ø)
modules/core/02-client/types/proposal.go 86.48% <ø> (ø)
... and 14 more

@@ -63,7 +63,7 @@ func TestAddGenesisAccountCmd(t *testing.T) {
require.NoError(t, err)

serverCtx := server.NewContext(viper.New(), cfg, logger)
clientCtx := client.Context{}.WithJSONCodec(appCodec).WithHomeDir(home)
clientCtx := client.Context{}.WithCodec(appCodec).WithHomeDir(home)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this consistently because the WithJSONCodec is deprecated.

@@ -25,13 +26,15 @@ func TestRandomizedGenState(t *testing.T) {
s := rand.NewSource(1)
r := rand.New(s)

initialStake := math.NewInt(1000)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was done because of the new cosmos sdk math library

@@ -5,7 +5,7 @@ import (

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a teeny bit hacky:

The proper way could be to fully refactor all use of governance, but it is my belief that this works.

@@ -367,7 +367,7 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenConfirm() {

// use chainA (controller) for ChanOpenConfirm
msg := channeltypes.NewMsgChannelOpenConfirm(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, proofAck, proofHeight, icatypes.ModuleName)
handler := suite.chainA.GetSimApp().MsgServiceRouter().Handler(msg)
handler := suite.chainA.GetSimApp().BaseApp.MsgServiceRouter().Handler(msg)
Copy link
Contributor Author

@faddat faddat May 26, 2022

Choose a reason for hiding this comment

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

Post-sdk-middleware changes + unchanges, this seems to be the correct way to summon the MsgServiceRouter.

@@ -4,8 +4,9 @@ import (
"fmt"
"strings"

baseapp "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/baseapp"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

didn't name baseapp import, because it's already named baseapp by default.

differentResponses := tmprotostate.ABCIResponses{
DeliverTxs: []*abcitypes.ResponseDeliverTx{
&differentDeliverTx,
// The safety of including ABCI error codes in the acknowledgement rests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am concerned that I have complicated this test versus what is in main.

@@ -130,7 +150,7 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenInit() {

// use chainB (host) for ChanOpenInit
msg := channeltypes.NewMsgChannelOpenInit(path.EndpointB.ChannelConfig.PortID, icatypes.Version, channeltypes.ORDERED, []string{path.EndpointB.ConnectionID}, path.EndpointA.ChannelConfig.PortID, icatypes.ModuleName)
handler := suite.chainB.GetSimApp().MsgServiceRouter().Handler(msg)
handler := suite.chainB.GetSimApp().MsgServiceRouter.Handler(msg)
_, err := handler(suite.chainB.GetContext(), msg)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This differs from one of my earlier tests and looks cleaner. I will try and modify.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@faddat faddat changed the title Sdk master Upgrade to cosmos sdk v0.46.0-rc1, against main May 26, 2022
NumValidators: 4,
BondDenom: sdk.DefaultBondDenom,
MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom),
AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction),
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),
PruningStrategy: storetypes.PruningOptionNothing,
PruningStrategy: "nothing",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this wanted a string, so I gave it a string.

@@ -126,134 +130,12 @@ func (s *IntegrationTestSuite) TearDownSuite() {
s.network.Cleanup()
}

// TestLegacyRestErrMessages creates two IBC txs, one that fails, one that
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can remove this because we no longer need to accommodate legacy rest

// - succeed using gRPC
// In practice, we call this function on IBC txs.
func (s *IntegrationTestSuite) testQueryIBCTx(txRes sdk.TxResponse, cmd *cobra.Command, args []string) {
val := s.network.Validators[0]

errMsg := "this transaction cannot be displayed via legacy REST endpoints, because it does not support" +
Copy link
Contributor Author

@faddat faddat May 26, 2022

Choose a reason for hiding this comment

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

Same with this, there's no longer a need to support legacy rest.


// initTendermintConfig helps to override default Tendermint Config values.
// return tmcfg.DefaultConfig if no custom configuration is required for the application.
func initTendermintConfig() *tmcfg.Config {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this wasn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was

s.Require().NoError(err)

acc2pubkey, err := account2.GetPubKey()
s.Require().NoError(err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added these because the getpubkey() method now returns error

@crodriguezvega
Copy link
Contributor

crodriguezvega commented May 26, 2022

Hi @faddat. Thanks a lot for opening all these PRs!

I wanted to give you an overview of our planning and timelines to work on the upgrade to SDK 0.46 and its release.

We are in the final stages of fee middleware (ICS-29) and we have decided to release this feature first as ibc-go v.4.0.0 with SDK 0.45. After several discussions we have been recommended to make a release of fee middleware that is compatible with SDK 0.45.x. Therefore the official release of ibc-go with SDK 0.46 will come afterwards (most likely as v5.0.0). In the meantime we will work on the upgrade in this branch and if we haven't cut v5.0.0 by the time Cosmos Hub is going to release rho, then we have agreed with the Cosmos Hub team that they will use the upgrade branch. It's a bit hacky, but it's the only solution we found to be able to satisfy all parties. For that reason, for now we don't want to bring all changes from main into the upgrade branch, because we want to keep it strictly with only the changes required for the upgrade to 0.46, nothing else. Once we cut v4.0.0, then we can start thinking about bringing main to the upgrade branch in preparation for v5.0.0, but for now maybe we should just hold our horses a bit. :)

I expect that we cut v4.0.0 next month, so if we continue doing work on the upgrade to SDK 0.46 in parallel in the meantime, then v5.0.0 could follow soon after. Next week we are going to open a new PR to upgrade this branch to 0.46-rc1. And you PRs we will again be extremely useful.

I hope this sheds a bit of light about our plans and I hope that you don't mind if, after reviewing your PRs, we end up deciding closing some if we think that's the best approach for our workflow and timeline. Again, thanks a lot for your work; it is very much appreciated.

@faddat
Copy link
Contributor Author

faddat commented May 26, 2022

Thanks IBC-go team.

@jackzampolin jackzampolin mentioned this pull request May 30, 2022
9 tasks
@faddat
Copy link
Contributor Author

faddat commented Jul 5, 2022

closing because tm 35 -> 34

@faddat faddat closed this Jul 5, 2022
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.

4 participants