mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 19:53:58 +00:00
* ci: Fix linter complaint (#9645)
Fixes a very silly linter complaint that makes absolutely no sense and is blocking the merging of several PRs.
---
#### PR checklist
- [x] Tests written/updated, or no tests needed
- [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [x] Updated relevant documentation (`docs/`) and code comments, or no
documentation updates needed
(cherry picked from commit 83b7f4ad5b)
# Conflicts:
# .github/workflows/lint.yml
# .golangci.yml
# cmd/tendermint/commands/debug/util.go
* Resolve conflicts
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* ci: Sync golangci-lint config with main
Minus the spelling configuration that restricts spelling to US English
only.
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* make format
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove usage of deprecated io/ioutil package
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove unused mockBlockStore
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* blockchain/v2: Remove unused method
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Bulk fix lints
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* lint: Ignore auto-generated query PEG
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Co-authored-by: Thane Thomson <connect@thanethomson.com>
45 lines
977 B
Go
45 lines
977 B
Go
package handler
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"io"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
|
|
"github.com/tendermint/tendermint/libs/log"
|
|
rs "github.com/tendermint/tendermint/rpc/jsonrpc/server"
|
|
types "github.com/tendermint/tendermint/rpc/jsonrpc/types"
|
|
)
|
|
|
|
var rpcFuncMap = map[string]*rs.RPCFunc{
|
|
"c": rs.NewRPCFunc(func(s string, i int) (string, int) { return "foo", 200 }, "s,i"),
|
|
}
|
|
var mux *http.ServeMux
|
|
|
|
func init() {
|
|
mux := http.NewServeMux()
|
|
buf := new(bytes.Buffer)
|
|
lgr := log.NewTMLogger(buf)
|
|
rs.RegisterRPCFuncs(mux, rpcFuncMap, lgr)
|
|
}
|
|
|
|
func Fuzz(data []byte) int {
|
|
req, _ := http.NewRequest("POST", "http://localhost/", bytes.NewReader(data))
|
|
rec := httptest.NewRecorder()
|
|
mux.ServeHTTP(rec, req)
|
|
res := rec.Result()
|
|
blob, err := io.ReadAll(res.Body)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if err := res.Body.Close(); err != nil {
|
|
panic(err)
|
|
}
|
|
recv := new(types.RPCResponse)
|
|
if err := json.Unmarshal(blob, recv); err != nil {
|
|
panic(err)
|
|
}
|
|
return 1
|
|
}
|