Skip to content
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

Main patch from tm-v0.34.9 #349

Merged
merged 33 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1c568c2
rpc/jsonrpc: Unmarshal RPCRequest correctly (bp #6191) (#6193)
tnasu Dec 1, 2021
9b3faee
Fix codecov for `rpc/jsonrpc: Unmarshal RPCRequest correctly (bp #619…
tnasu Dec 7, 2021
93235ac
logs: cleanup (#6198)
tnasu Dec 1, 2021
b22dbc3
Fix codecov for `logs: cleanup (#6198)`
tnasu Dec 6, 2021
9243a45
mempool/rpc: log grooming (bp #6201) (#6203)
tnasu Dec 1, 2021
d1ca5e9
indexer: remove info log (#6194)
tnasu Dec 1, 2021
4fccda2
e2e: add benchmarking functionality (bp #6210) (#6216)
tnasu Dec 1, 2021
c6b5045
note: add nondeterministic note to events (#6220) (#6225)
tnasu Dec 1, 2021
1843507
use error.Is to check for nondeterminstic vote error type (#6237) (#6…
tnasu Dec 1, 2021
896ad94
rpc/jsonrpc/server: return an error in WriteRPCResponseHTTP(Error) (b…
tnasu Dec 1, 2021
647a2e0
Fix codecov for `rpc/jsonrpc/server: return an error in WriteRPCRespo…
tnasu Dec 8, 2021
d56369c
e2e: integrate light clients (bp #6196)
tnasu Dec 23, 2021
0643021
Fix lint for `e2e: integrate light clients (bp #6196)`
tnasu Dec 23, 2021
4925f8e
Fix codecov for `e2e: integrate light clients (bp #6196)`
tnasu Dec 23, 2021
3780097
rpc: index block events to support block event queries (bp #6226) (#6…
tnasu Dec 14, 2021
98fe33b
Fix codecov for `rpc: index block events to support block event queri…
tnasu Dec 17, 2021
3b328ea
logging: shorten precommit log message (#6270) (#6274)
tnasu Dec 20, 2021
f9ce069
fix: jsonrpc url parsing and dial function (#6264) (#6288)
tnasu Dec 20, 2021
b59f44d
change index block log to info (#6290) (#6294)
tnasu Dec 20, 2021
4f22ffe
p2p: Fix "Unknown Channel" bug on CustomReactors (#6297)
tnasu Dec 20, 2021
aea3813
state: fix block event indexing reserved key check (#6314) (#6315)
tnasu Dec 23, 2021
3663fda
light/evidence: handle FLA backport (#6331)
tnasu Dec 20, 2021
eed4d02
Revert evidence/pool.go in `Support for VRF implementation with libso…
tnasu Dec 22, 2021
1d47c8b
Fix test for `light/evidence: handle FLA backport (#6331)`
tnasu Dec 22, 2021
433f0cb
Ignore test for `light/evidence: handle FLA backport (#6331)`
tnasu Dec 21, 2021
ecf98d0
Imporve the execution time of light test
tnasu Dec 21, 2021
07b8e1c
Improve log format
tnasu Dec 21, 2021
7404d2f
Bugfix logging value
tnasu Dec 21, 2021
5371299
Refactor function for usability
tnasu Dec 21, 2021
e4bea39
Fix `TestLightClientAttackEvidence_Lunatic`
tnasu Dec 22, 2021
68beef4
Fix `TestLightClientAttackEvidence_Equivocation`
tnasu Dec 22, 2021
d23562a
Fix `TestLightClientAttackEvidence_ForwardLunatic`
tnasu Dec 22, 2021
e937da9
Merge remote-tracking branch 'upstream/main' into main-patch-tm-v0.34.14
tnasu Dec 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
**/**.go
go.mod
go.sum
- uses: golangci/golangci-lint-action@v2.2.1
- uses: golangci/golangci-lint-action@v2.5.1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
args: --timeout 10m --skip-files "_test\.go" # for skip unused linter (https://github.com/golangci/golangci-lint/issues/791)
version: v1.38
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF
2 changes: 1 addition & 1 deletion abci/client/grpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestGrpcClientCalls(t *testing.T) {
})
err0 = c.Start()
require.NoError(t, err0)

c.EchoAsync("msg", getResponseCallback(t))
c.FlushAsync(getResponseCallback(t))
c.InfoAsync(types.RequestInfo{}, getResponseCallback(t))
Expand Down
6 changes: 3 additions & 3 deletions abci/client/local_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type sampleApp struct {

func newDoneChan(t *testing.T) chan struct{} {
result := make(chan struct{})
go func(){
go func() {
select {
case <-time.After(time.Second):
require.Fail(t, "callback is not called for a second")
Expand All @@ -27,9 +27,9 @@ func newDoneChan(t *testing.T) chan struct{} {

func getResponseCallback(t *testing.T) ResponseCallback {
doneChan := newDoneChan(t)
return func (res *types.Response) {
return func(res *types.Response) {
require.NotNil(t, res)
doneChan<- struct{}{}
doneChan <- struct{}{}
}
}

Expand Down
6 changes: 3 additions & 3 deletions abci/client/socket_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ type sampleApp struct {

func newDoneChan(t *testing.T) chan struct{} {
result := make(chan struct{})
go func(){
go func() {
select {
case <-time.After(time.Second):
require.Fail(t, "callback is not called for a second")
Expand All @@ -226,8 +226,8 @@ func newDoneChan(t *testing.T) chan struct{} {

func getResponseCallback(t *testing.T) abcicli.ResponseCallback {
doneChan := newDoneChan(t)
return func (res *types.Response) {
return func(res *types.Response) {
require.NotNil(t, res)
doneChan<- struct{}{}
doneChan <- struct{}{}
}
}
2 changes: 2 additions & 0 deletions abci/types/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
context "golang.org/x/net/context"
)

//go:generate mockery --case underscore --name Application

type CheckTxCallback func(ResponseCheckTx)

// Application is an interface that enables any finite, deterministic state machine
Expand Down
228 changes: 228 additions & 0 deletions abci/types/mocks/application.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion blockchain/v2/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,22 @@ func (mp mockPeer) Get(string) interface{} { return struct{}{} }

func (mp mockPeer) String() string { return fmt.Sprintf("%v", mp.id) }

//nolint:unused
// nolint:unused // ignore
type mockBlockStore struct {
blocks map[int64]*types.Block
}

// nolint:unused // ignore
func (ml *mockBlockStore) Height() int64 {
return int64(len(ml.blocks))
}

// nolint:unused // ignore
func (ml *mockBlockStore) LoadBlock(height int64) *types.Block {
return ml.blocks[height]
}

// nolint:unused // ignore
func (ml *mockBlockStore) SaveBlock(block *types.Block, part *types.PartSet, commit *types.Commit) {
ml.blocks[block.Height] = block
}
Expand Down
32 changes: 6 additions & 26 deletions cmd/ostracon/commands/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ import (
"net/http"
"os"
"path/filepath"
"regexp"
"strings"
"time"

rpchttp "github.com/line/ostracon/rpc/client/http"

"github.com/line/tm-db/v2/goleveldb"
"github.com/spf13/cobra"

dbm "github.com/line/tm-db/v2"

"github.com/line/ostracon/crypto/merkle"
"github.com/line/ostracon/libs/log"
tmmath "github.com/line/ostracon/libs/math"
tmos "github.com/line/ostracon/libs/os"
"github.com/line/ostracon/light"
lproxy "github.com/line/ostracon/light/proxy"
lrpc "github.com/line/ostracon/light/rpc"
dbs "github.com/line/ostracon/light/store/db"
rpchttp "github.com/line/ostracon/rpc/client/http"
rpcserver "github.com/line/ostracon/rpc/jsonrpc/server"
)

Expand Down Expand Up @@ -233,12 +232,11 @@ func runProxy(cmd *cobra.Command, args []string) error {
cfg.WriteTimeout = config.RPC.TimeoutBroadcastTxCommit + 1*time.Second
}

p := lproxy.Proxy{
Addr: listenAddr,
Config: cfg,
Client: lrpc.NewClient(rpcClient, c, lrpc.KeyPathFn(defaultMerkleKeyPathFn())),
Logger: logger,
p, err := lproxy.NewProxy(c, listenAddr, primaryAddr, cfg, logger, lrpc.KeyPathFn(lrpc.DefaultMerkleKeyPathFn()))
if err != nil {
return err
}

// Stop upon receiving SIGTERM or CTRL-C.
tmos.TrapSignal(logger, func() {
p.Listener.Close()
Expand Down Expand Up @@ -277,21 +275,3 @@ func saveProviders(db dbm.DB, primaryAddr, witnessesAddrs string) error {
}
return nil
}

func defaultMerkleKeyPathFn() lrpc.KeyPathFunc {
// regexp for extracting store name from /abci_query path
storeNameRegexp := regexp.MustCompile(`\/store\/(.+)\/key`)

return func(path string, key []byte) (merkle.KeyPath, error) {
matches := storeNameRegexp.FindStringSubmatch(path)
if len(matches) != 2 {
return nil, fmt.Errorf("can't find store name in %s using %s", path, storeNameRegexp)
}
storeName := matches[1]

kp := merkle.KeyPath{}
kp = kp.AppendKey([]byte(storeName), merkle.KeyEncodingURL)
kp = kp.AppendKey(key, merkle.KeyEncodingURL)
return kp, nil
}
}
Loading