-
Notifications
You must be signed in to change notification settings - Fork 117
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
[CORE-538] Upgrade to Cosmos 0.50.1 and CometBFT 0.38 #867
Conversation
Important Auto Review SkippedMore than 25% of the files skipped due to max files limit. Skipping review to prevent low quality review. 214 files out of 296 files are above the max files limit of 75. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit's AI:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
657e07a
to
9c1980a
Compare
) | ||
|
||
// Verify all signatures for a tx and return an error if any are invalid. Note, | ||
// SigVerificationDecorator verifies all signatures for a tx and return an error if any are invalid. Note, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was updated with the copy from Cosmo 0.50 with the SkipSequenceValidation changes ported over.
@@ -21,6 +29,28 @@ import ( | |||
|
|||
func TestSigVerification(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was also copied over from Cosmos 0.50 with skip sequence validation tests ported over.
@@ -48,6 +48,8 @@ var ( | |||
"/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please double check that I grouped the new messages into the appropriate categories.
@@ -262,10 +261,22 @@ | |||
"threshold": "0.500000000000000000", | |||
"veto_threshold": "0.334000000000000000", | |||
"min_initial_deposit_ratio": "0.000000000000000000", | |||
"proposal_cancel_ratio": "0.500000000000000000", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check and decide on new parameters, specifically governance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should get product (Corey) and potentially research team involved if we are writing migration logic for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match the suggested staging/prod value, can you use the following?
"proposal_cancel_ratio": "0.500000000000000000", | |
"proposal_cancel_ratio": "1.0" | |
"proposal_cancel_dest": "", | |
"expedited_voting_period": "86400s", | |
"expedited_threshold": "0.75", | |
"expedited_min_deposit": [ | |
{ | |
"denom": "stake", | |
"amount": "50000000" | |
} | |
], | |
"burn_vote_quorum": false, | |
"burn_proposal_deposit_prevote": false, | |
"burn_vote_veto": true, | |
"min_deposit_ratio": "0.20" | |
}, | |
"constitution": "" | |
}, |
@@ -64,7 +64,6 @@ func initAppConfig() (string, *DydxAppConfig) { | |||
|
|||
// GRPC. | |||
appConfig.GRPC.Address = "0.0.0.0:9090" | |||
appConfig.GRPCWeb.Address = "0.0.0.0:9091" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now runs under GRPC address with Cosmos 0.50
@@ -84,7 +83,6 @@ func initTendermintConfig() *tmcfg.Config { | |||
cfg.RPC.CORSAllowedOrigins = []string{"*"} | |||
|
|||
// Mempool config. | |||
cfg.Mempool.Version = "v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mempool v1 is now gone, TTL changes were backported to v0
FeeGrantKeeper *antetestutil.MockFeegrantKeeper | ||
EncCfg moduletestutil.TestEncodingConfig | ||
} | ||
|
||
// SetupTest setups a new test, with new app, context, and AnteHandler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated from Cosmos 0.50 with v4 specific changes.
@@ -68,6 +68,16 @@ var ( | |||
Amount: 500_000_000, // $500 | |||
}, | |||
} | |||
Msg_Transfer_Invalid_SameSenderAndRecipient = &sendingtypes.MsgCreateTransfer{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidateBasic is now expected to not be implemented and users should be simulating their transactions before submitting them which is why I swapped to a message where we control the message type explicitly.
d0c76b8
to
89ebd37
Compare
// TODO(CORE-538): Is there a cleaner way to check to see if this is genesis? | ||
if ctx.BlockHeight() == 0 || ctx.BlockHeight() == 1 { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for my understanding - why do we need to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue that I ran into is for the first block is that there is no ProcessProposerMatches
events during PrepareCheckState
. Cosmos 0.47 didn't run PrepareCheckState
for the genesis block while Cosmos 0.50 does.
So I keep the original behavior by skipping PrepareCheckState
for the genesis block.
@@ -59,8 +59,10 @@ func DecodeOtherMsgsTx(decoder sdk.TxDecoder, txBytes []byte) (*OtherMsgsTx, err | |||
// Validate returns an error if one of the underlying msgs fails `ValidateBasic`. | |||
func (omt *OtherMsgsTx) Validate() error { | |||
for _, msg := range omt.msgs { | |||
if err := msg.ValidateBasic(); err != nil { | |||
return getValidateBasicError(msg, err) | |||
if m, ok := msg.(sdk.HasValidateBasic); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we NOT expect HasValidateBasic
to be the case?
Should we handle else case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of the Cosmos SDK messages have migrated away from using ValidateBasic
which I filed cosmos/cosmos-sdk#18750 about. Cosmos SDK wants users to simulate their transactions to validate them instead of relying on ValidateBasic
during CheckTx
which is a change in expected user behavior going forward.
This is one of the points I brought up that we want to discuss in slack since this has ramifications to user experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking comment: what's the conclusion of this discussion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conclusion was to simulate the transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, nit: would you be able to add a comment explaining this?
@@ -262,10 +261,22 @@ | |||
"threshold": "0.500000000000000000", | |||
"veto_threshold": "0.334000000000000000", | |||
"min_initial_deposit_ratio": "0.000000000000000000", | |||
"proposal_cancel_ratio": "0.500000000000000000", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should get product (Corey) and potentially research team involved if we are writing migration logic for this
@@ -98,9 +99,10 @@ func CreateUpgradeHandler( | |||
configurator module.Configurator, | |||
ak authkeeper.AccountKeeper, | |||
) upgradetypes.UpgradeHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as mentioned above, should we add the logic to init the new gov states? (i.e. expedited_voting_period
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also add a ticket in appropriate P0 project. I'm following up on the default values here
@@ -48,6 +48,8 @@ message MsgDepositToSubaccount { | |||
// MsgWithdrawFromSubaccount represents a single transfer from an | |||
// `x/subaccounts` subaccount to an `x/bank` account. | |||
message MsgWithdrawFromSubaccount { | |||
option (cosmos.msg.v1.signer) = "sender"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that we are specifying the sender should be sender.owner
in CustomGetSigner
here.
Should we remove this option, given that sender
is not a valid signer (i.e. it's not an address string)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cosmos SDK was meant to support these recursively but didn't do it quite right since sender
is supposed to go into that message and then use owner
to find the appropriate address string. I filed cosmos/cosmos-sdk#18722 and they have fixed this but it won't be available till a future Cosmos SDK release.
I'd like to leave this for now and once able we can remove the CustomGetSigners
implementation.
…t doesn't impact consensus parameters as per cosmos upgrade guide https://docs.cosmos.network/v0.50/build/migrations/upgrading#set-preblocker
e6c0d19
to
ab6e05a
Compare
protocol/app/app.go
Outdated
@@ -245,6 +248,7 @@ type App struct { | |||
ParamsKeeper paramskeeper.Keeper | |||
// IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly | |||
IBCKeeper *ibckeeper.Keeper | |||
ICAControllerKeeper icacontrollerkeeper.Keeper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding ICAControllerKeeper
, for my understanding? For supporting interchain accounts we specifically wanted to avoid the controllerkeeper (context).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ICAControllerKeeper is still disabled since Enabled
is false in the upgrade (note the Enabled
field is taking on the default value).
So instead of it being hard-coded disabled it is being disabled via parameters.
The simulation in IBC v8 expects that the controller module to exist otherwise the update params calls it generates fail with them being unroutable causing the sim tests to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of going with this approach, is it possible to simply exclude ICA module from simulation testing? Empirically, simulation testing is not very high signal for the dYdX chain, let alone a third-party module that is tested elsewhere.
We specifically preferred to explicitly disable (in code, instead of through gov-updatable params) the controller sub-module altogether to reduce surface of risk. This also eliminates the potential bugs in upgrade handler.
Simulation testing alone does not justify altering the original approach, IMO. Lmk if the above is possible and happy to huddle!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I swapped to exclude the interchainaccounts
module from simulation as suggested.
@@ -59,8 +59,10 @@ func DecodeOtherMsgsTx(decoder sdk.TxDecoder, txBytes []byte) (*OtherMsgsTx, err | |||
// Validate returns an error if one of the underlying msgs fails `ValidateBasic`. | |||
func (omt *OtherMsgsTx) Validate() error { | |||
for _, msg := range omt.msgs { | |||
if err := msg.ValidateBasic(); err != nil { | |||
return getValidateBasicError(msg, err) | |||
if m, ok := msg.(sdk.HasValidateBasic); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking comment: what's the conclusion of this discussion?
Co-authored-by: ttl33 <[email protected]>
@ttl33 I couldn't comment on some of your comments for some reason so I commented here.
We should be upgrading from the release branch with patches and backporting any fixes to it that need to be released immediately. There is no easy way to resolve this without implementing even more and this PR has been delayed due to RC0 and peoples vacation schedules so I want to get it in finally and not waste more time rebasing constantly.
To rely on simulating transactions since CheckTx only does some of the work to validate things.
I added a TODO to handle this once I figure out how to get the upgrades done. |
@@ -59,8 +59,10 @@ func DecodeOtherMsgsTx(decoder sdk.TxDecoder, txBytes []byte) (*OtherMsgsTx, err | |||
// Validate returns an error if one of the underlying msgs fails `ValidateBasic`. | |||
func (omt *OtherMsgsTx) Validate() error { | |||
for _, msg := range omt.msgs { | |||
if err := msg.ValidateBasic(); err != nil { | |||
return getValidateBasicError(msg, err) | |||
if m, ok := msg.(sdk.HasValidateBasic); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, nit: would you be able to add a comment explaining this?
@@ -262,10 +261,22 @@ | |||
"threshold": "0.500000000000000000", | |||
"veto_threshold": "0.334000000000000000", | |||
"min_initial_deposit_ratio": "0.000000000000000000", | |||
"proposal_cancel_ratio": "0.500000000000000000", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match the suggested staging/prod value, can you use the following?
"proposal_cancel_ratio": "0.500000000000000000", | |
"proposal_cancel_ratio": "1.0" | |
"proposal_cancel_dest": "", | |
"expedited_voting_period": "86400s", | |
"expedited_threshold": "0.75", | |
"expedited_min_deposit": [ | |
{ | |
"denom": "stake", | |
"amount": "50000000" | |
} | |
], | |
"burn_vote_quorum": false, | |
"burn_proposal_deposit_prevote": false, | |
"burn_vote_veto": true, | |
"min_deposit_ratio": "0.20" | |
}, | |
"constitution": "" | |
}, |
Changelist
Update to Cosmos 0.50.1 and CometBFT 0.38
Test Plan
Updated existing tests, some tests have been skipped or partially disabled with TODO tags added.
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.