-
Notifications
You must be signed in to change notification settings - Fork 405
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
Abstract height type #447
Abstract height type #447
Conversation
``` | ||
|
||
```typescript | ||
enum Ord { |
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 we rename it to Cmp
instead? it's more widely used by various libraries in Go (eg big.Int)
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, I think Cmp should be a function from Height
func (h Height) Cmp(b Height): int {
if h.epochNumber < b.epochNumber {
return -1
} else if h.epochNumber == b.epochNumber {
if a.epochHeight < b.epochHeight {
return -1
} else if h.epochHeight == b.epochHeight {
return 0
}
}
return 1
}
something in those lines
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.
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.
Hmm, I'm not a huge fan of returning an int
since there are more valid values for int
than valid return values for this function. It's fine if we use Cmp
to implement this in the Cosmos SDK code, though.
Probably makes sense to add basic upgrade handling here as well. |
We'll have to fix a key & commitment prefix for upgrade handling. |
This is not yet ready to be merged, I need to check that the fields all match up to the ICS 7 implementation, but want to check that the upgrade method proposed here makes sense, cc @AdityaSripal. |
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.
My main concern is how we would know what the newClientState
should be in advance of the upgrade so we can store it in the old chain
newClientState: ClientState, | ||
height: Height, | ||
proof: CommitmentPrefix) { | ||
// check proof of updated client state in state at predetermined commitment prefix and key |
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.
How would we know what the updated client state is going to be before the upgrade, since we don't know the first header.
This could be fixed with the comment here: cosmos/cosmos-sdk#6736 (comment)
Tho we still wouldn't know something like LatestTimestamp uint64
beforehand
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.
See below comment.
The Tendermint ClientState contains things that we would only know after the upgrade happened |
Co-authored-by: Aditya <[email protected]>
Hmm, the problem here is that (this should be the genesis time of the new chain) I'll add an explanatory note about this. |
Just this one remaining question on client state - cosmos/cosmos-sdk#6736 (comment). |
Closes #439