-
Notifications
You must be signed in to change notification settings - Fork 609
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: sdk v0.50.x upgrade #8274
Conversation
|
||
// Using branch osmo/v0.37.4 | ||
// UNFORKING v2 TODO: No longer use wasmd fork, added logic to app.toml override to use 1000 instead of default 100 cache size, which was the reason for having the fork in the first place. |
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.
.
go.mod
Outdated
// github.com/osmosis-labs/osmosis/osmoutils => ./osmoutils | ||
// github.com/osmosis-labs/osmosis/x/epochs => ./x/epochs | ||
// github.com/osmosis-labs/osmosis/x/ibc-hooks => ./x/ibc-hooks | ||
// UNFORKING v2 TOOD: Need to manually define these until we tag, it keeps trying to "upgrade" which actually downgrades us to the old sdk sub module logic |
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 just review if there are state-machine usages. If so, look at the scope of the modified methods |
I think we can continue using In any way, removing aliases is a state-compatible change which we can do at any time if it's ever needed |
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.
Great work on powering through this!
I'm far from being done but just wanted to leave some initial comments as to avoid a single large review cycles
app.SetStreamingManager( | ||
storetypes.StreamingManager{ | ||
ABCIListeners: []storetypes.ABCIListener{sqsStreamingService}, | ||
StopNodeOnErr: true, |
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.
Note: to self: would like to look into this more pre-merge
x/valset-pref/validator_set.go
Outdated
delegation, err := k.stakingKeeper.GetDelegation(ctx, delegator, val.ValAddr) | ||
if err != nil { | ||
return fmt.Errorf("No delegation found for delegator %s to validator %s\n", delegator, val.ValAddr) | ||
} |
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.
Is this logically equivalent to before?
From my understanding, the error can be returned in 2 cases:
- database error
- the key is actually not present.
Should we also format errors so that the clients can know why there is no delegation?
Alternatively, maybe we could bubble up the error without any custom message.
An ditto for most other calls of GetDelegation
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.
Yeah agreed with this, for simplicity I decided to just bubble up the error, because the sdk returns an error now instead of false if the value is nil (https://github.com/osmosis-labs/cosmos-sdk/blob/1a5662f2a4586735a64388386eaf23a62dfddad9/x/staking/keeper/delegation.go#L30-L32)
Previously we still returned the delegation even if the value was nil (https://github.com/cosmos/cosmos-sdk/blob/7009a2e0cdb93b286199bbaa22e8880aeec83c8c/x/staking/keeper/delegation.go#L15-L27)
Change here c780c73
@@ -175,48 +190,42 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } | |||
// If they have, we unmarshal the current consensus params, update the target gas, and cache the value. | |||
// This is done to improve performance by not having to fetch and unmarshal the consensus params on every block. | |||
// TODO: Move this to EIP-1559 code | |||
// UNFORKING v2 TODO: Do we still want to use cachedConsParams here? I guess it removes the need to do arithmetic operations on every block. |
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.
Makes sense for me to keep
initRootCmd(rootCmd, encodingConfig) | ||
initRootCmd(rootCmd, encodingConfig, tempApp) | ||
|
||
// UNFORKING v2 TODO: I don't think we have an option but to implement this. With out, the sdk queries do not show up in the CLI. |
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 would we not want to implement this? Is it because we already have osmocli that is customized and tailored to our needs?
Maybe I am not understanding, but don't we use it essentially everywhere in a stateful manner? Here is a random example: osmosis/x/tokenfactory/keeper/before_send.go Lines 121 to 122 in 7c213f8
|
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.
In this cycle, reviewed:
- pool manager
- protorev
- smart-account
- superfluid
- tokenfactory
- twap
- txfees
- valset-pref
There were some tests that I will aim to come back to reviewing in more detail after 1 full iteration.
@@ -70,9 +73,14 @@ func (decorator *SendBlockDecorator) CheckIfBlocked(msgs []sdk.Msg) error { | |||
return nil | |||
} | |||
for _, msg := range msgs { | |||
signers := msg.GetSigners() | |||
// UNFORKING v2 TODO: GetSigners is no longer available |
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.
Could we start tracking to do some specific testnet tests on this?
x/superfluid/keeper/stake.go
Outdated
if err != nil { | ||
panic(err) | ||
} |
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 that we should generally break APIs and bubble up any errors.
For example, this panic might lead to a chain halt because we do not have a panic-catching hook for begin block:
osmosis/x/superfluid/keeper/epoch.go
Line 60 in 62141e5
k.RefreshIntermediaryDelegationAmounts(ctx, accs) |
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.
Yes, good call, doing now
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.
[]int64{0}, | ||
[]int64{0}, | ||
[]int64{}, | ||
[]int64{}, // UNFORKING v2 TODO: We no longer can slash unbonded validators, verify that this is correct |
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.
Could you share more context on this?
Why did this change?
@@ -91,7 +100,10 @@ func (k Keeper) GetOrCreateIntermediaryAccount(ctx sdk.Context, denom, valAddr s | |||
// create a new account. We use base accounts, as this is what's done for cosmwasm smart contract accounts. | |||
// and in the off-chance someone manages to find a bug that forces the account's creation. | |||
if !k.ak.HasAccount(ctx, intermediaryAcct.GetAccAddress()) { | |||
k.ak.SetAccount(ctx, authtypes.NewBaseAccount(intermediaryAcct.GetAccAddress(), nil, 0, 0)) | |||
// UNFORKING v2 TODO: I now need to set NextAccountNumber with k.ak.NextAccountNumber(ctx) instead of using zero, due to new invariant checks. |
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'm not quite sure - why do we now need this and why it wasn't needed before. Could you please link the invariants mentioned?
@@ -142,3 +146,85 @@ func (s *KeeperTestSuite) TestTryUnbondingSuperfluidLockupDirectly() { | |||
}) | |||
} | |||
} | |||
|
|||
func (s *KeeperTestSuite) handleEquivocationEvidence(ctx context.Context, evidence *types.Equivocation) error { |
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.
Was this purely copied from the old method that was removed?
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.
Yes exactly, this is now a private method in the sdk, but its kind of silly given all the methods within it are public. So instead of straying further from the sdk, and because this is only used in tests, I added here manually.
@@ -68,7 +71,15 @@ func GetSignerAndSignatures(tx sdk.Tx) (signers []sdk.AccAddress, signatures []s | |||
} | |||
|
|||
// Retrieve messages from the transaction. | |||
signers = sigTx.GetSigners() | |||
// UNFORKING v2 TODO: I dont know if ranging over the address bytes and assigning to AccAddress is correct |
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 am not 100% sure of the internal details but this looks reasonable to me. I think that we can rely on the unit and integration tests for asserting correctness
|
||
return rawCWAddr, bech32CWAddr | ||
} | ||
// TESTS MOVED DIRECTLY TO x/cosmwasmpool/pool_module_test.go to prevent circular imports (specifically on osmosis app for the test suite) |
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.
Makes sense - shall we delete then?
// ensure only the right amount of sigs have been checked | ||
if tc.checks > 0 { | ||
s.Require().GreaterOrEqual(res.GasMeter().GasConsumed(), uint64(baseGas+(tc.checks-1)*approachingGasPerSig)) | ||
s.Require().LessOrEqual(res.GasMeter().GasConsumed(), uint64(baseGas+tc.checks*approachingGasPerSig)) | ||
} else { | ||
if tc.checkGas { | ||
s.Require().LessOrEqual(res.GasMeter().GasConsumed(), uint64(baseGas)) | ||
} | ||
} |
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.
Note to self: come back to this
I don't quite get why this is removed
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.
Actually this was likely removed by @nicolaslara when he corrected the remaining issues in the smart accounts module. He will likely be able to expand further on why this was safe (good call pointing it out though)
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 can look at this module by itself after the merge
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.
- lockup
- mint
- pool-incentives
only one comment
@@ -75,6 +75,7 @@ func (s *KeeperTestSuite) TestRepeatedLockTokensDistinctDurationGas() { | |||
|
|||
avgGas, maxGas := s.measureAvgAndMaxLockGas(totalNumLocks, defaultAddr, coinsFn, durFn) | |||
fmt.Printf("test deets: total locks created %d\n", totalNumLocks) | |||
s.Assert().LessOrEqual(int(avgGas), 100000, "average gas / lock") | |||
// UNFORKING v2 TODO: This increased from 100000 |
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 that's fine
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.
Reviewed all remaining modules. Skipped protos, tests, and simulation
Have remaining:
- osmoutils
- osmomath
- SQS integration
- app wiring
// v1.0.0-beta.3 is incompatible, so we use v1.0.0-beta.2 | ||
github.com/cosmos/cosmos-proto => github.com/cosmos/cosmos-proto v1.0.0-beta.2 | ||
// Using branch osmo/v0.38.x | ||
// https://github.com/osmosis-labs/cometbft/releases/tag/v0.37.4-v25-osmo-2 |
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.
nit is this tag relevant?
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.
It is not, will replace tags when getting closer to release time. I suppose I could also just make an rc0
func (s *sqsStreamingService) processBlockChangeSet() error { | ||
if s.changeSet == nil { | ||
return nil | ||
} | ||
|
||
for _, kv := range s.changeSet { | ||
for _, listener := range s.writeListeners[s.storeKeyMap[kv.StoreKey]] { | ||
if err := listener.OnWrite(s.storeKeyMap[kv.StoreKey], kv.Key, kv.Value, kv.Delete); err != nil { | ||
return err | ||
} | ||
} | ||
} | ||
|
||
return nil | ||
} |
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 wonder how this affects block time processing. We should create an issue and track validating that the performance hit is acceptable relative to the expected lowered block time
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.
Added this to the list of things to test
// github.com/osmosis-labs/osmosis/osmoutils => ../osmoutils | ||
) | ||
// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk/tree/osmo/v0.50.x, current branch: osmo/v0.50.x. Direct commit link: https://github.com/osmosis-labs/cosmos-sdk/commit/1a5662f2a4586735a64388386eaf23a62dfddad9 | ||
// https://github.com/osmosis-labs/cosmos-sdk/releases/tag/v0.47.5-v25-osmo-1 |
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.
nit: is the tag correct?
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.
It is not, am waiting closer to release to do the first tag, but can do it sooner if needed
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.
Great work here!
Review all module updates, protos, wiring and ran in-place-testnet
also read through and validated the UNFORKING TODOs
Created this doc to help with the UNFORKING comments:
https://www.notion.so/osmosiszone/Unforking-TODOs-9c17730015164849afc81e99ee8d1146
This reverts commit 5c8698b.
Merging, with the understanding we have to address all outstanding unforking v2 TODOs prior to release. Thanks all for the reviews! |
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've looked over the remaining files and don't have more to point out other than what's already been discussed or noted in unforking TODOs.
Great work @czarcas7ic
Closes: #XXX
What is the purpose of the change
References
SDK Upgrading Guide: https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md#v050x
DYDX Upgrade PRs:
Notes
Testing and Verifying
Keeping track here of TODOs that will likely transcend this PR:
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)