mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-13 21:31:23 +00:00
replace data.Bytes with cmn.HexBytes
This commit is contained in:
@ -3,8 +3,6 @@ package proxy
|
|||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/tendermint/go-wire/data"
|
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/lite"
|
"github.com/tendermint/tendermint/lite"
|
||||||
"github.com/tendermint/tendermint/lite/client"
|
"github.com/tendermint/tendermint/lite/client"
|
||||||
certerr "github.com/tendermint/tendermint/lite/errors"
|
certerr "github.com/tendermint/tendermint/lite/errors"
|
||||||
@ -34,7 +32,7 @@ type KeyProof interface {
|
|||||||
// If val is empty, proof should be KeyMissingProof
|
// If val is empty, proof should be KeyMissingProof
|
||||||
func GetWithProof(key []byte, reqHeight int64, node rpcclient.Client,
|
func GetWithProof(key []byte, reqHeight int64, node rpcclient.Client,
|
||||||
cert lite.Certifier) (
|
cert lite.Certifier) (
|
||||||
val data.Bytes, height int64, proof KeyProof, err error) {
|
val cmn.HexBytes, height int64, proof KeyProof, err error) {
|
||||||
|
|
||||||
if reqHeight < 0 {
|
if reqHeight < 0 {
|
||||||
err = errors.Errorf("Height cannot be negative")
|
err = errors.Errorf("Height cannot be negative")
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package proxy
|
package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/tendermint/go-wire/data"
|
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/lite"
|
"github.com/tendermint/tendermint/lite"
|
||||||
certclient "github.com/tendermint/tendermint/lite/client"
|
certclient "github.com/tendermint/tendermint/lite/client"
|
||||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||||
@ -34,7 +32,7 @@ func SecureClient(c rpcclient.Client, cert *lite.InquiringCertifier) Wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ABCIQueryWithOptions exposes all options for the ABCI query and verifies the returned proof
|
// ABCIQueryWithOptions exposes all options for the ABCI query and verifies the returned proof
|
||||||
func (w Wrapper) ABCIQueryWithOptions(path string, data data.Bytes,
|
func (w Wrapper) ABCIQueryWithOptions(path string, data cmn.HexBytes,
|
||||||
opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
||||||
|
|
||||||
res, _, err := GetWithProofOptions(path, data, opts, w.Client, w.cert)
|
res, _, err := GetWithProofOptions(path, data, opts, w.Client, w.cert)
|
||||||
@ -42,7 +40,7 @@ func (w Wrapper) ABCIQueryWithOptions(path string, data data.Bytes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ABCIQuery uses default options for the ABCI query and verifies the returned proof
|
// ABCIQuery uses default options for the ABCI query and verifies the returned proof
|
||||||
func (w Wrapper) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error) {
|
func (w Wrapper) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
return w.ABCIQueryWithOptions(path, data, rpcclient.DefaultABCIQueryOptions)
|
return w.ABCIQueryWithOptions(path, data, rpcclient.DefaultABCIQueryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
rpcclient "github.com/tendermint/tendermint/rpc/lib/client"
|
rpcclient "github.com/tendermint/tendermint/rpc/lib/client"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
@ -64,11 +63,11 @@ func (c *HTTP) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HTTP) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error) {
|
func (c *HTTP) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
return c.ABCIQueryWithOptions(path, data, DefaultABCIQueryOptions)
|
return c.ABCIQueryWithOptions(path, data, DefaultABCIQueryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HTTP) ABCIQueryWithOptions(path string, data data.Bytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
func (c *HTTP) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
||||||
result := new(ctypes.ResultABCIQuery)
|
result := new(ctypes.ResultABCIQuery)
|
||||||
_, err := c.rpc.Call("abci_query",
|
_, err := c.rpc.Call("abci_query",
|
||||||
map[string]interface{}{"path": path, "data": data, "height": opts.Height, "trusted": opts.Trusted},
|
map[string]interface{}{"path": path, "data": data, "height": opts.Height, "trusted": opts.Trusted},
|
||||||
|
@ -20,7 +20,6 @@ implementation.
|
|||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
@ -32,8 +31,8 @@ import (
|
|||||||
type ABCIClient interface {
|
type ABCIClient interface {
|
||||||
// reading from abci app
|
// reading from abci app
|
||||||
ABCIInfo() (*ctypes.ResultABCIInfo, error)
|
ABCIInfo() (*ctypes.ResultABCIInfo, error)
|
||||||
ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error)
|
ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)
|
||||||
ABCIQueryWithOptions(path string, data data.Bytes,
|
ABCIQueryWithOptions(path string, data cmn.HexBytes,
|
||||||
opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
|
opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
|
||||||
|
|
||||||
// writing to abci app
|
// writing to abci app
|
||||||
|
@ -3,11 +3,11 @@ package client
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
nm "github.com/tendermint/tendermint/node"
|
nm "github.com/tendermint/tendermint/node"
|
||||||
"github.com/tendermint/tendermint/rpc/core"
|
"github.com/tendermint/tendermint/rpc/core"
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
tmpubsub "github.com/tendermint/tmlibs/pubsub"
|
tmpubsub "github.com/tendermint/tmlibs/pubsub"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,11 +56,11 @@ func (Local) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
return core.ABCIInfo()
|
return core.ABCIInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Local) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error) {
|
func (c *Local) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
return c.ABCIQueryWithOptions(path, data, DefaultABCIQueryOptions)
|
return c.ABCIQueryWithOptions(path, data, DefaultABCIQueryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Local) ABCIQueryWithOptions(path string, data data.Bytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
func (Local) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
||||||
return core.ABCIQuery(path, data, opts.Height, opts.Trusted)
|
return core.ABCIQuery(path, data, opts.Height, opts.Trusted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@ package mock
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
"github.com/tendermint/tendermint/rpc/client"
|
"github.com/tendermint/tendermint/rpc/client"
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
"github.com/tendermint/tendermint/version"
|
"github.com/tendermint/tendermint/version"
|
||||||
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ABCIApp will send all abci related request to the named app,
|
// ABCIApp will send all abci related request to the named app,
|
||||||
@ -26,11 +26,11 @@ func (a ABCIApp) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
return &ctypes.ResultABCIInfo{a.App.Info(abci.RequestInfo{version.Version})}, nil
|
return &ctypes.ResultABCIInfo{a.App.Info(abci.RequestInfo{version.Version})}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a ABCIApp) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error) {
|
func (a ABCIApp) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
return a.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
return a.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a ABCIApp) ABCIQueryWithOptions(path string, data data.Bytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
func (a ABCIApp) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
||||||
q := a.App.Query(abci.RequestQuery{data, path, opts.Height, opts.Trusted})
|
q := a.App.Query(abci.RequestQuery{data, path, opts.Height, opts.Trusted})
|
||||||
return &ctypes.ResultABCIQuery{q}, nil
|
return &ctypes.ResultABCIQuery{q}, nil
|
||||||
}
|
}
|
||||||
@ -81,11 +81,11 @@ func (m ABCIMock) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
return &ctypes.ResultABCIInfo{res.(abci.ResponseInfo)}, nil
|
return &ctypes.ResultABCIInfo{res.(abci.ResponseInfo)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m ABCIMock) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error) {
|
func (m ABCIMock) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
return m.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
return m.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m ABCIMock) ABCIQueryWithOptions(path string, data data.Bytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
func (m ABCIMock) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
||||||
res, err := m.Query.GetResponse(QueryArgs{path, data, opts.Height, opts.Trusted})
|
res, err := m.Query.GetResponse(QueryArgs{path, data, opts.Height, opts.Trusted})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -134,7 +134,7 @@ func NewABCIRecorder(client client.ABCIClient) *ABCIRecorder {
|
|||||||
|
|
||||||
type QueryArgs struct {
|
type QueryArgs struct {
|
||||||
Path string
|
Path string
|
||||||
Data data.Bytes
|
Data cmn.HexBytes
|
||||||
Height int64
|
Height int64
|
||||||
Trusted bool
|
Trusted bool
|
||||||
}
|
}
|
||||||
@ -153,11 +153,11 @@ func (r *ABCIRecorder) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ABCIRecorder) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error) {
|
func (r *ABCIRecorder) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
return r.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
return r.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ABCIRecorder) ABCIQueryWithOptions(path string, data data.Bytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
func (r *ABCIRecorder) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
||||||
res, err := r.Client.ABCIQueryWithOptions(path, data, opts)
|
res, err := r.Client.ABCIQueryWithOptions(path, data, opts)
|
||||||
r.addCall(Call{
|
r.addCall(Call{
|
||||||
Name: "abci_query",
|
Name: "abci_query",
|
||||||
|
@ -11,11 +11,11 @@ import (
|
|||||||
|
|
||||||
"github.com/tendermint/abci/example/dummy"
|
"github.com/tendermint/abci/example/dummy"
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
"github.com/tendermint/tendermint/rpc/client"
|
"github.com/tendermint/tendermint/rpc/client"
|
||||||
"github.com/tendermint/tendermint/rpc/client/mock"
|
"github.com/tendermint/tendermint/rpc/client/mock"
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestABCIMock(t *testing.T) {
|
func TestABCIMock(t *testing.T) {
|
||||||
@ -37,8 +37,8 @@ func TestABCIMock(t *testing.T) {
|
|||||||
BroadcastCommit: mock.Call{
|
BroadcastCommit: mock.Call{
|
||||||
Args: goodTx,
|
Args: goodTx,
|
||||||
Response: &ctypes.ResultBroadcastTxCommit{
|
Response: &ctypes.ResultBroadcastTxCommit{
|
||||||
CheckTx: abci.ResponseCheckTx{Data: data.Bytes("stand")},
|
CheckTx: abci.ResponseCheckTx{Data: cmn.HexBytes("stand")},
|
||||||
DeliverTx: abci.ResponseDeliverTx{Data: data.Bytes("deliver")},
|
DeliverTx: abci.ResponseDeliverTx{Data: cmn.HexBytes("deliver")},
|
||||||
},
|
},
|
||||||
Error: errors.New("bad tx"),
|
Error: errors.New("bad tx"),
|
||||||
},
|
},
|
||||||
@ -98,7 +98,7 @@ func TestABCIRecorder(t *testing.T) {
|
|||||||
_, err := r.ABCIInfo()
|
_, err := r.ABCIInfo()
|
||||||
assert.Nil(err, "expected no err on info")
|
assert.Nil(err, "expected no err on info")
|
||||||
|
|
||||||
_, err = r.ABCIQueryWithOptions("path", data.Bytes("data"), client.ABCIQueryOptions{Trusted: false})
|
_, err = r.ABCIQueryWithOptions("path", cmn.HexBytes("data"), client.ABCIQueryOptions{Trusted: false})
|
||||||
assert.NotNil(err, "expected error on query")
|
assert.NotNil(err, "expected error on query")
|
||||||
require.Equal(2, len(r.Calls))
|
require.Equal(2, len(r.Calls))
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ func TestABCIApp(t *testing.T) {
|
|||||||
assert.True(res.DeliverTx.IsOK())
|
assert.True(res.DeliverTx.IsOK())
|
||||||
|
|
||||||
// check the key
|
// check the key
|
||||||
_qres, err := m.ABCIQueryWithOptions("/key", data.Bytes(key), client.ABCIQueryOptions{Trusted: true})
|
_qres, err := m.ABCIQueryWithOptions("/key", cmn.HexBytes(key), client.ABCIQueryOptions{Trusted: true})
|
||||||
qres := _qres.Response
|
qres := _qres.Response
|
||||||
require.Nil(err)
|
require.Nil(err)
|
||||||
assert.EqualValues(value, qres.Value)
|
assert.EqualValues(value, qres.Value)
|
||||||
|
@ -16,7 +16,6 @@ package mock
|
|||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
"github.com/tendermint/tendermint/rpc/client"
|
"github.com/tendermint/tendermint/rpc/client"
|
||||||
"github.com/tendermint/tendermint/rpc/core"
|
"github.com/tendermint/tendermint/rpc/core"
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
@ -83,11 +82,11 @@ func (c Client) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
return core.ABCIInfo()
|
return core.ABCIInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error) {
|
func (c Client) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
return c.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
return c.ABCIQueryWithOptions(path, data, client.DefaultABCIQueryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) ABCIQueryWithOptions(path string, data data.Bytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
func (c Client) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
|
||||||
return core.ABCIQuery(path, data, opts.Height, opts.Trusted)
|
return core.ABCIQuery(path, data, opts.Height, opts.Trusted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
"github.com/tendermint/tendermint/rpc/client/mock"
|
"github.com/tendermint/tendermint/rpc/client/mock"
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestStatus(t *testing.T) {
|
func TestStatus(t *testing.T) {
|
||||||
@ -17,8 +17,8 @@ func TestStatus(t *testing.T) {
|
|||||||
m := &mock.StatusMock{
|
m := &mock.StatusMock{
|
||||||
Call: mock.Call{
|
Call: mock.Call{
|
||||||
Response: &ctypes.ResultStatus{
|
Response: &ctypes.ResultStatus{
|
||||||
LatestBlockHash: data.Bytes("block"),
|
LatestBlockHash: cmn.HexBytes("block"),
|
||||||
LatestAppHash: data.Bytes("app"),
|
LatestAppHash: cmn.HexBytes("app"),
|
||||||
LatestBlockHeight: 10,
|
LatestBlockHeight: 10,
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package core
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/version"
|
"github.com/tendermint/tendermint/version"
|
||||||
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Query the application for some information.
|
// Query the application for some information.
|
||||||
@ -47,7 +47,7 @@ import (
|
|||||||
// | data | []byte | false | true | Data |
|
// | data | []byte | false | true | Data |
|
||||||
// | height | int64 | 0 | false | Height (0 means latest) |
|
// | height | int64 | 0 | false | Height (0 means latest) |
|
||||||
// | trusted | bool | false | false | Does not include a proof of the data inclusion |
|
// | trusted | bool | false | false | Does not include a proof of the data inclusion |
|
||||||
func ABCIQuery(path string, data data.Bytes, height int64, trusted bool) (*ctypes.ResultABCIQuery, error) {
|
func ABCIQuery(path string, data cmn.HexBytes, height int64, trusted bool) (*ctypes.ResultABCIQuery, error) {
|
||||||
resQuery, err := proxyAppQuery.QuerySync(abci.RequestQuery{
|
resQuery, err := proxyAppQuery.QuerySync(abci.RequestQuery{
|
||||||
Path: path,
|
Path: path,
|
||||||
Data: data,
|
Data: data,
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -192,7 +192,7 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
|||||||
deliverTxRes := deliverTxResMsg.(types.TMEventData).Unwrap().(types.EventDataTx)
|
deliverTxRes := deliverTxResMsg.(types.TMEventData).Unwrap().(types.EventDataTx)
|
||||||
// The tx was included in a block.
|
// The tx was included in a block.
|
||||||
deliverTxR := deliverTxRes.Result
|
deliverTxR := deliverTxRes.Result
|
||||||
logger.Info("DeliverTx passed ", "tx", data.Bytes(tx), "response", deliverTxR)
|
logger.Info("DeliverTx passed ", "tx", cmn.HexBytes(tx), "response", deliverTxR)
|
||||||
return &ctypes.ResultBroadcastTxCommit{
|
return &ctypes.ResultBroadcastTxCommit{
|
||||||
CheckTx: *checkTxR,
|
CheckTx: *checkTxR,
|
||||||
DeliverTx: deliverTxR,
|
DeliverTx: deliverTxR,
|
||||||
|
@ -3,9 +3,9 @@ package core
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get Tendermint status including node info, pubkey, latest block
|
// Get Tendermint status including node info, pubkey, latest block
|
||||||
@ -59,8 +59,8 @@ func Status() (*ctypes.ResultStatus, error) {
|
|||||||
latestHeight := blockStore.Height()
|
latestHeight := blockStore.Height()
|
||||||
var (
|
var (
|
||||||
latestBlockMeta *types.BlockMeta
|
latestBlockMeta *types.BlockMeta
|
||||||
latestBlockHash data.Bytes
|
latestBlockHash cmn.HexBytes
|
||||||
latestAppHash data.Bytes
|
latestAppHash cmn.HexBytes
|
||||||
latestBlockTimeNano int64
|
latestBlockTimeNano int64
|
||||||
)
|
)
|
||||||
if latestHeight != 0 {
|
if latestHeight != 0 {
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
|
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
crypto "github.com/tendermint/go-crypto"
|
crypto "github.com/tendermint/go-crypto"
|
||||||
"github.com/tendermint/go-wire/data"
|
|
||||||
cstypes "github.com/tendermint/tendermint/consensus/types"
|
cstypes "github.com/tendermint/tendermint/consensus/types"
|
||||||
"github.com/tendermint/tendermint/p2p"
|
"github.com/tendermint/tendermint/p2p"
|
||||||
"github.com/tendermint/tendermint/state"
|
"github.com/tendermint/tendermint/state"
|
||||||
@ -56,8 +55,8 @@ func NewResultCommit(header *types.Header, commit *types.Commit,
|
|||||||
type ResultStatus struct {
|
type ResultStatus struct {
|
||||||
NodeInfo p2p.NodeInfo `json:"node_info"`
|
NodeInfo p2p.NodeInfo `json:"node_info"`
|
||||||
PubKey crypto.PubKey `json:"pub_key"`
|
PubKey crypto.PubKey `json:"pub_key"`
|
||||||
LatestBlockHash data.Bytes `json:"latest_block_hash"`
|
LatestBlockHash cmn.HexBytes `json:"latest_block_hash"`
|
||||||
LatestAppHash data.Bytes `json:"latest_app_hash"`
|
LatestAppHash cmn.HexBytes `json:"latest_app_hash"`
|
||||||
LatestBlockHeight int64 `json:"latest_block_height"`
|
LatestBlockHeight int64 `json:"latest_block_height"`
|
||||||
LatestBlockTime time.Time `json:"latest_block_time"`
|
LatestBlockTime time.Time `json:"latest_block_time"`
|
||||||
Syncing bool `json:"syncing"`
|
Syncing bool `json:"syncing"`
|
||||||
@ -107,17 +106,17 @@ type ResultDumpConsensusState struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ResultBroadcastTx struct {
|
type ResultBroadcastTx struct {
|
||||||
Code uint32 `json:"code"`
|
Code uint32 `json:"code"`
|
||||||
Data data.Bytes `json:"data"`
|
Data cmn.HexBytes `json:"data"`
|
||||||
Log string `json:"log"`
|
Log string `json:"log"`
|
||||||
|
|
||||||
Hash data.Bytes `json:"hash"`
|
Hash cmn.HexBytes `json:"hash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultBroadcastTxCommit struct {
|
type ResultBroadcastTxCommit struct {
|
||||||
CheckTx abci.ResponseCheckTx `json:"check_tx"`
|
CheckTx abci.ResponseCheckTx `json:"check_tx"`
|
||||||
DeliverTx abci.ResponseDeliverTx `json:"deliver_tx"`
|
DeliverTx abci.ResponseDeliverTx `json:"deliver_tx"`
|
||||||
Hash data.Bytes `json:"hash"`
|
Hash cmn.HexBytes `json:"hash"`
|
||||||
Height int64 `json:"height"`
|
Height int64 `json:"height"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/tendermint/go-wire/data"
|
|
||||||
client "github.com/tendermint/tendermint/rpc/lib/client"
|
client "github.com/tendermint/tendermint/rpc/lib/client"
|
||||||
server "github.com/tendermint/tendermint/rpc/lib/server"
|
server "github.com/tendermint/tendermint/rpc/lib/server"
|
||||||
types "github.com/tendermint/tendermint/rpc/lib/types"
|
types "github.com/tendermint/tendermint/rpc/lib/types"
|
||||||
@ -47,7 +46,7 @@ type ResultEchoBytes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ResultEchoDataBytes struct {
|
type ResultEchoDataBytes struct {
|
||||||
Value data.Bytes `json:"value"`
|
Value cmn.HexBytes `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define some routes
|
// Define some routes
|
||||||
@ -75,7 +74,7 @@ func EchoBytesResult(v []byte) (*ResultEchoBytes, error) {
|
|||||||
return &ResultEchoBytes{v}, nil
|
return &ResultEchoBytes{v}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func EchoDataBytesResult(v data.Bytes) (*ResultEchoDataBytes, error) {
|
func EchoDataBytesResult(v cmn.HexBytes) (*ResultEchoDataBytes, error) {
|
||||||
return &ResultEchoDataBytes{v}, nil
|
return &ResultEchoDataBytes{v}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +173,7 @@ func echoBytesViaHTTP(cl client.HTTPClient, bytes []byte) ([]byte, error) {
|
|||||||
return result.Value, nil
|
return result.Value, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func echoDataBytesViaHTTP(cl client.HTTPClient, bytes data.Bytes) (data.Bytes, error) {
|
func echoDataBytesViaHTTP(cl client.HTTPClient, bytes cmn.HexBytes) (cmn.HexBytes, error) {
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
"arg": bytes,
|
"arg": bytes,
|
||||||
}
|
}
|
||||||
@ -196,7 +195,7 @@ func testWithHTTPClient(t *testing.T, cl client.HTTPClient) {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
assert.Equal(t, got2, val2)
|
assert.Equal(t, got2, val2)
|
||||||
|
|
||||||
val3 := data.Bytes(randBytes(t))
|
val3 := cmn.HexBytes(randBytes(t))
|
||||||
got3, err := echoDataBytesViaHTTP(cl, val3)
|
got3, err := echoDataBytesViaHTTP(cl, val3)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
assert.Equal(t, got3, val3)
|
assert.Equal(t, got3, val3)
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/tendermint/go-wire/data"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParseJSONMap(t *testing.T) {
|
func TestParseJSONMap(t *testing.T) {
|
||||||
@ -31,7 +31,7 @@ func TestParseJSONMap(t *testing.T) {
|
|||||||
// preloading map with values doesn't help
|
// preloading map with values doesn't help
|
||||||
tmp := 0
|
tmp := 0
|
||||||
p2 := map[string]interface{}{
|
p2 := map[string]interface{}{
|
||||||
"value": &data.Bytes{},
|
"value": &cmn.HexBytes{},
|
||||||
"height": &tmp,
|
"height": &tmp,
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(input, &p2)
|
err = json.Unmarshal(input, &p2)
|
||||||
@ -54,7 +54,7 @@ func TestParseJSONMap(t *testing.T) {
|
|||||||
Height interface{} `json:"height"`
|
Height interface{} `json:"height"`
|
||||||
}{
|
}{
|
||||||
Height: &tmp,
|
Height: &tmp,
|
||||||
Value: &data.Bytes{},
|
Value: &cmn.HexBytes{},
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(input, &p3)
|
err = json.Unmarshal(input, &p3)
|
||||||
if assert.Nil(err) {
|
if assert.Nil(err) {
|
||||||
@ -62,7 +62,7 @@ func TestParseJSONMap(t *testing.T) {
|
|||||||
if assert.True(ok, "%#v", p3.Height) {
|
if assert.True(ok, "%#v", p3.Height) {
|
||||||
assert.Equal(22, *h)
|
assert.Equal(22, *h)
|
||||||
}
|
}
|
||||||
v, ok := p3.Value.(*data.Bytes)
|
v, ok := p3.Value.(*cmn.HexBytes)
|
||||||
if assert.True(ok, "%#v", p3.Value) {
|
if assert.True(ok, "%#v", p3.Value) {
|
||||||
assert.EqualValues([]byte{0x12, 0x34}, *v)
|
assert.EqualValues([]byte{0x12, 0x34}, *v)
|
||||||
}
|
}
|
||||||
@ -70,8 +70,8 @@ func TestParseJSONMap(t *testing.T) {
|
|||||||
|
|
||||||
// simplest solution, but hard-coded
|
// simplest solution, but hard-coded
|
||||||
p4 := struct {
|
p4 := struct {
|
||||||
Value data.Bytes `json:"value"`
|
Value cmn.HexBytes `json:"value"`
|
||||||
Height int `json:"height"`
|
Height int `json:"height"`
|
||||||
}{}
|
}{}
|
||||||
err = json.Unmarshal(input, &p4)
|
err = json.Unmarshal(input, &p4)
|
||||||
if assert.Nil(err) {
|
if assert.Nil(err) {
|
||||||
@ -90,10 +90,10 @@ func TestParseJSONMap(t *testing.T) {
|
|||||||
assert.Equal(22, h)
|
assert.Equal(22, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
var v data.Bytes
|
var v cmn.HexBytes
|
||||||
err = json.Unmarshal(*p5["value"], &v)
|
err = json.Unmarshal(*p5["value"], &v)
|
||||||
if assert.Nil(err) {
|
if assert.Nil(err) {
|
||||||
assert.Equal(data.Bytes{0x12, 0x34}, v)
|
assert.Equal(cmn.HexBytes{0x12, 0x34}, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,10 +119,10 @@ func TestParseJSONArray(t *testing.T) {
|
|||||||
|
|
||||||
// preloading map with values helps here (unlike map - p2 above)
|
// preloading map with values helps here (unlike map - p2 above)
|
||||||
tmp := 0
|
tmp := 0
|
||||||
p2 := []interface{}{&data.Bytes{}, &tmp}
|
p2 := []interface{}{&cmn.HexBytes{}, &tmp}
|
||||||
err = json.Unmarshal(input, &p2)
|
err = json.Unmarshal(input, &p2)
|
||||||
if assert.Nil(err) {
|
if assert.Nil(err) {
|
||||||
v, ok := p2[0].(*data.Bytes)
|
v, ok := p2[0].(*cmn.HexBytes)
|
||||||
if assert.True(ok, "%#v", p2[0]) {
|
if assert.True(ok, "%#v", p2[0]) {
|
||||||
assert.EqualValues([]byte{0x12, 0x34}, *v)
|
assert.EqualValues([]byte{0x12, 0x34}, *v)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
wire "github.com/tendermint/go-wire"
|
wire "github.com/tendermint/go-wire"
|
||||||
"github.com/tendermint/go-wire/data"
|
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
"github.com/tendermint/tmlibs/merkle"
|
"github.com/tendermint/tmlibs/merkle"
|
||||||
"golang.org/x/crypto/ripemd160"
|
"golang.org/x/crypto/ripemd160"
|
||||||
@ -86,7 +85,7 @@ func (b *Block) FillHeader() {
|
|||||||
|
|
||||||
// Hash computes and returns the block hash.
|
// Hash computes and returns the block hash.
|
||||||
// If the block is incomplete, block hash is nil for safety.
|
// If the block is incomplete, block hash is nil for safety.
|
||||||
func (b *Block) Hash() data.Bytes {
|
func (b *Block) Hash() cmn.HexBytes {
|
||||||
if b == nil || b.Header == nil || b.Data == nil || b.LastCommit == nil {
|
if b == nil || b.Header == nil || b.Data == nil || b.LastCommit == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -161,22 +160,22 @@ type Header struct {
|
|||||||
TotalTxs int64 `json:"total_txs"`
|
TotalTxs int64 `json:"total_txs"`
|
||||||
|
|
||||||
// hashes of block data
|
// hashes of block data
|
||||||
LastCommitHash data.Bytes `json:"last_commit_hash"` // commit from validators from the last block
|
LastCommitHash cmn.HexBytes `json:"last_commit_hash"` // commit from validators from the last block
|
||||||
DataHash data.Bytes `json:"data_hash"` // transactions
|
DataHash cmn.HexBytes `json:"data_hash"` // transactions
|
||||||
|
|
||||||
// hashes from the app output from the prev block
|
// hashes from the app output from the prev block
|
||||||
ValidatorsHash data.Bytes `json:"validators_hash"` // validators for the current block
|
ValidatorsHash cmn.HexBytes `json:"validators_hash"` // validators for the current block
|
||||||
ConsensusHash data.Bytes `json:"consensus_hash"` // consensus params for current block
|
ConsensusHash cmn.HexBytes `json:"consensus_hash"` // consensus params for current block
|
||||||
AppHash data.Bytes `json:"app_hash"` // state after txs from the previous block
|
AppHash cmn.HexBytes `json:"app_hash"` // state after txs from the previous block
|
||||||
LastResultsHash data.Bytes `json:"last_results_hash"` // root hash of all results from the txs from the previous block
|
LastResultsHash cmn.HexBytes `json:"last_results_hash"` // root hash of all results from the txs from the previous block
|
||||||
|
|
||||||
// consensus info
|
// consensus info
|
||||||
EvidenceHash data.Bytes `json:"evidence_hash"` // evidence included in the block
|
EvidenceHash cmn.HexBytes `json:"evidence_hash"` // evidence included in the block
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash returns the hash of the header.
|
// Hash returns the hash of the header.
|
||||||
// Returns nil if ValidatorHash is missing.
|
// Returns nil if ValidatorHash is missing.
|
||||||
func (h *Header) Hash() data.Bytes {
|
func (h *Header) Hash() cmn.HexBytes {
|
||||||
if len(h.ValidatorsHash) == 0 {
|
if len(h.ValidatorsHash) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -246,7 +245,7 @@ type Commit struct {
|
|||||||
|
|
||||||
// Volatile
|
// Volatile
|
||||||
firstPrecommit *Vote
|
firstPrecommit *Vote
|
||||||
hash data.Bytes
|
hash cmn.HexBytes
|
||||||
bitArray *cmn.BitArray
|
bitArray *cmn.BitArray
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +354,7 @@ func (commit *Commit) ValidateBasic() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hash returns the hash of the commit
|
// Hash returns the hash of the commit
|
||||||
func (commit *Commit) Hash() data.Bytes {
|
func (commit *Commit) Hash() cmn.HexBytes {
|
||||||
if commit.hash == nil {
|
if commit.hash == nil {
|
||||||
bs := make([]merkle.Hasher, len(commit.Precommits))
|
bs := make([]merkle.Hasher, len(commit.Precommits))
|
||||||
for i, precommit := range commit.Precommits {
|
for i, precommit := range commit.Precommits {
|
||||||
@ -403,11 +402,11 @@ type Data struct {
|
|||||||
Txs Txs `json:"txs"`
|
Txs Txs `json:"txs"`
|
||||||
|
|
||||||
// Volatile
|
// Volatile
|
||||||
hash data.Bytes
|
hash cmn.HexBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash returns the hash of the data
|
// Hash returns the hash of the data
|
||||||
func (data *Data) Hash() data.Bytes {
|
func (data *Data) Hash() cmn.HexBytes {
|
||||||
if data.hash == nil {
|
if data.hash == nil {
|
||||||
data.hash = data.Txs.Hash() // NOTE: leaves of merkle tree are TxIDs
|
data.hash = data.Txs.Hash() // NOTE: leaves of merkle tree are TxIDs
|
||||||
}
|
}
|
||||||
@ -441,11 +440,11 @@ type EvidenceData struct {
|
|||||||
Evidence EvidenceList `json:"evidence"`
|
Evidence EvidenceList `json:"evidence"`
|
||||||
|
|
||||||
// Volatile
|
// Volatile
|
||||||
hash data.Bytes
|
hash cmn.HexBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash returns the hash of the data.
|
// Hash returns the hash of the data.
|
||||||
func (data *EvidenceData) Hash() data.Bytes {
|
func (data *EvidenceData) Hash() cmn.HexBytes {
|
||||||
if data.hash == nil {
|
if data.hash == nil {
|
||||||
data.hash = data.Evidence.Hash()
|
data.hash = data.Evidence.Hash()
|
||||||
}
|
}
|
||||||
@ -477,7 +476,7 @@ func (data *EvidenceData) StringIndented(indent string) string {
|
|||||||
|
|
||||||
// BlockID defines the unique ID of a block as its Hash and its PartSetHeader
|
// BlockID defines the unique ID of a block as its Hash and its PartSetHeader
|
||||||
type BlockID struct {
|
type BlockID struct {
|
||||||
Hash data.Bytes `json:"hash"`
|
Hash cmn.HexBytes `json:"hash"`
|
||||||
PartsHeader PartSetHeader `json:"parts"`
|
PartsHeader PartSetHeader `json:"parts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
wire "github.com/tendermint/go-wire"
|
wire "github.com/tendermint/go-wire"
|
||||||
"github.com/tendermint/go-wire/data"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// canonical json is go-wire's json for structs with fields in alphabetical order
|
// canonical json is go-wire's json for structs with fields in alphabetical order
|
||||||
@ -13,13 +13,13 @@ import (
|
|||||||
const timeFormat = wire.RFC3339Millis
|
const timeFormat = wire.RFC3339Millis
|
||||||
|
|
||||||
type CanonicalJSONBlockID struct {
|
type CanonicalJSONBlockID struct {
|
||||||
Hash data.Bytes `json:"hash,omitempty"`
|
Hash cmn.HexBytes `json:"hash,omitempty"`
|
||||||
PartsHeader CanonicalJSONPartSetHeader `json:"parts,omitempty"`
|
PartsHeader CanonicalJSONPartSetHeader `json:"parts,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CanonicalJSONPartSetHeader struct {
|
type CanonicalJSONPartSetHeader struct {
|
||||||
Hash data.Bytes `json:"hash"`
|
Hash cmn.HexBytes `json:"hash"`
|
||||||
Total int `json:"total"`
|
Total int `json:"total"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CanonicalJSONProposal struct {
|
type CanonicalJSONProposal struct {
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
crypto "github.com/tendermint/go-crypto"
|
crypto "github.com/tendermint/go-crypto"
|
||||||
"github.com/tendermint/go-wire/data"
|
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ type GenesisDoc struct {
|
|||||||
ChainID string `json:"chain_id"`
|
ChainID string `json:"chain_id"`
|
||||||
ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"`
|
ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"`
|
||||||
Validators []GenesisValidator `json:"validators"`
|
Validators []GenesisValidator `json:"validators"`
|
||||||
AppHash data.Bytes `json:"app_hash"`
|
AppHash cmn.HexBytes `json:"app_hash"`
|
||||||
AppOptions interface{} `json:"app_options,omitempty"`
|
AppOptions interface{} `json:"app_options,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"golang.org/x/crypto/ripemd160"
|
"golang.org/x/crypto/ripemd160"
|
||||||
|
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
"github.com/tendermint/go-wire/data"
|
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
"github.com/tendermint/tmlibs/merkle"
|
"github.com/tendermint/tmlibs/merkle"
|
||||||
)
|
)
|
||||||
@ -22,7 +21,7 @@ var (
|
|||||||
|
|
||||||
type Part struct {
|
type Part struct {
|
||||||
Index int `json:"index"`
|
Index int `json:"index"`
|
||||||
Bytes data.Bytes `json:"bytes"`
|
Bytes cmn.HexBytes `json:"bytes"`
|
||||||
Proof merkle.SimpleProof `json:"proof"`
|
Proof merkle.SimpleProof `json:"proof"`
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
@ -58,8 +57,8 @@ func (part *Part) StringIndented(indent string) string {
|
|||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
type PartSetHeader struct {
|
type PartSetHeader struct {
|
||||||
Total int `json:"total"`
|
Total int `json:"total"`
|
||||||
Hash data.Bytes `json:"hash"`
|
Hash cmn.HexBytes `json:"hash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (psh PartSetHeader) String() string {
|
func (psh PartSetHeader) String() string {
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
crypto "github.com/tendermint/go-crypto"
|
crypto "github.com/tendermint/go-crypto"
|
||||||
data "github.com/tendermint/go-wire/data"
|
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,13 +49,13 @@ type PrivValidator interface {
|
|||||||
// to prevent double signing. The Signer itself can be mutated to use
|
// to prevent double signing. The Signer itself can be mutated to use
|
||||||
// something besides the default, for instance a hardware signer.
|
// something besides the default, for instance a hardware signer.
|
||||||
type PrivValidatorFS struct {
|
type PrivValidatorFS struct {
|
||||||
Address Address `json:"address"`
|
Address Address `json:"address"`
|
||||||
PubKey crypto.PubKey `json:"pub_key"`
|
PubKey crypto.PubKey `json:"pub_key"`
|
||||||
LastHeight int64 `json:"last_height"`
|
LastHeight int64 `json:"last_height"`
|
||||||
LastRound int `json:"last_round"`
|
LastRound int `json:"last_round"`
|
||||||
LastStep int8 `json:"last_step"`
|
LastStep int8 `json:"last_step"`
|
||||||
LastSignature crypto.Signature `json:"last_signature,omitempty"` // so we dont lose signatures
|
LastSignature crypto.Signature `json:"last_signature,omitempty"` // so we dont lose signatures
|
||||||
LastSignBytes data.Bytes `json:"last_signbytes,omitempty"` // so we dont lose signatures
|
LastSignBytes cmn.HexBytes `json:"last_signbytes,omitempty"` // so we dont lose signatures
|
||||||
|
|
||||||
// PrivKey should be empty if a Signer other than the default is being used.
|
// PrivKey should be empty if a Signer other than the default is being used.
|
||||||
PrivKey crypto.PrivKey `json:"priv_key"`
|
PrivKey crypto.PrivKey `json:"priv_key"`
|
||||||
|
@ -3,7 +3,7 @@ package types
|
|||||||
import (
|
import (
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
wire "github.com/tendermint/go-wire"
|
wire "github.com/tendermint/go-wire"
|
||||||
"github.com/tendermint/go-wire/data"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
"github.com/tendermint/tmlibs/merkle"
|
"github.com/tendermint/tmlibs/merkle"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,8 +12,8 @@ import (
|
|||||||
// ABCIResult is the deterministic component of a ResponseDeliverTx.
|
// ABCIResult is the deterministic component of a ResponseDeliverTx.
|
||||||
// TODO: add Tags
|
// TODO: add Tags
|
||||||
type ABCIResult struct {
|
type ABCIResult struct {
|
||||||
Code uint32 `json:"code"`
|
Code uint32 `json:"code"`
|
||||||
Data data.Bytes `json:"data"`
|
Data cmn.HexBytes `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash returns the canonical hash of the ABCIResult
|
// Hash returns the canonical hash of the ABCIResult
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
"github.com/tendermint/go-wire/data"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
"github.com/tendermint/tmlibs/merkle"
|
"github.com/tendermint/tmlibs/merkle"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ func (txs Txs) Proof(i int) TxProof {
|
|||||||
// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.
|
// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.
|
||||||
type TxProof struct {
|
type TxProof struct {
|
||||||
Index, Total int
|
Index, Total int
|
||||||
RootHash data.Bytes
|
RootHash cmn.HexBytes
|
||||||
Data Tx
|
Data Tx
|
||||||
Proof merkle.SimpleProof
|
Proof merkle.SimpleProof
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user