Skip to content

support historical abci queries#734

Merged
ebuchman merged 3 commits intodevelopfrom
482-support-historical-abci-queries
Oct 13, 2017
Merged

support historical abci queries#734
ebuchman merged 3 commits intodevelopfrom
482-support-historical-abci-queries

Conversation

@melekes
Copy link
Contributor

@melekes melekes commented Oct 10, 2017

See #482

@melekes melekes requested a review from ebuchman as a code owner October 10, 2017 21:36

// abci API
"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,prove"),
"abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is definitely the simplest approach, but I believe @cloudhead was arguing to remove the bool from here and use a separate abci_query_trusted method for prove = false, so the default is it's always true. Would that be better ? It might be nice if the options struct was an arg here that could go in through the jsonrpc, but itd be a total pain to call it using the URI - maybe we just shouldn't worry too much about that usecase, I kind of see us eventually deprecating the URI interface eventually due to issues like this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be a total pain to call it using the URI

yeah.

As I understood, @ethanfrey and @cloudhead don't care as long as the HttpClient (or LocalClient) defaults to prove=true. And that's what I did: our both clients have this interface

ABCIQuery(path string, data []byte) { return ABCIQueryWithOptions(path, data, abci.DefaultQueryOptions) }
ABCIQueryWithOptions(path string, data []byte, opts abci.QueryOptions) { ... }

Or this is counterintuitive? I mean when the rpc core method defaults to prove=false, but the official client defaults to prove=true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was more concerned with the Go API - but I do think they should all default to prove=true/trusted=false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"yeah, it will be much easier if we rename prove to trusted"

// DefaultABCIQueryOptions are latest height (0) and prove equal to true.
func DefaultABCIQueryOptions() ABCIQueryOptions {
return ABCIQueryOptions{Height: 0, Prove: true}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if this was a var instead of a function.

// than the DefaultABCIQueryOptions.
type ABCIQueryOptions struct {
Height uint64
Prove bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're moving to Prove: true as the default, maybe switching this to Trusted bool, where Trusted == !Prove would be better, so that an empty ABCIQueryOptions{} would have the expected defaults.

rpc/core/abci.go Outdated
// | height | uint64 | 0 | false | Height (0 means latest) |
// | prove | bool | false | false | Include a proof of the data inclusion |
func ABCIQuery(path string, data data.Bytes, prove bool) (*ctypes.ResultABCIQuery, error) {
func ABCIQuery(path string, data data.Bytes, height uint64, prove bool) (*ctypes.ResultABCIQuery, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this method have a similar signature to the other one, with ABCIQueryOptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be very hard to do

@cloudhead
Copy link
Contributor

Good!

@codecov-io
Copy link

codecov-io commented Oct 11, 2017

Codecov Report

Merging #734 into develop will decrease coverage by 0.31%.
The diff coverage is 60%.

@@             Coverage Diff             @@
##           develop     #734      +/-   ##
===========================================
- Coverage     57.4%   57.09%   -0.32%     
===========================================
  Files           82       82              
  Lines         8422     8434      +12     
===========================================
- Hits          4835     4815      -20     
- Misses        3171     3197      +26     
- Partials       416      422       +6

@melekes melekes changed the title WIP: support historical abci queries support historical abci queries Oct 12, 2017
Trusted bool
}

// DefaultABCIQueryOptions are latest height (0) and prove equal to true.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update comment - "trusted equal to false (which will result in a proof being returned)"

@melekes melekes force-pushed the 482-support-historical-abci-queries branch from 45a5af9 to 7518c4a Compare October 13, 2017 11:03
@ebuchman ebuchman merged commit 340f33b into develop Oct 13, 2017
@ebuchman ebuchman deleted the 482-support-historical-abci-queries branch October 13, 2017 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants