-
Notifications
You must be signed in to change notification settings - Fork 84
feat(rpc): new endpoint for block validation status #1129
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
Conversation
rpc/client/client.go
Outdated
@@ -817,6 +821,24 @@ func (c *Client) CheckTx(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultChec | |||
return &ctypes.ResultCheckTx{ResponseCheckTx: *res}, nil | |||
} | |||
|
|||
// BlockValidated returns the settlement validation status for a specific height: 0: Not validated, 1: Validated from P2P, 2: Validated from settlement, -1: node is still syncing. |
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.
should probably an enum vs hardcoded
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.
done
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'm not exactly sure in what context this is used, but might it be desirable for the caller to also pass the header hash to check that the block the caller refers to is the same one the node is referring to?
To stop the caller and the callee confusing two different blocks with the same height
Basically the caller wants to know he has the same block the verifier has? or not?
rpc/client/client.go
Outdated
@@ -53,6 +61,10 @@ type Client struct { | |||
genChunks []string | |||
} | |||
|
|||
type ResultBlockValidated struct { | |||
Result 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.
why not use the custom type here?
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.
done
that is a good point but i dont think that the software that requires this rpc has the block itself with the hash, just the height. |
@@ -817,6 +829,24 @@ func (c *Client) CheckTx(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultChec | |||
return &ctypes.ResultCheckTx{ResponseCheckTx: *res}, nil | |||
} | |||
|
|||
// BlockValidated returns the settlement validation status for a specific height: 0: Not validated, 1: Validated from P2P, 2: Validated from settlement, -1: node is still syncing. | |||
func (c *Client) BlockValidated(ctx context.Context, height *int64) (*ResultBlockValidated, error) { |
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 is height a pointer?
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 think its the common way used in all endpoints. it can be useful to check if height its set in the input params.
d845738
to
b40009f
Compare
651e920
to
5552b77
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## srene/1109-state-update-validation #1129 +/- ##
=====================================================================
Coverage ? 17.53%
=====================================================================
Files ? 181
Lines ? 52436
Branches ? 0
=====================================================================
Hits ? 9196
Misses ? 41820
Partials ? 1420 ☔ View full report in Codecov by Sentry. |
b9b8762
to
587fdc7
Compare
c2d36f1
to
a62066c
Compare
Co-authored-by: Omri <omritoptix@gmail.com>
Co-authored-by: Omri <omritoptix@gmail.com> (cherry picked from commit db109b2)
PR Standards
Opening a pull request should be able to meet the following requirements
--
PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A
Close #1128
<-- Briefly describe the content of this pull request -->
For Author:
godoc
commentsFor Reviewer:
After reviewer approval: