-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix IBC upgrade: manually tested #8187
Changes from all commits
0ff4d21
16465b6
6f7e0df
84280f4
247026a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,15 +89,15 @@ func (k Keeper) ScheduleUpgrade(ctx sdk.Context, plan types.Plan) error { | |
if err != nil { | ||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "could not unpack clientstate: %v", err) | ||
} | ||
// sets the new upgraded client in last height committed on this chain is at plan.Height - 1, | ||
// sets the new upgraded client in last height committed on this chain is at plan.Height, | ||
// since the chain will panic at plan.Height and new chain will resume at plan.Height | ||
return k.SetUpgradedClient(ctx, plan.Height-1, clientState) | ||
return k.SetUpgradedClient(ctx, plan.Height, clientState) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm.... this raises my eyebrows. was normal Because just swapping this height by one to fix an ibc test may break some other test. It would be good to test this with a non-ibc upgrade. Or maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this falls under the if condition There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The During testing, we realized the last committed height is actually block 100, not 99. Therefore we needed to set the client and consensus states at block 100. Block 101 was the first committed block after the upgrade There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The normal This is to fix the IBC relevant part of the code that was added to ensure that IBC light client would be able to successfully track upgrades using the A non-ibc upgrade would not set an upgraded client at all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @colin-axner we tested it with multiple validator devnet couple of times, only the proposer will commit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe this will help. Logs from our upgrade yesterday
Note some important details here.
This shows
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since my validator and @AdityaSripal's validator panic'd, it looks like we lost connection with each other, therefore preventing block 351 from being committed (which will contain the upgrade handler changes once the binaries are swapped) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here are some logs of me doing queries after the panic
Note that you can see the query for things like upgraded consensus state at height 349 (iavl version height) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And after switching binaries
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any part of the above logs that differ? |
||
} | ||
return nil | ||
} | ||
|
||
// SetUpgradedClient sets the expected upgraded client for the next version of this chain at the last height the current chain will commit. | ||
func (k Keeper) SetUpgradedClient(ctx sdk.Context, lastHeight int64, cs ibcexported.ClientState) error { | ||
func (k Keeper) SetUpgradedClient(ctx sdk.Context, planHeight int64, cs ibcexported.ClientState) error { | ||
store := ctx.KVStore(k.storeKey) | ||
|
||
// zero out any custom fields before setting | ||
|
@@ -107,7 +107,7 @@ func (k Keeper) SetUpgradedClient(ctx sdk.Context, lastHeight int64, cs ibcexpor | |
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "could not marshal clientstate: %v", err) | ||
} | ||
|
||
store.Set(types.UpgradedClientKey(lastHeight), bz) | ||
store.Set(types.UpgradedClientKey(planHeight), bz) | ||
return nil | ||
} | ||
|
||
|
@@ -129,14 +129,14 @@ func (k Keeper) GetUpgradedClient(ctx sdk.Context, height int64) (ibcexported.Cl | |
|
||
// SetUpgradedConsensusState set the expected upgraded consensus state for the next version of this chain | ||
// using the last height committed on this chain. | ||
func (k Keeper) SetUpgradedConsensusState(ctx sdk.Context, lastHeight int64, cs ibcexported.ConsensusState) error { | ||
func (k Keeper) SetUpgradedConsensusState(ctx sdk.Context, planHeight int64, cs ibcexported.ConsensusState) error { | ||
store := ctx.KVStore(k.storeKey) | ||
bz, err := clienttypes.MarshalConsensusState(k.cdc, cs) | ||
if err != nil { | ||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "could not marshal consensus state: %v", err) | ||
} | ||
|
||
store.Set(types.UpgradedConsStateKey(lastHeight), bz) | ||
store.Set(types.UpgradedConsStateKey(planHeight), bz) | ||
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.
This used to save consensus state at
plan.Height-1