-
Notifications
You must be signed in to change notification settings - Fork 84
Conversation
36a19f2
to
6b47155
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 for linting!
What's your thinking behind value_int
? Why not just have the string value
? If there are things we know we need numbers for, like gas, we should probably just build those in direct.
my thinking was by declaring a type we're avoiding parsing errors. For example, tag "count_participants": 5. And the user wants to query "count_participants > 3". If value were a string ("5"), we'd have to parse it as Int each time and then compare against the query. If the value is an int, we're avoiding parsing (protobuf ensures it is an int64) and can also save it as int in the DB. But maybe this is not worth adding a new field.
|
Interesting. I'm not sure if it's worth it. What does @ethanfrey think? |
Originally this design was suggested by Jae. |
we can also add a type so we could switch in code ^^^ and later extend it with other types (like Date or Time). use case is when user wants to pass "" as a value |
I originally proposed a list of strings and only doing exact matches. thus it would match a specific key-value pair. This concept was turned much more complex to the string-{string,int} model proposed in a meeting with anton, jae, and bucky. And was the last consensus in the design document: https://gist.github.com/melekes/131291e5144e31d34ac3ed3ab7ff2aca#gistcomment-2127313 AFAIK, the only use cases of the queries needed by the API are for exact matches, and if we are not using integer comparison (does anyone really need to filter all tx with a value over 40 atom regardless of address?), I am fine using only string equality (i can encode addresses as strings). If we do support both int and strings and comparison operators in the indexer, however, it does make sense to expose that in the abci api. Given the design space that was agreed upon, I approve this pr, but please use different result types 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.
I think we need to separate out DeliverTx and CheckTx, otherwise, the implementation looks good.
types/result.go
Outdated
@@ -102,6 +103,7 @@ func (r *ResponseCheckTx) Result() Result { | |||
Code: r.Code, | |||
Data: r.Data, | |||
Log: r.Log, | |||
Tags: r.Tags, |
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 is no meaning to tags in checktx, as they should never be indexed. We should remove that from the api, as it would be misleading.
types/result.go
Outdated
@@ -12,6 +12,7 @@ type Result struct { | |||
Code CodeType `json:"code"` | |||
Data data.Bytes `json:"data"` | |||
Log string `json:"log"` // Can be non-deterministic | |||
Tags []*KVPair `json:"tags"` |
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 we should start separating the result from DeliverTx and CheckTx.
DeliverTx needs tags, which CheckTx doesn't.
We will also need to add Gas and Fees (or Cost and Value or....) to CheckTx as per #57 and soon.
Given this, I already separated the DeliverTx and CheckTx results in the sdk. We should use different types in the abci.
I don't think it's too late to switch to Redis like subscriptions in that is what we want and it is enough for everyone. |
Added comments on slack, but they belong here: We actually don't need any general purpose > < and strings are fine for subscriptions. If we actually used redis as a backing store for pub sub (just as an example, we don't need to), sorted sets would satisfy the requirements of exactly one, predefined integer sort: https://redis.io/topics/data-types#sorted-sets This technique is explained in detail here (just skip the java code in the middle): I am not saying we have to use redis as a backing store (although I think it might be nice to support it as an optional backend), but more illustrating that if we simplify the requirements to string channels and search by I could also implement this sorted set query pattern on top of level db without much problem, and as anton has already implemented pubsub, that would cover the requirements. |
btw, my approach for handling this directly on leveldb, which supports iteration, would be to define keys as You could then calculate byte representations for The purpose of adding tx index as a third parameter is to avoid collisions if there are multiple tx in the same block that match a channel |
I like that idea, but the question is that enough for UI? https://allinbits.slack.com/archives/C564C4P1U/p1510910368000182?thread_ts=1510859626.000247&cid=C564C4P1U |
6b47155
to
3cbf440
Compare
add value_type field to KVPair
…spectively Commit now returns ResponseCommit
c92ced2
to
3a3d508
Compare
which was introduced in tendermint/abci#130
Addressed all the comments. |
func (app *BaseApplication) DeliverTx(tx []byte) Result { | ||
return NewResultOK(nil, "") | ||
func (BaseApplication) DeliverTx(tx []byte) ResponseDeliverTx { | ||
return ResponseDeliverTx{Code: CodeType_OK} |
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.
btw, why DeliverTx/CheckTx/Commit return OK, but Query returns empty ResponseQuery{}?
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.
LOL good eye. Should be effectively the same since OK is the zero value, but we should be consistent.
which was introduced in tendermint/abci#130
@@ -6,114 +6,47 @@ import ( | |||
"github.com/tendermint/go-wire/data" | |||
) |
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.
Do we use the methods from this file anywhere?
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, in Tendermint
} | ||
} | ||
|
||
// ResultQuery is a wrapper around ResponseQuery using data.Bytes instead of | ||
// raw byte slices. |
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.
Do we still need it?
Makefile
Outdated
@ bash tests/test.sh | ||
|
||
test_race: | ||
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \; |
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.
this line is needed for test_integrations
!
@@ -1,57 +0,0 @@ | |||
package main |
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 remove this?
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.
its not testing anything new. used to be when BlockAware was it's own interface. Now it's just part of Application.
|
||
FEATURES: | ||
- [types] added Tags field to ResponseDeliverTx | ||
- [types] added Gas and Fee fields to ResponseCheckTx |
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.
want to add this to readme?
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 thanks for reminder!
test.sh
Outdated
echo "==> Running integration tests (./tests)" | ||
find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \; | ||
make install | ||
bash tests/test.sh |
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, we can call make test_integrations
here. this will allows us to remove redundant find . -path ...
line and make install line
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.
dont we want test_integrations
to run the shell scripts too tho ?
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.
oh, i see. ok
BOOM |
which was introduced in tendermint/abci#130
which was introduced in tendermint/abci#130
No description provided.