-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Make clients use proto Height #7184
Changes from 5 commits
3ab74c0
2618b21
5c229ed
cc88998
249c00e
d6a7bec
e0e0f98
6010b97
99457df
226e655
c502700
1d43fbe
fed4491
5eefea7
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ syntax = "proto3"; | |
package ibc.localhost; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "ibc/client/client.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"; | ||
|
||
|
@@ -24,5 +25,8 @@ message ClientState { | |
(gogoproto.moretags) = "yaml:\"chain_id\"" | ||
]; | ||
// self latest block height | ||
uint64 height = 3; | ||
ibc.client.Height height = 3 [ | ||
(gogoproto.moretags) = "yaml:\"height\"", | ||
AdityaSripal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(gogoproto.nullable) = false | ||
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. does this need to be a pointer for proto? 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. Would this be a problem for proto encoding/decoding? Given the choice, i prefer it to not be a pointer since there's no reason to have a nil Height for |
||
]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,11 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) { | |
} | ||
|
||
// client id is always "localhost" | ||
clientState := localhosttypes.NewClientState(ctx.ChainID(), ctx.BlockHeight()) | ||
// Hardcode 0 as epoch number for now | ||
// TODO: Retrieve epoch from chain-id | ||
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. track issue? |
||
clientState := localhosttypes.NewClientState( | ||
ctx.ChainID(), types.NewHeight(0, uint64(ctx.BlockHeight())), | ||
) | ||
|
||
_, err := k.CreateClient(ctx, exported.ClientTypeLocalHost, clientState, nil) | ||
if err != 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.
why this option?
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 want to be able to define my own
String()
method on Height, especially since it will eventually go intohost.ConsensusStatePath