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

Change UpgradeTimeout to from absolute to relative #4441

Closed
3 tasks
chatton opened this issue Aug 23, 2023 · 1 comment
Closed
3 tasks

Change UpgradeTimeout to from absolute to relative #4441

chatton opened this issue Aug 23, 2023 · 1 comment
Assignees
Labels
04-channel channel-upgradability Channel upgradability feature

Comments

@chatton
Copy link
Contributor

chatton commented Aug 23, 2023

Summary

Change the default upgrade timeout from absolute to relative. see this comment

Having looked briefly into this, it might be able to look like this

// getUpgradeTimeout returns the absolute timeout for the given upgrade.
func (k Keeper) getUpgradeTimeout(ctx sdk.Context) types.Timeout {
	relativeTimeout := k.GetParams(ctx).UpgradeTimeout
	absoluteTimeoutHeight := clienttypes.NewHeight(clienttypes.ParseChainID(ctx.ChainID()), uint64(ctx.BlockHeight())+relativeTimeout.Height.RevisionHeight)
	absoluteTimeoutTimestamp := uint64(ctx.BlockTime().UnixNano()) + relativeTimeout.Timestamp
	return types.NewTimeout(absoluteTimeoutHeight, absoluteTimeoutTimestamp)
}

However tests are failing with timeout issues in the HasPassed method. This needs to be figured out.

	selfTime, timeoutTimestamp := uint64(ctx.BlockTime().UnixNano()), t.Timestamp
	if selfTime >= timeoutTimestamp && timeoutTimestamp > 0 {
		return true, errorsmod.Wrapf(ErrInvalidUpgrade, "block timestamp >= upgrade timeout timestamp (%s >= %s)", ctx.BlockTime(), time.Unix(0, int64(timeoutTimestamp)))
	}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@chatton
Copy link
Contributor Author

chatton commented Aug 28, 2023

We are now no longer using timeout height for upgrades. We should make the timeout timestamp relative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
04-channel channel-upgradability Channel upgradability feature
Projects
Archived in project
Development

No branches or pull requests

1 participant