mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-26 09:54:19 +00:00
Merge branch main into feature/abci++ppp
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# This is a temporary directory to hold the peg binary,
|
||||
# to work around https://github.com/pointlander/peg/issues/129.
|
||||
# Note that once we have a new version of peg fixing #129,
|
||||
# we may still want to keep this .gitignore to prevent anyone
|
||||
# from accidentally running "git add ." and including their built
|
||||
# peg binary in a commit.
|
||||
.bin/
|
||||
@@ -1,11 +1,7 @@
|
||||
gen_query_parser:
|
||||
go get -u -v github.com/pointlander/peg
|
||||
peg -inline -switch query.peg
|
||||
|
||||
fuzzy_test:
|
||||
go get -u -v github.com/dvyukov/go-fuzz/go-fuzz
|
||||
go get -u -v github.com/dvyukov/go-fuzz/go-fuzz-build
|
||||
go-fuzz-build github.com/tendermint/tendermint/libs/pubsub/query/fuzz_test
|
||||
go-fuzz -bin=./fuzz_test-fuzz.zip -workdir=./fuzz_test/output
|
||||
|
||||
.PHONY: gen_query_parser fuzzy_test
|
||||
.PHONY: fuzzy_test
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
package query
|
||||
|
||||
//go:generate peg -inline -switch query.peg
|
||||
// Normally I would use go run,
|
||||
// but the "Code generated by" comment for peg includes the full arg0,
|
||||
// which includes an unpredictable temporary directory,
|
||||
// resulting in a nondeterminstic generated source file.
|
||||
// Using go build is the workaround as detailed in https://github.com/pointlander/peg/issues/129.
|
||||
|
||||
//go:generate go build -o ./.bin/peg github.com/pointlander/peg
|
||||
//go:generate ./.bin/peg -inline -switch query.peg
|
||||
|
||||
@@ -39,7 +39,9 @@ type Condition struct {
|
||||
// invalid.
|
||||
func New(s string) (*Query, error) {
|
||||
p := &QueryParser{Buffer: fmt.Sprintf(`"%s"`, s)}
|
||||
p.Init()
|
||||
if err := p.Init(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := p.Parse(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -101,7 +103,7 @@ func (q *Query) Conditions() ([]Condition, error) {
|
||||
buffer, begin, end := q.parser.Buffer, 0, 0
|
||||
|
||||
// tokens must be in the following order: tag ("tx.gas") -> operator ("=") -> operand ("7")
|
||||
for token := range q.parser.Tokens() {
|
||||
for _, token := range q.parser.Tokens() {
|
||||
switch token.pegRule {
|
||||
case rulePegText:
|
||||
begin, end = int(token.begin), int(token.end)
|
||||
@@ -213,7 +215,7 @@ func (q *Query) Matches(events map[string][]string) (bool, error) {
|
||||
// tokens must be in the following order:
|
||||
|
||||
// tag ("tx.gas") -> operator ("=") -> operand ("7")
|
||||
for token := range q.parser.Tokens() {
|
||||
for _, token := range q.parser.Tokens() {
|
||||
switch token.pegRule {
|
||||
case rulePegText:
|
||||
begin, end = int(token.begin), int(token.end)
|
||||
|
||||
+261
-495
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user