-
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
implement 09-localhost per specification #5769
Conversation
A great start @gregdhill! Can't wait to review when this is r4r! |
@gregdhill Let me know when this is ready, glad to review it. |
@jackzampolin @cwgoes I have rebased this work which should be ready to review. |
Codecov Report
@@ Coverage Diff @@
## master #5769 +/- ##
==========================================
+ Coverage 55.54% 55.67% +0.12%
==========================================
Files 420 426 +6
Lines 25293 25962 +669
==========================================
+ Hits 14049 14454 +405
- Misses 10275 10515 +240
- Partials 969 993 +24 |
@gregdhill ibc-alpha was merged to master 2 days ago. I'm sorry this has taken so long to review. Mind fixing the conflicts on last time? 🙏 |
712124e
to
f03e020
Compare
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.
Thanks @gregdhill for taking care of this. Some minor comments
x/ibc/09-localhost/client_state.go
Outdated
|
||
// GetLatestHeight returns zero. | ||
func (cs ClientState) GetLatestHeight() uint64 { | ||
return 0 |
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.
correct me if I'm wrong @cwgoes but I think this should return ctx.BlockHeight()
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, that's right.
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.
return 0 | |
return cs.ctx.BlockHeight() |
03b99fb
to
5b43c26
Compare
Thanks for reviewing @fedekunze! Please see my latest changes. |
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.
utACK. Minor suggestions. Thanks @gregdhill!
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.
Mostly LGTM, one change req'd, one question
x/ibc/09-localhost/client_state.go
Outdated
|
||
// GetLatestHeight returns zero. | ||
func (cs ClientState) GetLatestHeight() uint64 { | ||
return 0 |
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, that's right.
x/ibc/09-localhost/client_state.go
Outdated
|
||
// GetChainID returns an empty string | ||
func (cs ClientState) GetChainID() string { | ||
return "" |
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 don't know about this, maybe this should be ctx.ChainID()
? Maybe non-essential 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.
@cwgoes I think we need to add a ctx sdk.Context
to the ClientState
field.
// ClientState requires (read-only) access to keys outside the client prefix.
type ClientState struct {
ctx sdk.Context
store sdk.KVStore
}
@gregdhill can you add it and add this following function too?:
// WithContext updates the client state context to provide the chain ID and latest height
func (cs *ClientState) WithContext(ctx sdk.Context) {
cs.ctx = ctx
}
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.
return "" | |
return cs.ctx.ChainID() |
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.
Final comments @gregdhill and we're good to go. Thanks again!
x/ibc/09-localhost/client_state.go
Outdated
|
||
// GetChainID returns an empty string | ||
func (cs ClientState) GetChainID() string { | ||
return "" |
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.
@cwgoes I think we need to add a ctx sdk.Context
to the ClientState
field.
// ClientState requires (read-only) access to keys outside the client prefix.
type ClientState struct {
ctx sdk.Context
store sdk.KVStore
}
@gregdhill can you add it and add this following function too?:
// WithContext updates the client state context to provide the chain ID and latest height
func (cs *ClientState) WithContext(ctx sdk.Context) {
cs.ctx = ctx
}
x/ibc/09-localhost/client_state.go
Outdated
|
||
// GetChainID returns an empty string | ||
func (cs ClientState) GetChainID() string { | ||
return "" |
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.
return "" | |
return cs.ctx.ChainID() |
x/ibc/09-localhost/client_state.go
Outdated
|
||
// GetLatestHeight returns zero. | ||
func (cs ClientState) GetLatestHeight() uint64 { | ||
return 0 |
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.
return 0 | |
return cs.ctx.BlockHeight() |
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
Closes: #5543
Description
Mostly a stripped down copy of 07-tendermint, implementing 09-localhost.
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)