make the rest of the code compile

This commit is contained in:
Callum Waters
2021-08-24 13:26:01 +02:00
parent dcf91478f8
commit 68c54f0676
283 changed files with 3874 additions and 3906 deletions
+2 -2
View File
@@ -10,11 +10,11 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/pkg/abci"
types "github.com/tendermint/tendermint/pkg/events"
"github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
var waitForEventTimeout = 8 * time.Second
+12 -10
View File
@@ -9,15 +9,17 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/ed25519"
cryptoenc "github.com/tendermint/tendermint/crypto/encoding"
"github.com/tendermint/tendermint/crypto/tmhash"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/pkg/consensus"
types "github.com/tendermint/tendermint/pkg/evidence"
"github.com/tendermint/tendermint/pkg/metadata"
"github.com/tendermint/tendermint/privval"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/rpc/client"
"github.com/tendermint/tendermint/types"
)
// For some reason the empty node used in tests has a time of
@@ -27,7 +29,7 @@ import (
var defaultTestTime = time.Date(2018, 10, 10, 8, 20, 13, 695936996, time.UTC)
func newEvidence(t *testing.T, val *privval.FilePV,
vote *types.Vote, vote2 *types.Vote,
vote *consensus.Vote, vote2 *consensus.Vote,
chainID string) *types.DuplicateVoteEvidence {
var err error
@@ -35,14 +37,14 @@ func newEvidence(t *testing.T, val *privval.FilePV,
v := vote.ToProto()
v2 := vote2.ToProto()
vote.Signature, err = val.Key.PrivKey.Sign(types.VoteSignBytes(chainID, v))
vote.Signature, err = val.Key.PrivKey.Sign(consensus.VoteSignBytes(chainID, v))
require.NoError(t, err)
vote2.Signature, err = val.Key.PrivKey.Sign(types.VoteSignBytes(chainID, v2))
vote2.Signature, err = val.Key.PrivKey.Sign(consensus.VoteSignBytes(chainID, v2))
require.NoError(t, err)
validator := types.NewValidator(val.Key.PubKey, 10)
valSet := types.NewValidatorSet([]*types.Validator{validator})
validator := consensus.NewValidator(val.Key.PubKey, 10)
valSet := consensus.NewValidatorSet([]*consensus.Validator{validator})
return types.NewDuplicateVoteEvidence(vote, vote2, defaultTestTime, valSet)
}
@@ -52,16 +54,16 @@ func makeEvidences(
val *privval.FilePV,
chainID string,
) (correct *types.DuplicateVoteEvidence, fakes []*types.DuplicateVoteEvidence) {
vote := types.Vote{
vote := consensus.Vote{
ValidatorAddress: val.Key.Address,
ValidatorIndex: 0,
Height: 1,
Round: 0,
Type: tmproto.PrevoteType,
Timestamp: defaultTestTime,
BlockID: types.BlockID{
BlockID: metadata.BlockID{
Hash: tmhash.Sum(tmrand.Bytes(tmhash.Size)),
PartSetHeader: types.PartSetHeader{
PartSetHeader: metadata.PartSetHeader{
Total: 1000,
Hash: tmhash.Sum([]byte("partset")),
},
+4 -4
View File
@@ -6,7 +6,7 @@ import (
"fmt"
"time"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/pkg/events"
)
// Waiter is informed of current height, decided whether to quit early
@@ -57,13 +57,13 @@ func WaitForHeight(c StatusClient, h int64, waiter Waiter) error {
// when the timeout duration has expired.
//
// This handles subscribing and unsubscribing under the hood
func WaitForOneEvent(c EventsClient, eventValue string, timeout time.Duration) (types.TMEventData, error) {
func WaitForOneEvent(c EventsClient, eventValue string, timeout time.Duration) (events.TMEventData, error) {
const subscriber = "helpers"
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
// register for the next event of this type
eventCh, err := c.Subscribe(ctx, subscriber, types.QueryForEvent(eventValue).String())
eventCh, err := c.Subscribe(ctx, subscriber, events.QueryForEvent(eventValue).String())
if err != nil {
return nil, fmt.Errorf("failed to subscribe: %w", err)
}
@@ -77,7 +77,7 @@ func WaitForOneEvent(c EventsClient, eventValue string, timeout time.Duration) (
select {
case event := <-eventCh:
return event.Data.(types.TMEventData), nil
return event.Data.(events.TMEventData), nil
case <-ctx.Done():
return nil, errors.New("timed out waiting for event")
}
+8 -7
View File
@@ -7,10 +7,11 @@ import (
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/pkg/evidence"
"github.com/tendermint/tendermint/pkg/mempool"
rpcclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
jsonrpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
"github.com/tendermint/tendermint/types"
)
/*
@@ -250,7 +251,7 @@ func (c *baseRPCClient) ABCIQueryWithOptions(
func (c *baseRPCClient) BroadcastTxCommit(
ctx context.Context,
tx types.Tx,
tx mempool.Tx,
) (*ctypes.ResultBroadcastTxCommit, error) {
result := new(ctypes.ResultBroadcastTxCommit)
_, err := c.caller.Call(ctx, "broadcast_tx_commit", map[string]interface{}{"tx": tx}, result)
@@ -262,14 +263,14 @@ func (c *baseRPCClient) BroadcastTxCommit(
func (c *baseRPCClient) BroadcastTxAsync(
ctx context.Context,
tx types.Tx,
tx mempool.Tx,
) (*ctypes.ResultBroadcastTx, error) {
return c.broadcastTX(ctx, "broadcast_tx_async", tx)
}
func (c *baseRPCClient) BroadcastTxSync(
ctx context.Context,
tx types.Tx,
tx mempool.Tx,
) (*ctypes.ResultBroadcastTx, error) {
return c.broadcastTX(ctx, "broadcast_tx_sync", tx)
}
@@ -277,7 +278,7 @@ func (c *baseRPCClient) BroadcastTxSync(
func (c *baseRPCClient) broadcastTX(
ctx context.Context,
route string,
tx types.Tx,
tx mempool.Tx,
) (*ctypes.ResultBroadcastTx, error) {
result := new(ctypes.ResultBroadcastTx)
_, err := c.caller.Call(ctx, route, map[string]interface{}{"tx": tx}, result)
@@ -312,7 +313,7 @@ func (c *baseRPCClient) NumUnconfirmedTxs(ctx context.Context) (*ctypes.ResultUn
return result, nil
}
func (c *baseRPCClient) CheckTx(ctx context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error) {
func (c *baseRPCClient) CheckTx(ctx context.Context, tx mempool.Tx) (*ctypes.ResultCheckTx, error) {
result := new(ctypes.ResultCheckTx)
_, err := c.caller.Call(ctx, "check_tx", map[string]interface{}{"tx": tx}, result)
if err != nil {
@@ -558,7 +559,7 @@ func (c *baseRPCClient) Validators(
func (c *baseRPCClient) BroadcastEvidence(
ctx context.Context,
ev types.Evidence,
ev evidence.Evidence,
) (*ctypes.ResultBroadcastEvidence, error) {
result := new(ctypes.ResultBroadcastEvidence)
_, err := c.caller.Call(ctx, "broadcast_evidence", map[string]interface{}{"evidence": ev}, result)
+7 -6
View File
@@ -25,8 +25,9 @@ import (
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/pkg/evidence"
"github.com/tendermint/tendermint/pkg/mempool"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
//go:generate ../../scripts/mockery_generate.sh Client
@@ -58,9 +59,9 @@ type ABCIClient interface {
opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
// Writing to abci app
BroadcastTxCommit(context.Context, types.Tx) (*ctypes.ResultBroadcastTxCommit, error)
BroadcastTxAsync(context.Context, types.Tx) (*ctypes.ResultBroadcastTx, error)
BroadcastTxSync(context.Context, types.Tx) (*ctypes.ResultBroadcastTx, error)
BroadcastTxCommit(context.Context, mempool.Tx) (*ctypes.ResultBroadcastTxCommit, error)
BroadcastTxAsync(context.Context, mempool.Tx) (*ctypes.ResultBroadcastTx, error)
BroadcastTxSync(context.Context, mempool.Tx) (*ctypes.ResultBroadcastTx, error)
}
// SignClient groups together the functionality needed to get valid signatures
@@ -136,13 +137,13 @@ type EventsClient interface {
type MempoolClient interface {
UnconfirmedTxs(ctx context.Context, limit *int) (*ctypes.ResultUnconfirmedTxs, error)
NumUnconfirmedTxs(context.Context) (*ctypes.ResultUnconfirmedTxs, error)
CheckTx(context.Context, types.Tx) (*ctypes.ResultCheckTx, error)
CheckTx(context.Context, mempool.Tx) (*ctypes.ResultCheckTx, error)
}
// EvidenceClient is used for submitting an evidence of the malicious
// behavior.
type EvidenceClient interface {
BroadcastEvidence(context.Context, types.Evidence) (*ctypes.ResultBroadcastEvidence, error)
BroadcastEvidence(context.Context, evidence.Evidence) (*ctypes.ResultBroadcastEvidence, error)
}
// RemoteClient is a Client, which can also return the remote network address.
+13 -11
View File
@@ -9,11 +9,13 @@ import (
"github.com/tendermint/tendermint/libs/log"
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
tmquery "github.com/tendermint/tendermint/libs/pubsub/query"
"github.com/tendermint/tendermint/pkg/events"
"github.com/tendermint/tendermint/pkg/evidence"
"github.com/tendermint/tendermint/pkg/mempool"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpccore "github.com/tendermint/tendermint/rpc/core"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
/*
@@ -37,7 +39,7 @@ don't need to do anything). It will keep trying indefinitely with exponential
backoff (10ms -> 20ms -> 40ms) until successful.
*/
type Local struct {
*types.EventBus
*events.EventBus
Logger log.Logger
ctx *rpctypes.Context
env *rpccore.Environment
@@ -47,7 +49,7 @@ type Local struct {
// local RPC client constructor needs to build a local client.
type NodeService interface {
ConfigureRPC() (*rpccore.Environment, error)
EventBus() *types.EventBus
EventBus() *events.EventBus
}
// New configures a client that calls the Node directly.
@@ -91,15 +93,15 @@ func (c *Local) ABCIQueryWithOptions(
return c.env.ABCIQuery(c.ctx, path, data, opts.Height, opts.Prove)
}
func (c *Local) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
func (c *Local) BroadcastTxCommit(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
return c.env.BroadcastTxCommit(c.ctx, tx)
}
func (c *Local) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (c *Local) BroadcastTxAsync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
return c.env.BroadcastTxAsync(c.ctx, tx)
}
func (c *Local) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (c *Local) BroadcastTxSync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
return c.env.BroadcastTxSync(c.ctx, tx)
}
@@ -111,7 +113,7 @@ func (c *Local) NumUnconfirmedTxs(ctx context.Context) (*ctypes.ResultUnconfirme
return c.env.NumUnconfirmedTxs(c.ctx)
}
func (c *Local) CheckTx(ctx context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error) {
func (c *Local) CheckTx(ctx context.Context, tx mempool.Tx) (*ctypes.ResultCheckTx, error) {
return c.env.CheckTx(c.ctx, tx)
}
@@ -205,7 +207,7 @@ func (c *Local) BlockSearch(
return c.env.BlockSearch(c.ctx, query, page, perPage, orderBy)
}
func (c *Local) BroadcastEvidence(ctx context.Context, ev types.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
func (c *Local) BroadcastEvidence(ctx context.Context, ev evidence.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
return c.env.BroadcastEvidence(c.ctx, ev)
}
@@ -224,7 +226,7 @@ func (c *Local) Subscribe(
outCap = outCapacity[0]
}
var sub types.Subscription
var sub events.Subscription
if outCap > 0 {
sub, err = c.EventBus.Subscribe(ctx, subscriber, q, outCap)
} else {
@@ -241,7 +243,7 @@ func (c *Local) Subscribe(
}
func (c *Local) eventsRoutine(
sub types.Subscription,
sub events.Subscription,
subscriber string,
q tmpubsub.Query,
outc chan<- ctypes.ResultEvent) {
@@ -281,7 +283,7 @@ func (c *Local) eventsRoutine(
}
// Try to resubscribe with exponential backoff.
func (c *Local) resubscribe(subscriber string, q tmpubsub.Query) types.Subscription {
func (c *Local) resubscribe(subscriber string, q tmpubsub.Query) events.Subscription {
attempts := 0
for {
if !c.IsRunning() {
+11 -11
View File
@@ -3,12 +3,12 @@ package mock
import (
"context"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/pkg/mempool"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
// ABCIApp will send all abci related request to the named app,
@@ -49,7 +49,7 @@ func (a ABCIApp) ABCIQueryWithOptions(
// NOTE: Caller should call a.App.Commit() separately,
// this function does not actually wait for a commit.
// TODO: Make it wait for a commit and set res.Height appropriately.
func (a ABCIApp) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
func (a ABCIApp) BroadcastTxCommit(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
res := ctypes.ResultBroadcastTxCommit{}
res.CheckTx = a.App.CheckTx(abci.RequestCheckTx{Tx: tx})
if res.CheckTx.IsErr() {
@@ -60,7 +60,7 @@ func (a ABCIApp) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.Re
return &res, nil
}
func (a ABCIApp) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (a ABCIApp) BroadcastTxAsync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
c := a.App.CheckTx(abci.RequestCheckTx{Tx: tx})
// and this gets written in a background thread...
if !c.IsErr() {
@@ -75,7 +75,7 @@ func (a ABCIApp) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.Res
}, nil
}
func (a ABCIApp) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (a ABCIApp) BroadcastTxSync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
c := a.App.CheckTx(abci.RequestCheckTx{Tx: tx})
// and this gets written in a background thread...
if !c.IsErr() {
@@ -125,7 +125,7 @@ func (m ABCIMock) ABCIQueryWithOptions(
return &ctypes.ResultABCIQuery{Response: resQuery}, nil
}
func (m ABCIMock) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
func (m ABCIMock) BroadcastTxCommit(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
res, err := m.BroadcastCommit.GetResponse(tx)
if err != nil {
return nil, err
@@ -133,7 +133,7 @@ func (m ABCIMock) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.R
return res.(*ctypes.ResultBroadcastTxCommit), nil
}
func (m ABCIMock) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (m ABCIMock) BroadcastTxAsync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
res, err := m.Broadcast.GetResponse(tx)
if err != nil {
return nil, err
@@ -141,7 +141,7 @@ func (m ABCIMock) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.Re
return res.(*ctypes.ResultBroadcastTx), nil
}
func (m ABCIMock) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (m ABCIMock) BroadcastTxSync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
res, err := m.Broadcast.GetResponse(tx)
if err != nil {
return nil, err
@@ -207,7 +207,7 @@ func (r *ABCIRecorder) ABCIQueryWithOptions(
return res, err
}
func (r *ABCIRecorder) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
func (r *ABCIRecorder) BroadcastTxCommit(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
res, err := r.Client.BroadcastTxCommit(ctx, tx)
r.addCall(Call{
Name: "broadcast_tx_commit",
@@ -218,7 +218,7 @@ func (r *ABCIRecorder) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*cty
return res, err
}
func (r *ABCIRecorder) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (r *ABCIRecorder) BroadcastTxAsync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
res, err := r.Client.BroadcastTxAsync(ctx, tx)
r.addCall(Call{
Name: "broadcast_tx_async",
@@ -229,7 +229,7 @@ func (r *ABCIRecorder) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctyp
return res, err
}
func (r *ABCIRecorder) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (r *ABCIRecorder) BroadcastTxSync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
res, err := r.Client.BroadcastTxSync(ctx, tx)
r.addCall(Call{
Name: "broadcast_tx_sync",
+6 -6
View File
@@ -10,12 +10,12 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/abci/example/kvstore"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/pkg/mempool"
"github.com/tendermint/tendermint/rpc/client"
"github.com/tendermint/tendermint/rpc/client/mock"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
func TestABCIMock(t *testing.T) {
@@ -23,8 +23,8 @@ func TestABCIMock(t *testing.T) {
key, value := []byte("foo"), []byte("bar")
height := int64(10)
goodTx := types.Tx{0x01, 0xff}
badTx := types.Tx{0x12, 0x21}
goodTx := mempool.Tx{0x01, 0xff}
badTx := mempool.Tx{0x12, 0x21}
m := mock.ABCIMock{
Info: mock.Call{Error: errors.New("foobar")},
@@ -130,7 +130,7 @@ func TestABCIRecorder(t *testing.T) {
assert.False(qa.Prove)
// now add some broadcasts (should all err)
txs := []types.Tx{{1}, {2}, {3}}
txs := []mempool.Tx{{1}, {2}, {3}}
_, err = r.BroadcastTxCommit(context.Background(), txs[0])
assert.NotNil(err, "expected err on broadcast")
_, err = r.BroadcastTxSync(context.Background(), txs[1])
@@ -172,7 +172,7 @@ func TestABCIApp(t *testing.T) {
// add a key
key, value := "foo", "bar"
tx := fmt.Sprintf("%s=%s", key, value)
res, err := m.BroadcastTxCommit(context.Background(), types.Tx(tx))
res, err := m.BroadcastTxCommit(context.Background(), mempool.Tx(tx))
require.Nil(err)
assert.True(res.CheckTx.IsOK())
require.NotNil(res.DeliverTx)
+7 -6
View File
@@ -20,11 +20,12 @@ import (
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/pkg/evidence"
"github.com/tendermint/tendermint/pkg/mempool"
"github.com/tendermint/tendermint/rpc/client"
"github.com/tendermint/tendermint/rpc/core"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
// Client wraps arbitrary implementations of the various interfaces.
@@ -104,19 +105,19 @@ func (c Client) ABCIQueryWithOptions(
return c.env.ABCIQuery(&rpctypes.Context{}, path, data, opts.Height, opts.Prove)
}
func (c Client) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
func (c Client) BroadcastTxCommit(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
return c.env.BroadcastTxCommit(&rpctypes.Context{}, tx)
}
func (c Client) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (c Client) BroadcastTxAsync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
return c.env.BroadcastTxAsync(&rpctypes.Context{}, tx)
}
func (c Client) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
func (c Client) BroadcastTxSync(ctx context.Context, tx mempool.Tx) (*ctypes.ResultBroadcastTx, error) {
return c.env.BroadcastTxSync(&rpctypes.Context{}, tx)
}
func (c Client) CheckTx(ctx context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error) {
func (c Client) CheckTx(ctx context.Context, tx mempool.Tx) (*ctypes.ResultCheckTx, error) {
return c.env.CheckTx(&rpctypes.Context{}, tx)
}
@@ -178,6 +179,6 @@ func (c Client) Validators(ctx context.Context, height *int64, page, perPage *in
return c.env.Validators(&rpctypes.Context{}, height, page, perPage)
}
func (c Client) BroadcastEvidence(ctx context.Context, ev types.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
func (c Client) BroadcastEvidence(ctx context.Context, ev evidence.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
return c.env.BroadcastEvidence(&rpctypes.Context{}, ev)
}
+19 -17
View File
@@ -10,11 +10,13 @@ import (
coretypes "github.com/tendermint/tendermint/rpc/core/types"
evidence "github.com/tendermint/tendermint/pkg/evidence"
log "github.com/tendermint/tendermint/libs/log"
mock "github.com/stretchr/testify/mock"
mempool "github.com/tendermint/tendermint/pkg/mempool"
types "github.com/tendermint/tendermint/types"
mock "github.com/stretchr/testify/mock"
)
// Client is an autogenerated mock type for the Client type
@@ -207,11 +209,11 @@ func (_m *Client) BlockchainInfo(ctx context.Context, minHeight int64, maxHeight
}
// BroadcastEvidence provides a mock function with given fields: _a0, _a1
func (_m *Client) BroadcastEvidence(_a0 context.Context, _a1 types.Evidence) (*coretypes.ResultBroadcastEvidence, error) {
func (_m *Client) BroadcastEvidence(_a0 context.Context, _a1 evidence.Evidence) (*coretypes.ResultBroadcastEvidence, error) {
ret := _m.Called(_a0, _a1)
var r0 *coretypes.ResultBroadcastEvidence
if rf, ok := ret.Get(0).(func(context.Context, types.Evidence) *coretypes.ResultBroadcastEvidence); ok {
if rf, ok := ret.Get(0).(func(context.Context, evidence.Evidence) *coretypes.ResultBroadcastEvidence); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
@@ -220,7 +222,7 @@ func (_m *Client) BroadcastEvidence(_a0 context.Context, _a1 types.Evidence) (*c
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, types.Evidence) error); ok {
if rf, ok := ret.Get(1).(func(context.Context, evidence.Evidence) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
@@ -230,11 +232,11 @@ func (_m *Client) BroadcastEvidence(_a0 context.Context, _a1 types.Evidence) (*c
}
// BroadcastTxAsync provides a mock function with given fields: _a0, _a1
func (_m *Client) BroadcastTxAsync(_a0 context.Context, _a1 types.Tx) (*coretypes.ResultBroadcastTx, error) {
func (_m *Client) BroadcastTxAsync(_a0 context.Context, _a1 mempool.Tx) (*coretypes.ResultBroadcastTx, error) {
ret := _m.Called(_a0, _a1)
var r0 *coretypes.ResultBroadcastTx
if rf, ok := ret.Get(0).(func(context.Context, types.Tx) *coretypes.ResultBroadcastTx); ok {
if rf, ok := ret.Get(0).(func(context.Context, mempool.Tx) *coretypes.ResultBroadcastTx); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
@@ -243,7 +245,7 @@ func (_m *Client) BroadcastTxAsync(_a0 context.Context, _a1 types.Tx) (*coretype
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, types.Tx) error); ok {
if rf, ok := ret.Get(1).(func(context.Context, mempool.Tx) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
@@ -253,11 +255,11 @@ func (_m *Client) BroadcastTxAsync(_a0 context.Context, _a1 types.Tx) (*coretype
}
// BroadcastTxCommit provides a mock function with given fields: _a0, _a1
func (_m *Client) BroadcastTxCommit(_a0 context.Context, _a1 types.Tx) (*coretypes.ResultBroadcastTxCommit, error) {
func (_m *Client) BroadcastTxCommit(_a0 context.Context, _a1 mempool.Tx) (*coretypes.ResultBroadcastTxCommit, error) {
ret := _m.Called(_a0, _a1)
var r0 *coretypes.ResultBroadcastTxCommit
if rf, ok := ret.Get(0).(func(context.Context, types.Tx) *coretypes.ResultBroadcastTxCommit); ok {
if rf, ok := ret.Get(0).(func(context.Context, mempool.Tx) *coretypes.ResultBroadcastTxCommit); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
@@ -266,7 +268,7 @@ func (_m *Client) BroadcastTxCommit(_a0 context.Context, _a1 types.Tx) (*coretyp
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, types.Tx) error); ok {
if rf, ok := ret.Get(1).(func(context.Context, mempool.Tx) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
@@ -276,11 +278,11 @@ func (_m *Client) BroadcastTxCommit(_a0 context.Context, _a1 types.Tx) (*coretyp
}
// BroadcastTxSync provides a mock function with given fields: _a0, _a1
func (_m *Client) BroadcastTxSync(_a0 context.Context, _a1 types.Tx) (*coretypes.ResultBroadcastTx, error) {
func (_m *Client) BroadcastTxSync(_a0 context.Context, _a1 mempool.Tx) (*coretypes.ResultBroadcastTx, error) {
ret := _m.Called(_a0, _a1)
var r0 *coretypes.ResultBroadcastTx
if rf, ok := ret.Get(0).(func(context.Context, types.Tx) *coretypes.ResultBroadcastTx); ok {
if rf, ok := ret.Get(0).(func(context.Context, mempool.Tx) *coretypes.ResultBroadcastTx); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
@@ -289,7 +291,7 @@ func (_m *Client) BroadcastTxSync(_a0 context.Context, _a1 types.Tx) (*coretypes
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, types.Tx) error); ok {
if rf, ok := ret.Get(1).(func(context.Context, mempool.Tx) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
@@ -299,11 +301,11 @@ func (_m *Client) BroadcastTxSync(_a0 context.Context, _a1 types.Tx) (*coretypes
}
// CheckTx provides a mock function with given fields: _a0, _a1
func (_m *Client) CheckTx(_a0 context.Context, _a1 types.Tx) (*coretypes.ResultCheckTx, error) {
func (_m *Client) CheckTx(_a0 context.Context, _a1 mempool.Tx) (*coretypes.ResultCheckTx, error) {
ret := _m.Called(_a0, _a1)
var r0 *coretypes.ResultCheckTx
if rf, ok := ret.Get(0).(func(context.Context, types.Tx) *coretypes.ResultCheckTx); ok {
if rf, ok := ret.Get(0).(func(context.Context, mempool.Tx) *coretypes.ResultCheckTx); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
@@ -312,7 +314,7 @@ func (_m *Client) CheckTx(_a0 context.Context, _a1 types.Tx) (*coretypes.ResultC
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, types.Tx) error); ok {
if rf, ok := ret.Get(1).(func(context.Context, mempool.Tx) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
+11 -10
View File
@@ -14,19 +14,20 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/config"
mempl "github.com/tendermint/tendermint/internal/mempool"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmmath "github.com/tendermint/tendermint/libs/math"
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/pkg/consensus"
"github.com/tendermint/tendermint/pkg/mempool"
"github.com/tendermint/tendermint/rpc/client"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
rpclocal "github.com/tendermint/tendermint/rpc/client/local"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
"github.com/tendermint/tendermint/types"
)
func getHTTPClient(t *testing.T, conf *config.Config) *rpchttp.HTTP {
@@ -253,7 +254,7 @@ func TestGenesisChunked(t *testing.T) {
}
doc := []byte(strings.Join(decoded, ""))
var out types.GenesisDoc
var out consensus.GenesisDoc
require.NoError(t, tmjson.Unmarshal(doc, &out),
"first: %+v, doc: %s", first, string(doc))
}
@@ -477,8 +478,8 @@ func TestUnconfirmedTxs(t *testing.T) {
ch := make(chan *abci.Response, 1)
n, conf := NodeSuite(t)
mempool := getMempool(t, n)
err := mempool.CheckTx(ctx, tx, func(resp *abci.Response) { ch <- resp }, mempl.TxInfo{})
m := getMempool(t, n)
err := m.CheckTx(ctx, tx, func(resp *abci.Response) { ch <- resp }, mempl.TxInfo{})
require.NoError(t, err)
@@ -497,11 +498,11 @@ func TestUnconfirmedTxs(t *testing.T) {
assert.Equal(t, 1, res.Count)
assert.Equal(t, 1, res.Total)
assert.Equal(t, mempool.SizeBytes(), res.TotalBytes)
assert.Exactly(t, types.Txs{tx}, types.Txs(res.Txs))
assert.Equal(t, m.SizeBytes(), res.TotalBytes)
assert.Exactly(t, mempool.Txs{tx}, mempool.Txs(res.Txs))
}
mempool.Flush()
m.Flush()
}
func TestNumUnconfirmedTxs(t *testing.T) {
@@ -572,7 +573,7 @@ func TestTx(t *testing.T) {
txHeight := bres.Height
txHash := bres.Hash
anotherTxHash := types.Tx("a different tx").Hash()
anotherTxHash := mempool.Tx("a different tx").Hash()
cases := []struct {
valid bool
@@ -652,7 +653,7 @@ func TestTxSearch(t *testing.T) {
// pick out the last tx to have something to search for in tests
find := result.Txs[len(result.Txs)-1]
anotherTxHash := types.Tx("a different tx").Hash()
anotherTxHash := mempool.Tx("a different tx").Hash()
for i, c := range GetClients(t, n, conf) {
t.Logf("client %d", i)
+1 -1
View File
@@ -1,8 +1,8 @@
package core
import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/proxy"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
+5 -4
View File
@@ -6,10 +6,11 @@ import (
tmmath "github.com/tendermint/tendermint/libs/math"
tmquery "github.com/tendermint/tendermint/libs/pubsub/query"
"github.com/tendermint/tendermint/pkg/block"
"github.com/tendermint/tendermint/pkg/metadata"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/state/indexer"
"github.com/tendermint/tendermint/types"
)
// BlockchainInfo gets block headers for minHeight <= height <= maxHeight.
@@ -40,7 +41,7 @@ func (env *Environment) BlockchainInfo(
}
env.Logger.Debug("BlockchainInfo", "maxHeight", maxHeight, "minHeight", minHeight)
blockMetas := make([]*types.BlockMeta, 0, maxHeight-minHeight+1)
blockMetas := make([]*block.BlockMeta, 0, maxHeight-minHeight+1)
for height := maxHeight; height >= minHeight; height-- {
blockMeta := env.BlockStore.LoadBlockMeta(height)
if blockMeta != nil {
@@ -98,7 +99,7 @@ func (env *Environment) Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.
blockMeta := env.BlockStore.LoadBlockMeta(height)
if blockMeta == nil {
return &ctypes.ResultBlock{BlockID: types.BlockID{}, Block: nil}, nil
return &ctypes.ResultBlock{BlockID: metadata.BlockID{}, Block: nil}, nil
}
block := env.BlockStore.LoadBlock(height)
@@ -110,7 +111,7 @@ func (env *Environment) Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.
func (env *Environment) BlockByHash(ctx *rpctypes.Context, hash []byte) (*ctypes.ResultBlock, error) {
block := env.BlockStore.LoadBlockByHash(hash)
if block == nil {
return &ctypes.ResultBlock{BlockID: types.BlockID{}, Block: nil}, nil
return &ctypes.ResultBlock{BlockID: metadata.BlockID{}, Block: nil}, nil
}
// If block is not nil, then blockMeta can't be nil.
blockMeta := env.BlockStore.LoadBlockMeta(block.Height)
+15 -14
View File
@@ -9,12 +9,13 @@ import (
dbm "github.com/tendermint/tm-db"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/pkg/abci"
types "github.com/tendermint/tendermint/pkg/block"
"github.com/tendermint/tendermint/pkg/metadata"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
)
func TestBlockchainInfo(t *testing.T) {
@@ -120,16 +121,16 @@ type mockBlockStore struct {
height int64
}
func (mockBlockStore) Base() int64 { return 1 }
func (store mockBlockStore) Height() int64 { return store.height }
func (store mockBlockStore) Size() int64 { return store.height }
func (mockBlockStore) LoadBaseMeta() *types.BlockMeta { return nil }
func (mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta { return nil }
func (mockBlockStore) LoadBlock(height int64) *types.Block { return nil }
func (mockBlockStore) LoadBlockByHash(hash []byte) *types.Block { return nil }
func (mockBlockStore) LoadBlockPart(height int64, index int) *types.Part { return nil }
func (mockBlockStore) LoadBlockCommit(height int64) *types.Commit { return nil }
func (mockBlockStore) LoadSeenCommit() *types.Commit { return nil }
func (mockBlockStore) PruneBlocks(height int64) (uint64, error) { return 0, nil }
func (mockBlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) {
func (mockBlockStore) Base() int64 { return 1 }
func (store mockBlockStore) Height() int64 { return store.height }
func (store mockBlockStore) Size() int64 { return store.height }
func (mockBlockStore) LoadBaseMeta() *types.BlockMeta { return nil }
func (mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta { return nil }
func (mockBlockStore) LoadBlock(height int64) *types.Block { return nil }
func (mockBlockStore) LoadBlockByHash(hash []byte) *types.Block { return nil }
func (mockBlockStore) LoadBlockPart(height int64, index int) *metadata.Part { return nil }
func (mockBlockStore) LoadBlockCommit(height int64) *metadata.Commit { return nil }
func (mockBlockStore) LoadSeenCommit() *metadata.Commit { return nil }
func (mockBlockStore) PruneBlocks(height int64) (uint64, error) { return 0, nil }
func (mockBlockStore) SaveBlock(block *types.Block, blockParts *metadata.PartSet, seenCommit *metadata.Commit) {
}
+2 -2
View File
@@ -3,9 +3,9 @@ package core
import (
cm "github.com/tendermint/tendermint/internal/consensus"
tmmath "github.com/tendermint/tendermint/libs/math"
"github.com/tendermint/tendermint/pkg/consensus"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
// Validators gets the validator set at the given block height.
@@ -57,7 +57,7 @@ func (env *Environment) DumpConsensusState(ctx *rpctypes.Context) (*ctypes.Resul
peers := env.P2PPeers.Peers().List()
peerStates := make([]ctypes.PeerStateInfo, len(peers))
for i, peer := range peers {
peerState, ok := peer.Get(types.PeerStateKey).(*cm.PeerState)
peerState, ok := peer.Get(consensus.PeerStateKey).(*cm.PeerState)
if !ok { // peer does not have a state yet
continue
}
+5 -3
View File
@@ -12,11 +12,13 @@ import (
"github.com/tendermint/tendermint/internal/p2p"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
types "github.com/tendermint/tendermint/pkg/consensus"
"github.com/tendermint/tendermint/pkg/events"
p2ptypes "github.com/tendermint/tendermint/pkg/p2p"
"github.com/tendermint/tendermint/proxy"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/state/indexer"
"github.com/tendermint/tendermint/types"
)
const (
@@ -47,7 +49,7 @@ type Consensus interface {
type transport interface {
Listeners() []string
IsListening() bool
NodeInfo() types.NodeInfo
NodeInfo() p2ptypes.NodeInfo
}
type peers interface {
@@ -79,7 +81,7 @@ type Environment struct {
GenDoc *types.GenesisDoc // cache the genesis structure
EventSinks []indexer.EventSink
ConsensusReactor *consensus.Reactor
EventBus *types.EventBus // thread safe
EventBus *events.EventBus // thread safe
Mempool mempl.Mempool
BlockSyncReactor consensus.BlockSyncReactor
+2 -2
View File
@@ -3,16 +3,16 @@ package core
import (
"fmt"
"github.com/tendermint/tendermint/pkg/evidence"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
// BroadcastEvidence broadcasts evidence of the misbehavior.
// More: https://docs.tendermint.com/master/rpc/#/Evidence/broadcast_evidence
func (env *Environment) BroadcastEvidence(
ctx *rpctypes.Context,
ev types.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
ev evidence.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
if ev == nil {
return nil, fmt.Errorf("%w: no evidence was provided", ctypes.ErrInvalidRequest)
+5 -4
View File
@@ -6,12 +6,13 @@ import (
"fmt"
"time"
abci "github.com/tendermint/tendermint/abci/types"
mempl "github.com/tendermint/tendermint/internal/mempool"
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/pkg/events"
types "github.com/tendermint/tendermint/pkg/mempool"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
//-----------------------------------------------------------------------------
@@ -71,7 +72,7 @@ func (env *Environment) BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*
// Subscribe to tx being committed in block.
subCtx, cancel := context.WithTimeout(ctx.Context(), SubscribeTimeout)
defer cancel()
q := types.EventQueryTxFor(tx)
q := events.EventQueryTxFor(tx)
deliverTxSub, err := env.EventBus.Subscribe(subCtx, subscriber, q)
if err != nil {
err = fmt.Errorf("failed to subscribe to tx: %w", err)
@@ -112,7 +113,7 @@ func (env *Environment) BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*
// Wait for the tx to be included in a block or timeout.
select {
case msg := <-deliverTxSub.Out(): // The tx was included in a block.
deliverTxRes := msg.Data().(types.EventDataTx)
deliverTxRes := msg.Data().(events.EventDataTx)
return &ctypes.ResultBroadcastTxCommit{
CheckTx: *checkTxRes,
DeliverTx: deliverTxRes.Result,
+2 -2
View File
@@ -5,9 +5,9 @@ import (
"time"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/pkg/consensus"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/types"
)
// Status returns Tendermint status including node info, pubkey, latest block
@@ -80,7 +80,7 @@ func (env *Environment) Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, err
return result, nil
}
func (env *Environment) validatorAtHeight(h int64) *types.Validator {
func (env *Environment) validatorAtHeight(h int64) *consensus.Validator {
valsWithH, err := env.StateStore.LoadValidators(h)
if err != nil {
return nil
+4 -4
View File
@@ -7,10 +7,10 @@ import (
tmmath "github.com/tendermint/tendermint/libs/math"
tmquery "github.com/tendermint/tendermint/libs/pubsub/query"
"github.com/tendermint/tendermint/pkg/mempool"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"github.com/tendermint/tendermint/state/indexer"
"github.com/tendermint/tendermint/types"
)
// Tx allows you to query the transaction results. `nil` could mean the
@@ -34,7 +34,7 @@ func (env *Environment) Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*cty
height := r.Height
index := r.Index
var proof types.TxProof
var proof mempool.TxProof
if prove {
block := env.BlockStore.LoadBlock(height)
proof = block.Data.Txs.Proof(int(index)) // XXX: overflow on 32-bit machines
@@ -117,14 +117,14 @@ func (env *Environment) TxSearch(
for i := skipCount; i < skipCount+pageSize; i++ {
r := results[i]
var proof types.TxProof
var proof mempool.TxProof
if prove {
block := env.BlockStore.LoadBlock(r.Height)
proof = block.Data.Txs.Proof(int(r.Index)) // XXX: overflow on 32-bit machines
}
apiResults = append(apiResults, &ctypes.ResultTx{
Hash: types.Tx(r.Tx).Hash(),
Hash: mempool.Tx(r.Tx).Hash(),
Height: r.Height,
Index: r.Index,
TxResult: r.Result,
+32 -27
View File
@@ -5,12 +5,17 @@ import (
"errors"
"time"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/internal/p2p"
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/pkg/abci"
types "github.com/tendermint/tendermint/pkg/block"
"github.com/tendermint/tendermint/pkg/consensus"
"github.com/tendermint/tendermint/pkg/events"
"github.com/tendermint/tendermint/pkg/mempool"
"github.com/tendermint/tendermint/pkg/metadata"
p2ptypes "github.com/tendermint/tendermint/pkg/p2p"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/types"
)
// List of standardized errors used across RPC
@@ -33,7 +38,7 @@ type ResultBlockchainInfo struct {
// Genesis file
type ResultGenesis struct {
Genesis *types.GenesisDoc `json:"genesis"`
Genesis *consensus.GenesisDoc `json:"genesis"`
}
// ResultGenesisChunk is the output format for the chunked/paginated
@@ -48,14 +53,14 @@ type ResultGenesisChunk struct {
// Single block (with meta)
type ResultBlock struct {
BlockID types.BlockID `json:"block_id"`
Block *types.Block `json:"block"`
BlockID metadata.BlockID `json:"block_id"`
Block *types.Block `json:"block"`
}
// Commit and Header
type ResultCommit struct {
types.SignedHeader `json:"signed_header"`
CanonicalCommit bool `json:"canonical"`
metadata.SignedHeader `json:"signed_header"`
CanonicalCommit bool `json:"canonical"`
}
// ABCI results from a block
@@ -71,11 +76,11 @@ type ResultBlockResults struct {
// NewResultCommit is a helper to initialize the ResultCommit with
// the embedded struct
func NewResultCommit(header *types.Header, commit *types.Commit,
func NewResultCommit(header *metadata.Header, commit *metadata.Commit,
canonical bool) *ResultCommit {
return &ResultCommit{
SignedHeader: types.SignedHeader{
SignedHeader: metadata.SignedHeader{
Header: header,
Commit: commit,
},
@@ -112,9 +117,9 @@ type ValidatorInfo struct {
// Node Status
type ResultStatus struct {
NodeInfo types.NodeInfo `json:"node_info"`
SyncInfo SyncInfo `json:"sync_info"`
ValidatorInfo ValidatorInfo `json:"validator_info"`
NodeInfo p2ptypes.NodeInfo `json:"node_info"`
SyncInfo SyncInfo `json:"sync_info"`
ValidatorInfo ValidatorInfo `json:"validator_info"`
}
// Is TxIndexing enabled
@@ -145,7 +150,7 @@ type ResultDialPeers struct {
// A peer
type Peer struct {
NodeInfo types.NodeInfo `json:"node_info"`
NodeInfo p2ptypes.NodeInfo `json:"node_info"`
IsOutbound bool `json:"is_outbound"`
ConnectionStatus p2p.ConnectionStatus `json:"connection_status"`
RemoteIP string `json:"remote_ip"`
@@ -153,8 +158,8 @@ type Peer struct {
// Validators for a height.
type ResultValidators struct {
BlockHeight int64 `json:"block_height"`
Validators []*types.Validator `json:"validators"`
BlockHeight int64 `json:"block_height"`
Validators []*consensus.Validator `json:"validators"`
// Count of actual validators in this result
Count int `json:"count"`
// Total number of validators
@@ -163,8 +168,8 @@ type ResultValidators struct {
// ConsensusParams for given height
type ResultConsensusParams struct {
BlockHeight int64 `json:"block_height"`
ConsensusParams types.ConsensusParams `json:"consensus_params"`
BlockHeight int64 `json:"block_height"`
ConsensusParams consensus.ConsensusParams `json:"consensus_params"`
}
// Info about the consensus state.
@@ -215,8 +220,8 @@ type ResultTx struct {
Height int64 `json:"height"`
Index uint32 `json:"index"`
TxResult abci.ResponseDeliverTx `json:"tx_result"`
Tx types.Tx `json:"tx"`
Proof types.TxProof `json:"proof,omitempty"`
Tx mempool.Tx `json:"tx"`
Proof mempool.TxProof `json:"proof,omitempty"`
}
// Result of searching for txs
@@ -233,10 +238,10 @@ type ResultBlockSearch struct {
// List of mempool txs
type ResultUnconfirmedTxs struct {
Count int `json:"n_txs"`
Total int `json:"total"`
TotalBytes int64 `json:"total_bytes"`
Txs []types.Tx `json:"txs"`
Count int `json:"n_txs"`
Total int `json:"total"`
TotalBytes int64 `json:"total_bytes"`
Txs []mempool.Tx `json:"txs"`
}
// Info abci msg
@@ -265,8 +270,8 @@ type (
// Event data from a subscription
type ResultEvent struct {
SubscriptionID string `json:"subscription_id"`
Query string `json:"query"`
Data types.TMEventData `json:"data"`
Events []abci.Event `json:"events"`
SubscriptionID string `json:"subscription_id"`
Query string `json:"query"`
Data events.TMEventData `json:"data"`
Events []abci.Event `json:"events"`
}
+7 -7
View File
@@ -4,7 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/pkg/p2p"
)
func TestStatusIndexer(t *testing.T) {
@@ -14,17 +14,17 @@ func TestStatusIndexer(t *testing.T) {
status = &ResultStatus{}
assert.False(t, status.TxIndexEnabled())
status.NodeInfo = types.NodeInfo{}
status.NodeInfo = p2p.NodeInfo{}
assert.False(t, status.TxIndexEnabled())
cases := []struct {
expected bool
other types.NodeInfoOther
other p2p.NodeInfoOther
}{
{false, types.NodeInfoOther{}},
{false, types.NodeInfoOther{TxIndex: "aa"}},
{false, types.NodeInfoOther{TxIndex: "off"}},
{true, types.NodeInfoOther{TxIndex: "on"}},
{false, p2p.NodeInfoOther{}},
{false, p2p.NodeInfoOther{TxIndex: "aa"}},
{false, p2p.NodeInfoOther{TxIndex: "off"}},
{true, p2p.NodeInfoOther{TxIndex: "on"}},
}
for _, tc := range cases {
+1 -1
View File
@@ -3,7 +3,7 @@ package coregrpc
import (
"context"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/pkg/abci"
core "github.com/tendermint/tendermint/rpc/core"
rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
context "context"
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
types "github.com/tendermint/tendermint/abci/types"
types "github.com/tendermint/tendermint/pkg/abci"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
+1 -1
View File
@@ -263,7 +263,7 @@ paths:
DeliverTx response.
import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/libs/pubsub/query"
)
+1 -1
View File
@@ -6,12 +6,12 @@ import (
"os"
"time"
abci "github.com/tendermint/tendermint/abci/types"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/log"
tmnet "github.com/tendermint/tendermint/libs/net"
"github.com/tendermint/tendermint/libs/service"
nm "github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/pkg/abci"
"github.com/tendermint/tendermint/proxy"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
core_grpc "github.com/tendermint/tendermint/rpc/grpc"