remove gogoproto
This commit is contained in:
parent
cfdec76020
commit
01f87fd8d3
|
@ -29,26 +29,15 @@
|
||||||
revision = "259ab82a6cad3992b4e21ff5cac294ccb06474bc"
|
revision = "259ab82a6cad3992b4e21ff5cac294ccb06474bc"
|
||||||
version = "v1.7.0"
|
version = "v1.7.0"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/gogo/protobuf"
|
|
||||||
packages = [
|
|
||||||
"gogoproto",
|
|
||||||
"jsonpb",
|
|
||||||
"proto",
|
|
||||||
"protoc-gen-gogo/descriptor",
|
|
||||||
"sortkeys",
|
|
||||||
"types"
|
|
||||||
]
|
|
||||||
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
|
|
||||||
version = "v1.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/golang/protobuf"
|
name = "github.com/golang/protobuf"
|
||||||
packages = [
|
packages = [
|
||||||
|
"jsonpb",
|
||||||
"proto",
|
"proto",
|
||||||
"ptypes",
|
"ptypes",
|
||||||
"ptypes/any",
|
"ptypes/any",
|
||||||
"ptypes/duration",
|
"ptypes/duration",
|
||||||
|
"ptypes/struct",
|
||||||
"ptypes/timestamp"
|
"ptypes/timestamp"
|
||||||
]
|
]
|
||||||
revision = "925541529c1fa6821df4e44ce2723319eb2be768"
|
revision = "925541529c1fa6821df4e44ce2723319eb2be768"
|
||||||
|
@ -58,7 +47,7 @@
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/golang/snappy"
|
name = "github.com/golang/snappy"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "553a641470496b2327abcac10b36396bd98e45c9"
|
revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/inconshreveable/mousetrap"
|
name = "github.com/inconshreveable/mousetrap"
|
||||||
|
@ -93,14 +82,14 @@
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/spf13/cobra"
|
name = "github.com/spf13/cobra"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "a1f051bc3eba734da4772d60e2d677f47cf93ef4"
|
revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385"
|
||||||
version = "v0.0.2"
|
version = "v0.0.3"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/spf13/pflag"
|
name = "github.com/spf13/pflag"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66"
|
revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
|
||||||
version = "v1.0.0"
|
version = "v1.0.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/stretchr/testify"
|
name = "github.com/stretchr/testify"
|
||||||
|
@ -128,31 +117,31 @@
|
||||||
"leveldb/table",
|
"leveldb/table",
|
||||||
"leveldb/util"
|
"leveldb/util"
|
||||||
]
|
]
|
||||||
revision = "714f901b98fdb3aa954b4193d8cbd64a28d80cad"
|
revision = "5d6fca44a948d2be89a9702de7717f0168403d3d"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
branch = "bucky/no-gogo"
|
||||||
name = "github.com/tendermint/tmlibs"
|
name = "github.com/tendermint/tmlibs"
|
||||||
packages = [
|
packages = [
|
||||||
"common",
|
"common",
|
||||||
"db",
|
"db",
|
||||||
"log"
|
"log"
|
||||||
]
|
]
|
||||||
revision = "2e24b64fc121dcdf1cabceab8dc2f7257675483c"
|
revision = "d24a30858e23ace7aeee306e2ce652aba8021631"
|
||||||
version = "v0.8.1"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "golang.org/x/net"
|
name = "golang.org/x/net"
|
||||||
packages = [
|
packages = [
|
||||||
"context",
|
"context",
|
||||||
|
"http/httpguts",
|
||||||
"http2",
|
"http2",
|
||||||
"http2/hpack",
|
"http2/hpack",
|
||||||
"idna",
|
"idna",
|
||||||
"internal/timeseries",
|
"internal/timeseries",
|
||||||
"lex/httplex",
|
|
||||||
"trace"
|
"trace"
|
||||||
]
|
]
|
||||||
revision = "61147c48b25b599e5b561d2e9c4f3e1ef489ca41"
|
revision = "9ef9f5bb98a1fdc41f8cf6c250a4404b4085e389"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "golang.org/x/text"
|
name = "golang.org/x/text"
|
||||||
|
@ -176,10 +165,9 @@
|
||||||
version = "v0.3.0"
|
version = "v0.3.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
|
||||||
name = "google.golang.org/genproto"
|
name = "google.golang.org/genproto"
|
||||||
packages = ["googleapis/rpc/status"]
|
packages = ["googleapis/rpc/status"]
|
||||||
revision = "ce84044298496ef4b54b4a0a0909ba593cc60e30"
|
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "google.golang.org/grpc"
|
name = "google.golang.org/grpc"
|
||||||
|
@ -208,6 +196,6 @@
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "e42d4a691fb0d0db9c717394e580dd00b36ba9e185541f99fc56689338470123"
|
inputs-digest = "e0b98059927fe32f1398b66d5d3464fac7d0b4c011855863a04f21b5bd8b7032"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
|
11
Gopkg.toml
11
Gopkg.toml
|
@ -32,7 +32,7 @@
|
||||||
# Use `~` for only minor version bumps.
|
# Use `~` for only minor version bumps.
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/gogo/protobuf"
|
name = "github.com/golang/protobuf"
|
||||||
version = "~1.0.0"
|
version = "~1.0.0"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
|
@ -45,12 +45,19 @@
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/tendermint/tmlibs"
|
name = "github.com/tendermint/tmlibs"
|
||||||
version = "0.8.1"
|
branch = "bucky/no-gogo"
|
||||||
|
# version = "0.8.1"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "google.golang.org/grpc"
|
name = "google.golang.org/grpc"
|
||||||
version = "~1.7.3"
|
version = "~1.7.3"
|
||||||
|
|
||||||
|
# this got updated and broke, so locked to an old working commit ...
|
||||||
|
[[override]]
|
||||||
|
name = "google.golang.org/genproto"
|
||||||
|
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
|
||||||
|
|
||||||
|
|
||||||
[prune]
|
[prune]
|
||||||
go-tests = true
|
go-tests = true
|
||||||
unused-packages = true
|
unused-packages = true
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -2,11 +2,10 @@ GOTOOLS = \
|
||||||
github.com/mitchellh/gox \
|
github.com/mitchellh/gox \
|
||||||
github.com/golang/dep/cmd/dep \
|
github.com/golang/dep/cmd/dep \
|
||||||
gopkg.in/alecthomas/gometalinter.v2 \
|
gopkg.in/alecthomas/gometalinter.v2 \
|
||||||
github.com/gogo/protobuf/protoc-gen-gogo \
|
github.com/golang/protobuf/protoc-gen-go \
|
||||||
github.com/gogo/protobuf/gogoproto
|
GOTOOLS_CHECK = gox dep gometalinter.v2 protoc protoc-gen-go
|
||||||
GOTOOLS_CHECK = gox dep gometalinter.v2 protoc protoc-gen-gogo
|
|
||||||
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
||||||
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
|
INCLUDE = -I=. -I=${GOPATH}/src
|
||||||
|
|
||||||
all: check get_vendor_deps protoc build test install metalinter
|
all: check get_vendor_deps protoc build test install metalinter
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ protoc:
|
||||||
## If you get the following error,
|
## If you get the following error,
|
||||||
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
|
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
|
||||||
## See https://stackoverflow.com/a/25518702
|
## See https://stackoverflow.com/a/25518702
|
||||||
protoc $(INCLUDE) --gogo_out=plugins=grpc:. types/*.proto
|
protoc $(INCLUDE) --go_out=plugins=grpc:. types/*.proto
|
||||||
@echo "--> adding nolint declarations to protobuf generated files"
|
@echo "--> adding nolint declarations to protobuf generated files"
|
||||||
@awk '/package types/ { print "//nolint: gas"; print; next }1' types/types.pb.go > types/types.pb.go.new
|
@awk '/package types/ { print "//nolint: gas"; print; next }1' types/types.pb.go > types/types.pb.go.new
|
||||||
@mv types/types.pb.go.new types/types.pb.go
|
@mv types/types.pb.go.new types/types.pb.go
|
||||||
|
|
|
@ -129,7 +129,7 @@ func (app *PersistentKVStoreApplication) Validators() (validators []types.Valida
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeValSetChangeTx(pubkey types.PubKey, power int64) []byte {
|
func MakeValSetChangeTx(pubkey *types.PubKey, power int64) []byte {
|
||||||
return []byte(cmn.Fmt("val:%X/%d", pubkey.Data, power))
|
return []byte(cmn.Fmt("val:%X/%d", pubkey.Data, power))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,12 @@ import (
|
||||||
|
|
||||||
func InitChain(client abcicli.Client) error {
|
func InitChain(client abcicli.Client) error {
|
||||||
total := 10
|
total := 10
|
||||||
vals := make([]types.Validator, total)
|
vals := make([]*types.Validator, total)
|
||||||
for i := 0; i < total; i++ {
|
for i := 0; i < total; i++ {
|
||||||
pubkey := cmn.RandBytes(33)
|
pubkey := cmn.RandBytes(33)
|
||||||
power := cmn.RandInt()
|
power := cmn.RandInt()
|
||||||
vals[i] = types.Ed25519Validator(pubkey, int64(power))
|
v := types.Ed25519Validator(pubkey, int64(power))
|
||||||
|
vals[i] = &v
|
||||||
}
|
}
|
||||||
_, err := client.InitChainSync(types.RequestInitChain{
|
_, err := client.InitChainSync(types.RequestInitChain{
|
||||||
Validators: vals,
|
Validators: vals,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tmlibs/common"
|
||||||
)
|
)
|
||||||
|
@ -21,7 +21,7 @@ func TestMarshalJSON(t *testing.T) {
|
||||||
Code: 1,
|
Code: 1,
|
||||||
Data: []byte("hello"),
|
Data: []byte("hello"),
|
||||||
GasWanted: 43,
|
GasWanted: 43,
|
||||||
Tags: []cmn.KVPair{
|
Tags: []*cmn.KVPair{
|
||||||
{[]byte("pho"), []byte("bo")},
|
{[]byte("pho"), []byte("bo")},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ func TestWriteReadMessage2(t *testing.T) {
|
||||||
Data: []byte(phrase),
|
Data: []byte(phrase),
|
||||||
Log: phrase,
|
Log: phrase,
|
||||||
GasWanted: 10,
|
GasWanted: 10,
|
||||||
Tags: []cmn.KVPair{
|
Tags: []*cmn.KVPair{
|
||||||
cmn.KVPair{[]byte("abc"), []byte("def")},
|
{[]byte("abc"), []byte("def")},
|
||||||
},
|
},
|
||||||
// Fee: cmn.KI64Pair{
|
// Fee: cmn.KI64Pair{
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,8 +35,13 @@ type ParamsInitChain struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToParamsInitChain(req RequestInitChain) ParamsInitChain {
|
func ToParamsInitChain(req RequestInitChain) ParamsInitChain {
|
||||||
|
vals := make([]Validator, len(req.Validators))
|
||||||
|
for i := 0; i < len(vals); i++ {
|
||||||
|
v := req.Validators[i]
|
||||||
|
vals[i] = *v
|
||||||
|
}
|
||||||
return ParamsInitChain{
|
return ParamsInitChain{
|
||||||
Validators: req.Validators,
|
Validators: vals,
|
||||||
GenesisBytes: req.GenesisBytes,
|
GenesisBytes: req.GenesisBytes,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,11 +75,17 @@ func ToParamsBeginBlock(req RequestBeginBlock) ParamsBeginBlock {
|
||||||
v := req.Validators[i]
|
v := req.Validators[i]
|
||||||
vals[i] = *v
|
vals[i] = *v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
evidence := make([]Evidence, len(req.ByzantineValidators))
|
||||||
|
for i := 0; i < len(evidence); i++ {
|
||||||
|
ev := req.ByzantineValidators[i]
|
||||||
|
evidence[i] = *ev
|
||||||
|
}
|
||||||
return ParamsBeginBlock{
|
return ParamsBeginBlock{
|
||||||
Hash: req.Hash,
|
Hash: req.Hash,
|
||||||
Header: req.Header,
|
Header: *req.Header,
|
||||||
Validators: vals,
|
Validators: vals,
|
||||||
ByzantineValidators: req.ByzantineValidators,
|
ByzantineValidators: evidence,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This script replaces most `[]byte` with `data.Bytes` in a `.pb.go` file.
|
|
||||||
// It was written before we realized we could use `gogo/protobuf` to achieve
|
|
||||||
// this more natively. So it's here for safe keeping in case we ever need to
|
|
||||||
// abandon `gogo/protobuf`.
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
bytePattern := regexp.MustCompile("[[][]]byte")
|
|
||||||
const oldPath = "types/types.pb.go"
|
|
||||||
const tmpPath = "types/types.pb.new"
|
|
||||||
content, err := ioutil.ReadFile(oldPath)
|
|
||||||
if err != nil {
|
|
||||||
panic("cannot read " + oldPath)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
lines := bytes.Split(content, []byte("\n"))
|
|
||||||
outFile, _ := os.Create(tmpPath)
|
|
||||||
wroteImport := false
|
|
||||||
for _, line_bytes := range lines {
|
|
||||||
line := string(line_bytes)
|
|
||||||
gotPackageLine := strings.HasPrefix(line, "package ")
|
|
||||||
writeImportTime := strings.HasPrefix(line, "import ")
|
|
||||||
containsDescriptor := strings.Contains(line, "Descriptor")
|
|
||||||
containsByteArray := strings.Contains(line, "[]byte")
|
|
||||||
if containsByteArray && !containsDescriptor {
|
|
||||||
line = string(bytePattern.ReplaceAll([]byte(line), []byte("data.Bytes")))
|
|
||||||
}
|
|
||||||
if writeImportTime && !wroteImport {
|
|
||||||
wroteImport = true
|
|
||||||
fmt.Fprintf(outFile, "import \"github.com/tendermint/go-wire/data\"\n")
|
|
||||||
|
|
||||||
}
|
|
||||||
if gotPackageLine {
|
|
||||||
fmt.Fprintf(outFile, "%s\n", "//nolint: gas")
|
|
||||||
}
|
|
||||||
fmt.Fprintf(outFile, "%s\n", line)
|
|
||||||
}
|
|
||||||
outFile.Close()
|
|
||||||
os.Remove(oldPath)
|
|
||||||
os.Rename(tmpPath, oldPath)
|
|
||||||
exec.Command("goimports", "-w", oldPath)
|
|
||||||
}
|
|
100
types/result.go
100
types/result.go
|
@ -1,6 +1,6 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import common "github.com/tendermint/tmlibs/common"
|
import cmn "github.com/tendermint/tmlibs/common"
|
||||||
|
|
||||||
// nondeterministic
|
// nondeterministic
|
||||||
type ResultException struct {
|
type ResultException struct {
|
||||||
|
@ -41,7 +41,10 @@ type ResultInitChain struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromResultInitChain(res ResultInitChain) ResponseInitChain {
|
func FromResultInitChain(res ResultInitChain) ResponseInitChain {
|
||||||
return ResponseInitChain(res)
|
vals := valsToPointers(res.Validators)
|
||||||
|
return ResponseInitChain{
|
||||||
|
Validators: vals,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultQuery struct {
|
type ResultQuery struct {
|
||||||
|
@ -61,51 +64,80 @@ func FromResultQuery(res ResultQuery) ResponseQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultBeginBlock struct {
|
type ResultBeginBlock struct {
|
||||||
Tags []common.KVPair `json:"tags,omitempty"`
|
Tags []cmn.KVPair `json:"tags,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromResultBeginBlock(res ResultBeginBlock) ResponseBeginBlock {
|
func FromResultBeginBlock(res ResultBeginBlock) ResponseBeginBlock {
|
||||||
return ResponseBeginBlock(res)
|
tags := tagsToPointers(res.Tags)
|
||||||
|
return ResponseBeginBlock{
|
||||||
|
Tags: tags,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultCheckTx struct {
|
type ResultCheckTx struct {
|
||||||
Code uint32 `json:"code,omitempty"`
|
Code uint32 `json:"code,omitempty"`
|
||||||
Data []byte `json:"data,omitempty"`
|
Data []byte `json:"data,omitempty"`
|
||||||
Log string `json:"log,omitempty"`
|
Log string `json:"log,omitempty"`
|
||||||
Info string `json:"info,omitempty"`
|
Info string `json:"info,omitempty"`
|
||||||
GasWanted int64 `json:"gas_wanted,omitempty"`
|
GasWanted int64 `json:"gas_wanted,omitempty"`
|
||||||
GasUsed int64 `json:"gas_used,omitempty"`
|
GasUsed int64 `json:"gas_used,omitempty"`
|
||||||
Tags []common.KVPair `json:"tags,omitempty"`
|
Tags []cmn.KVPair `json:"tags,omitempty"`
|
||||||
Fee common.KI64Pair `json:"fee"`
|
Fee cmn.KI64Pair `json:"fee"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromResultCheckTx(res ResultCheckTx) ResponseCheckTx {
|
func FromResultCheckTx(res ResultCheckTx) ResponseCheckTx {
|
||||||
return ResponseCheckTx(res)
|
tags := tagsToPointers(res.Tags)
|
||||||
|
return ResponseCheckTx{
|
||||||
|
Code: res.Code,
|
||||||
|
Data: res.Data,
|
||||||
|
Log: res.Log,
|
||||||
|
Info: res.Info,
|
||||||
|
GasWanted: res.GasWanted,
|
||||||
|
GasUsed: res.GasUsed,
|
||||||
|
Tags: tags,
|
||||||
|
Fee: &res.Fee,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultDeliverTx struct {
|
type ResultDeliverTx struct {
|
||||||
Code uint32 `json:"code,omitempty"`
|
Code uint32 `json:"code,omitempty"`
|
||||||
Data []byte `json:"data,omitempty"`
|
Data []byte `json:"data,omitempty"`
|
||||||
Log string `json:"log,omitempty"`
|
Log string `json:"log,omitempty"`
|
||||||
Info string `json:"info,omitempty"`
|
Info string `json:"info,omitempty"`
|
||||||
GasWanted int64 `json:"gas_wanted,omitempty"`
|
GasWanted int64 `json:"gas_wanted,omitempty"`
|
||||||
GasUsed int64 `json:"gas_used,omitempty"`
|
GasUsed int64 `json:"gas_used,omitempty"`
|
||||||
Tags []common.KVPair `json:"tags,omitempty"`
|
Tags []cmn.KVPair `json:"tags,omitempty"`
|
||||||
Fee common.KI64Pair `json:"fee"`
|
Fee cmn.KI64Pair `json:"fee"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromResultDeliverTx(res ResultDeliverTx) ResponseDeliverTx {
|
func FromResultDeliverTx(res ResultDeliverTx) ResponseDeliverTx {
|
||||||
return ResponseDeliverTx(res)
|
tags := tagsToPointers(res.Tags)
|
||||||
|
return ResponseDeliverTx{
|
||||||
|
Code: res.Code,
|
||||||
|
Data: res.Data,
|
||||||
|
Log: res.Log,
|
||||||
|
Info: res.Info,
|
||||||
|
GasWanted: res.GasWanted,
|
||||||
|
GasUsed: res.GasUsed,
|
||||||
|
Tags: tags,
|
||||||
|
Fee: &res.Fee,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultEndBlock struct {
|
type ResultEndBlock struct {
|
||||||
ValidatorUpdates []Validator `json:"validator_updates"`
|
ValidatorUpdates []Validator `json:"validator_updates"`
|
||||||
ConsensusParamUpdates *ConsensusParams `json:"consensus_param_updates,omitempty"`
|
ConsensusParamUpdates *ConsensusParams `json:"consensus_param_updates,omitempty"`
|
||||||
Tags []common.KVPair `json:"tags,omitempty"`
|
Tags []cmn.KVPair `json:"tags,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromResultEndBlock(res ResultEndBlock) ResponseEndBlock {
|
func FromResultEndBlock(res ResultEndBlock) ResponseEndBlock {
|
||||||
return ResponseEndBlock(res)
|
tags := tagsToPointers(res.Tags)
|
||||||
|
vals := valsToPointers(res.ValidatorUpdates)
|
||||||
|
return ResponseEndBlock{
|
||||||
|
ValidatorUpdates: vals,
|
||||||
|
ConsensusParamUpdates: res.ConsensusParamUpdates,
|
||||||
|
Tags: tags,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultCommit struct {
|
type ResultCommit struct {
|
||||||
|
@ -116,3 +148,23 @@ type ResultCommit struct {
|
||||||
func FromResultCommit(res ResultCommit) ResponseCommit {
|
func FromResultCommit(res ResultCommit) ResponseCommit {
|
||||||
return ResponseCommit(res)
|
return ResponseCommit(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
func tagsToPointers(tags []cmn.KVPair) []*cmn.KVPair {
|
||||||
|
tagPtrs := make([]*cmn.KVPair, len(tags))
|
||||||
|
for i := 0; i < len(tags); i++ {
|
||||||
|
t := tags[i]
|
||||||
|
tagPtrs[i] = &t
|
||||||
|
}
|
||||||
|
return tagPtrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func valsToPointers(vals []Validator) []*Validator {
|
||||||
|
valPtrs := make([]*Validator, len(vals))
|
||||||
|
for i := 0; i < len(vals); i++ {
|
||||||
|
v := vals[i]
|
||||||
|
valPtrs[i] = &v
|
||||||
|
}
|
||||||
|
return valPtrs
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,9 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package types;
|
package types;
|
||||||
|
|
||||||
// For more information on gogo.proto, see:
|
|
||||||
// https://github.com/gogo/protobuf/blob/master/extensions.md
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
||||||
import "github.com/tendermint/tmlibs/common/types.proto";
|
import "github.com/tendermint/tmlibs/common/types.proto";
|
||||||
|
|
||||||
// This file is copied from http://github.com/tendermint/abci
|
// This file is copied from http://github.com/tendermint/abci
|
||||||
// NOTE: When using custom types, mind the warnings.
|
|
||||||
// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
|
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
// Request types
|
// Request types
|
||||||
|
@ -47,7 +42,7 @@ message RequestSetOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
message RequestInitChain {
|
message RequestInitChain {
|
||||||
repeated Validator validators = 1 [(gogoproto.nullable)=false];
|
repeated Validator validators = 1;
|
||||||
bytes genesis_bytes = 2;
|
bytes genesis_bytes = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,9 +55,9 @@ message RequestQuery {
|
||||||
|
|
||||||
message RequestBeginBlock {
|
message RequestBeginBlock {
|
||||||
bytes hash = 1;
|
bytes hash = 1;
|
||||||
Header header = 2 [(gogoproto.nullable)=false];
|
Header header = 2;
|
||||||
repeated SigningValidator validators = 3;
|
repeated SigningValidator validators = 3;
|
||||||
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false];
|
repeated Evidence byzantine_validators = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RequestCheckTx {
|
message RequestCheckTx {
|
||||||
|
@ -128,7 +123,7 @@ message ResponseSetOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseInitChain {
|
message ResponseInitChain {
|
||||||
repeated Validator validators = 1 [(gogoproto.nullable)=false];
|
repeated Validator validators = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseQuery {
|
message ResponseQuery {
|
||||||
|
@ -144,7 +139,7 @@ message ResponseQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseBeginBlock {
|
message ResponseBeginBlock {
|
||||||
repeated common.KVPair tags = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
|
repeated common.KVPair tags = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseCheckTx {
|
message ResponseCheckTx {
|
||||||
|
@ -154,8 +149,8 @@ message ResponseCheckTx {
|
||||||
string info = 4; // nondeterministic
|
string info = 4; // nondeterministic
|
||||||
int64 gas_wanted = 5;
|
int64 gas_wanted = 5;
|
||||||
int64 gas_used = 6;
|
int64 gas_used = 6;
|
||||||
repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
|
repeated common.KVPair tags = 7;
|
||||||
common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
|
common.KI64Pair fee = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseDeliverTx {
|
message ResponseDeliverTx {
|
||||||
|
@ -165,14 +160,14 @@ message ResponseDeliverTx {
|
||||||
string info = 4; // nondeterministic
|
string info = 4; // nondeterministic
|
||||||
int64 gas_wanted = 5;
|
int64 gas_wanted = 5;
|
||||||
int64 gas_used = 6;
|
int64 gas_used = 6;
|
||||||
repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
|
repeated common.KVPair tags = 7;
|
||||||
common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
|
common.KI64Pair fee = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseEndBlock {
|
message ResponseEndBlock {
|
||||||
repeated Validator validator_updates = 1 [(gogoproto.nullable)=false];
|
repeated Validator validator_updates = 1;
|
||||||
ConsensusParams consensus_param_updates = 2;
|
ConsensusParams consensus_param_updates = 2;
|
||||||
repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
|
repeated common.KVPair tags = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseCommit {
|
message ResponseCommit {
|
||||||
|
@ -217,7 +212,7 @@ message BlockGossip {
|
||||||
// just the minimum the app might need
|
// just the minimum the app might need
|
||||||
message Header {
|
message Header {
|
||||||
// basics
|
// basics
|
||||||
string chain_id = 1 [(gogoproto.customname)="ChainID"];
|
string chain_id = 1;
|
||||||
int64 height = 2;
|
int64 height = 2;
|
||||||
int64 time = 3;
|
int64 time = 3;
|
||||||
|
|
||||||
|
@ -236,7 +231,7 @@ message Header {
|
||||||
// Validator
|
// Validator
|
||||||
message Validator {
|
message Validator {
|
||||||
bytes address = 1;
|
bytes address = 1;
|
||||||
PubKey pub_key = 2 [(gogoproto.nullable)=false];
|
PubKey pub_key = 2;
|
||||||
int64 power = 3;
|
int64 power = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ const (
|
||||||
func Ed25519Validator(pubkey []byte, power int64) Validator {
|
func Ed25519Validator(pubkey []byte, power int64) Validator {
|
||||||
return Validator{
|
return Validator{
|
||||||
// Address:
|
// Address:
|
||||||
PubKey: PubKey{
|
PubKey: &PubKey{
|
||||||
Type: PubKeyEd25519,
|
Type: PubKeyEd25519,
|
||||||
Data: pubkey,
|
Data: pubkey,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue