first commit

This commit is contained in:
Jae Kwon 2018-07-05 01:18:41 -07:00
parent b51ed132f7
commit 4f7565ba7b
16 changed files with 597 additions and 160 deletions

6
Gopkg.lock generated
View File

@ -91,8 +91,8 @@
"ptypes/duration",
"ptypes/timestamp"
]
revision = "925541529c1fa6821df4e44ce2723319eb2be768"
version = "v1.0.0"
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
version = "v1.1.0"
[[projects]]
branch = "master"
@ -423,6 +423,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "c25289282b94abc7f0c390e592e5e1636b7f26cb4773863ac39cde7fdc7b5bdf"
inputs-digest = "8c5f7f7b1a226e774353514c70f779e97d3311598076f510258b9ddcf87ed1f7"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -43,7 +43,7 @@
[[constraint]]
name = "github.com/golang/protobuf"
version = "~1.0.0"
version = "~1.1.0"
[[constraint]]
name = "github.com/gorilla/websocket"

View File

@ -100,7 +100,7 @@ type queryResponse struct {
Key []byte
Value []byte
Height int64
Proof []byte
Proof []types.ProofOp
}
func Execute() error {
@ -740,7 +740,7 @@ func printResponse(cmd *cobra.Command, args []string, rsp response) {
fmt.Printf("-> value.hex: %X\n", rsp.Query.Value)
}
if rsp.Query.Proof != nil {
fmt.Printf("-> proof: %X\n", rsp.Query.Proof)
fmt.Printf("-> proof: %#v\n", rsp.Query.Proof)
}
}
}

View File

@ -102,6 +102,7 @@ func (app *KVStoreApplication) Commit() types.ResponseCommit {
}
func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
// NOTE: This isn't proving anything yet.
if reqQuery.Prove {
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Index = -1 // TODO make Proof return index

View File

@ -168,7 +168,7 @@ func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.Respon
}
// update
return app.updateValidator(types.Ed25519Validator(pubkey, int64(power)))
return app.updateValidator(types.Ed25519Validator(pubkey, power))
}
// add, update, or remove a validator

View File

@ -37,6 +37,7 @@ It has these top-level messages:
BlockSize
TxSize
BlockGossip
ProofOp
Header
Validator
SigningValidator
@ -1288,13 +1289,13 @@ func (m *ResponseInitChain) GetValidators() []Validator {
type ResponseQuery struct {
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
// bytes data = 2; // use "value" instead.
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
Proof []byte `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"`
Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"`
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
Proof []ProofOp `protobuf:"bytes,8,rep,name=proof" json:"tags,omitempty"`
Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"`
}
func (m *ResponseQuery) Reset() { *m = ResponseQuery{} }
@ -1344,7 +1345,7 @@ func (m *ResponseQuery) GetValue() []byte {
return nil
}
func (m *ResponseQuery) GetProof() []byte {
func (m *ResponseQuery) GetProof() []ProofOp {
if m != nil {
return m.Proof
}
@ -1678,6 +1679,39 @@ func (m *BlockGossip) GetBlockPartSizeBytes() int32 {
return 0
}
// A single Merkle proof operation.
type ProofOp struct {
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *ProofOp) Reset() { *m = ProofOp{} }
func (m *ProofOp) String() string { return proto.CompactTextString(m) }
func (*ProofOp) ProtoMessage() {}
func (*ProofOp) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{29} }
func (m *ProofOp) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *ProofOp) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *ProofOp) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}
// just the minimum the app might need
type Header struct {
// basics
@ -1698,7 +1732,7 @@ type Header struct {
func (m *Header) Reset() { *m = Header{} }
func (m *Header) String() string { return proto.CompactTextString(m) }
func (*Header) ProtoMessage() {}
func (*Header) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{29} }
func (*Header) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{30} }
func (m *Header) GetChainID() string {
if m != nil {
@ -1773,7 +1807,7 @@ type Validator struct {
func (m *Validator) Reset() { *m = Validator{} }
func (m *Validator) String() string { return proto.CompactTextString(m) }
func (*Validator) ProtoMessage() {}
func (*Validator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{30} }
func (*Validator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{31} }
func (m *Validator) GetAddress() []byte {
if m != nil {
@ -1805,7 +1839,7 @@ type SigningValidator struct {
func (m *SigningValidator) Reset() { *m = SigningValidator{} }
func (m *SigningValidator) String() string { return proto.CompactTextString(m) }
func (*SigningValidator) ProtoMessage() {}
func (*SigningValidator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{31} }
func (*SigningValidator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{32} }
func (m *SigningValidator) GetValidator() Validator {
if m != nil {
@ -1829,7 +1863,7 @@ type PubKey struct {
func (m *PubKey) Reset() { *m = PubKey{} }
func (m *PubKey) String() string { return proto.CompactTextString(m) }
func (*PubKey) ProtoMessage() {}
func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{32} }
func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{33} }
func (m *PubKey) GetType() string {
if m != nil {
@ -1856,7 +1890,7 @@ type Evidence struct {
func (m *Evidence) Reset() { *m = Evidence{} }
func (m *Evidence) String() string { return proto.CompactTextString(m) }
func (*Evidence) ProtoMessage() {}
func (*Evidence) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{33} }
func (*Evidence) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{34} }
func (m *Evidence) GetType() string {
if m != nil {
@ -1923,6 +1957,7 @@ func init() {
proto.RegisterType((*BlockSize)(nil), "types.BlockSize")
proto.RegisterType((*TxSize)(nil), "types.TxSize")
proto.RegisterType((*BlockGossip)(nil), "types.BlockGossip")
proto.RegisterType((*ProofOp)(nil), "types.ProofOp")
proto.RegisterType((*Header)(nil), "types.Header")
proto.RegisterType((*Validator)(nil), "types.Validator")
proto.RegisterType((*SigningValidator)(nil), "types.SigningValidator")
@ -2335,121 +2370,122 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("types/types.proto", fileDescriptorTypes) }
var fileDescriptorTypes = []byte{
// 1846 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x6e, 0x1b, 0xc9,
0x11, 0x16, 0xff, 0x39, 0xa5, 0x1f, 0xd2, 0x2d, 0xdb, 0xa2, 0xb9, 0x08, 0x6c, 0x0c, 0x02, 0xaf,
0x9c, 0xd5, 0x8a, 0x89, 0x76, 0x6d, 0xd8, 0xbb, 0xc9, 0x22, 0x92, 0xd6, 0x59, 0x0a, 0x9b, 0x1f,
0x65, 0xec, 0x75, 0x80, 0x5c, 0x88, 0x26, 0xa7, 0x45, 0x0e, 0x4c, 0xce, 0xc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, 0xa9, 0xfa, 0xa5, 0x73, 0x0e, 0x7e, 0x44, 0x37, 0xa0, 0xd7, 0xdf, 0xaa,
0xfa, 0x65, 0xc3, 0x0e, 0xfb, 0x0c, 0xac, 0xb4, 0x31, 0x5c, 0xf7, 0x62, 0xd5, 0x5f, 0x3b, 0xf6,
0xa0, 0x7e, 0x5a, 0x6b, 0xd7, 0xbd, 0xef, 0xf4, 0xd7, 0xce, 0x07, 0xec, 0x31, 0xb4, 0xe2, 0x6e,
0xa5, 0xfc, 0x4d, 0xa9, 0xbf, 0x66, 0x24, 0x41, 0xf7, 0xe8, 0x8e, 0xaf, 0xec, 0xe1, 0xab, 0x5f,
0x3a, 0x37, 0xb1, 0x87, 0xd0, 0x34, 0x05, 0xa3, 0xf4, 0x75, 0xa8, 0x5f, 0x3e, 0x58, 0xa0, 0x91,
0x69, 0xb7, 0xbb, 0xee, 0x71, 0xae, 0xbf, 0x76, 0xc0, 0x63, 0xc7, 0x00, 0x99, 0x2e, 0x6f, 0xed,
0xab, 0x5b, 0x7f, 0xfd, 0xe0, 0xc6, 0x3e, 0x85, 0x76, 0x3a, 0x8c, 0x97, 0xbf, 0x86, 0xf5, 0xd7,
0xcd, 0x52, 0xe3, 0x26, 0xbd, 0x98, 0x7e, 0xf4, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xf3,
0xb2, 0x34, 0xad, 0x15, 0x00, 0x00,
// 1872 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x72, 0x1b, 0xc7,
0x11, 0x26, 0x7e, 0x17, 0xdb, 0xfc, 0x01, 0x34, 0x94, 0x44, 0x08, 0xae, 0x94, 0x54, 0x5b, 0x29,
0x99, 0x8a, 0x69, 0x22, 0xa1, 0x2d, 0x95, 0x64, 0x3b, 0xae, 0x90, 0xb4, 0x62, 0xb0, 0x9c, 0xc4,
0xcc, 0x4a,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, 0x47, 0xdf, 0x77, 0xa0,
0x7f, 0x7c, 0x72, 0x7a, 0x76, 0x1c, 0x45, 0x4b, 0x6f, 0x4e, 0xb1, 0xc5, 0x1b, 0x43, 0x1b, 0x9b,
0xd8, 0x8a, 0xa7, 0xb0, 0x51, 0xd5, 0x34, 0x45, 0x8e, 0xa0, 0x83, 0xbd, 0x2c, 0xa9, 0x7a, 0x11,
0x1b, 0x55, 0x0e, 0x55, 0xf2, 0x23, 0xaa, 0xdb, 0xbd, 0xfe, 0x30, 0x36, 0xaa, 0x9a, 0xac, 0xc8,
0xe7, 0x60, 0x66, 0x5d, 0x68, 0xdd, 0xf3, 0xd8, 0xa8, 0x76, 0xc6, 0x92, 0xf2, 0x59, 0xc1, 0xae,
0x7b, 0x4c, 0x1a, 0xd5, 0x0e, 0x23, 0xe4, 0x31, 0x18, 0x49, 0xcb, 0x53, 0xfd, 0x80, 0x35, 0xaa,
0x99, 0x7f, 0xa4, 0x7b, 0x54, 0x7b, 0x59, 0xf5, 0xca, 0x36, 0xaa, 0x1c, 0xd2, 0xc8, 0x43, 0xe8,
0xea, 0xaa, 0x53, 0xf9, 0x14, 0x35, 0xaa, 0x9e, 0x62, 0xa4, 0x91, 0x59, 0x6b, 0x5d, 0xf7, 0x12,
0x38, 0xaa, 0x9d, 0x26, 0xc9, 0x31, 0x40, 0xae, 0x55, 0xac, 0x7d, 0xe2, 0x1b, 0xd5, 0x4f, 0x89,
0xe4, 0x53, 0xe8, 0x65, 0x93, 0x7f, 0xf5, 0xd3, 0xdb, 0xa8, 0x6e, 0x70, 0x9b, 0x75, 0xf1, 0x79,
0xf6, 0xa3, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x53, 0x66, 0x3c, 0x2d, 0x1a, 0x16, 0x00, 0x00,
}

View File

@ -143,7 +143,7 @@ message ResponseQuery {
int64 index = 5;
bytes key = 6;
bytes value = 7;
bytes proof = 8;
repeated ProofOp proof = 8 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
int64 height = 9;
}
@ -215,6 +215,13 @@ message BlockGossip {
int32 block_part_size_bytes = 1;
}
// A single Merkle proof operation.
message ProofOp {
string type = 1;
string key = 2;
bytes data = 3;
}
//----------------------------------------
// Blockchain Types

6
crypto/merkle/compile.sh Normal file
View File

@ -0,0 +1,6 @@
#! /bin/bash
protoc --gogo_out=. -I $GOPATH/src/ -I . -I $GOPATH/src/github.com/gogo/protobuf/protobuf merkle.proto
echo "--> adding nolint declarations to protobuf generated files"
awk '/package merkle/ { print "//nolint: gas"; print; next }1' merkle.pb.go > merkle.pb.go.new
mv merkle.pb.go.new merkle.pb.go

101
crypto/merkle/merkle.pb.go Normal file
View File

@ -0,0 +1,101 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: merkle.proto
/*
Package merkle is a generated protocol buffer package.
It is generated from these files:
merkle.proto
It has these top-level messages:
ProofOp
Proof
*/
//nolint: gas
package merkle
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type ProofOp struct {
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *ProofOp) Reset() { *m = ProofOp{} }
func (m *ProofOp) String() string { return proto.CompactTextString(m) }
func (*ProofOp) ProtoMessage() {}
func (*ProofOp) Descriptor() ([]byte, []int) { return fileDescriptorMerkle, []int{0} }
func (m *ProofOp) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *ProofOp) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *ProofOp) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}
type Proof struct {
Ops []ProofOp `protobuf:"bytes,1,rep,name=ops" json:"ops"`
}
func (m *Proof) Reset() { *m = Proof{} }
func (m *Proof) String() string { return proto.CompactTextString(m) }
func (*Proof) ProtoMessage() {}
func (*Proof) Descriptor() ([]byte, []int) { return fileDescriptorMerkle, []int{1} }
func (m *Proof) GetOps() []ProofOp {
if m != nil {
return m.Ops
}
return nil
}
func init() {
proto.RegisterType((*ProofOp)(nil), "merkle.ProofOp")
proto.RegisterType((*Proof)(nil), "merkle.Proof")
}
func init() { proto.RegisterFile("merkle.proto", fileDescriptorMerkle) }
var fileDescriptorMerkle = []byte{
// 168 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xc9, 0x4d, 0x2d, 0xca,
0xce, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0xa4, 0x74, 0xd3, 0x33,
0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0xd2,
0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x39, 0x73, 0xb1, 0x07, 0x14,
0xe5, 0xe7, 0xa7, 0xf9, 0x17, 0x08, 0x09, 0x71, 0xb1, 0x94, 0x54, 0x16, 0xa4, 0x4a, 0x30, 0x2a,
0x30, 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0x02, 0x5c, 0xcc, 0xd9, 0xa9, 0x95, 0x12, 0x4c, 0x60,
0x21, 0x10, 0x13, 0xa4, 0x2a, 0x25, 0xb1, 0x24, 0x51, 0x82, 0x59, 0x81, 0x51, 0x83, 0x27, 0x08,
0xcc, 0x56, 0x32, 0xe0, 0x62, 0x05, 0x1b, 0x22, 0xa4, 0xce, 0xc5, 0x9c, 0x5f, 0x50, 0x2c, 0xc1,
0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0xc4, 0xaf, 0x07, 0x75, 0x20, 0xd4, 0x02, 0x27, 0x96, 0x13, 0xf7,
0xe4, 0x19, 0x82, 0x40, 0x2a, 0x92, 0xd8, 0xc0, 0xb6, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff,
0x52, 0x58, 0x00, 0xa7, 0xc4, 0x00, 0x00, 0x00,
}

View File

@ -0,0 +1,19 @@
syntax = "proto3";
package merkle;
// For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
//----------------------------------------
// Message types
message ProofOp {
string type = 1;
string key = 2;
bytes data = 3;
}
message Proof {
repeated ProofOp ops = 1 [(gogoproto.nullable)=false];
}

140
crypto/merkle/proof.go Normal file
View File

@ -0,0 +1,140 @@
package merkle
import (
"bytes"
"reflect"
"github.com/tendermint/go-amino"
cmn "github.com/tendermint/tmlibs/common"
)
//----------------------------------------
// Extension of ProofOp (defined in merkle.proto)
func (po ProofOp) Bytes() []byte {
bz, err := amino.MarshalBinary(po)
if err != nil {
panic(err)
}
return bz
}
//----------------------------------------
// ProofOp gets converted to an instance of ProofOperator:
type ProofOperator interface {
Run([][]byte) ([][]byte, error)
GetKey() string
ProofOp() ProofOp
}
//----------------------------------------
// Operations on a list of ProofOperators
type ProofOperators []ProofOperator
func (poz ProofOperators) VerifyValue(root []byte, value []byte, keys ...string) (err error) {
return poz.Verify(root, [][]byte{value}, keys...)
}
func (poz ProofOperators) Verify(root []byte, args [][]byte, keys ...string) (err error) {
for i, op := range poz {
key := op.GetKey()
if key != "" {
if keys[0] != key {
return cmn.NewError("Key mismatch on operation #%d: expected %+v but %+v", i, []byte(keys[0]), []byte(key))
}
keys = keys[1:]
}
args, err = op.Run(args)
if err != nil {
return
}
}
if !bytes.Equal(root, args[0]) {
return cmn.NewError("Calculated root hash is invalid: expected %+v but %+v", root, args[0])
}
return nil
}
//----------------------------------------
// ProofRuntime - main entrypoint
type OpDecoder func(ProofOp) (ProofOperator, error)
type ProofRuntime struct {
decoders map[string]OpDecoder
}
func NewProofRuntime() *ProofRuntime {
return &ProofRuntime{
decoders: make(map[string]OpDecoder),
}
}
func (prt *ProofRuntime) RegisterAminoOpDecoder(typ string, opType reflect.Type) {
prt.RegisterOpDecoder(
typ,
func(pop ProofOp) (ProofOperator, error) {
newOp := reflect.New(opType).Elem().Interface()
err := cdc.UnmarshalBinary(pop.Data, &newOp)
if err != nil {
return nil, cmn.ErrorWrap(err, "decoding ProofOp.Data")
}
return newOp.(ProofOperator), nil
},
)
}
func (prt *ProofRuntime) RegisterOpDecoder(typ string, dec OpDecoder) {
_, ok := prt.decoders[typ]
if ok {
panic("already registered for type " + typ)
}
prt.decoders[typ] = dec
}
func (prt *ProofRuntime) Decode(pop ProofOp) (ProofOperator, error) {
decoder := prt.decoders[pop.Type]
if decoder == nil {
return nil, cmn.NewError("unrecognized proof type %v", pop.Type)
}
return decoder(pop)
}
func (prt *ProofRuntime) DecodeProof(proof *Proof) (poz ProofOperators, err error) {
poz = ProofOperators(nil)
for _, pop := range proof.Ops {
operator, err := prt.Decode(pop)
if err != nil {
return nil, cmn.ErrorWrap(err, "decoding a proof operator")
}
poz = append(poz, operator)
}
return
}
func (prt *ProofRuntime) VerifyValue(proof *Proof, root []byte, value []byte, keys ...string) (err error) {
return prt.Verify(proof, root, [][]byte{value}, keys...)
}
func (prt *ProofRuntime) Verify(proof *Proof, root []byte, args [][]byte, keys ...string) (err error) {
poz, err := prt.DecodeProof(proof)
if err != nil {
return cmn.ErrorWrap(err, "decoding proof")
}
return poz.Verify(root, args, keys...)
}
// DefaultProofRuntime only knows about Simple value
// proofs.
// To use e.g. IAVL proofs, register op-decoders as
// defined in the IAVL package.
func DefaultProofRuntime() (prt *ProofRuntime) {
prt = NewProofRuntime()
prt.RegisterAminoOpDecoder(
ProofOpSimpleValue,
reflect.TypeOf(SimpleValueOp{}),
)
return
}

View File

@ -0,0 +1,79 @@
package merkle
import (
"bytes"
"fmt"
"github.com/tendermint/tendermint/crypto/tmhash"
cmn "github.com/tendermint/tmlibs/common"
)
const ProofOpSimpleValue = "simple:v"
// SimpleValueOp takes a key and a single value as argument and
// produces the root hash. The corresponding tree structure is
// the SimpleMap tree. SimpleMap takes a Hasher, and currently
// Tendermint uses aminoHasher. SimpleValueOp should support
// the hash function as used in aminoHasher. TODO support
// additional hash functions here as options/args to this
// operator.
//
// If the produced root hash matches the expected hash, the
// proof is good.
type SimpleValueOp struct {
// encoded in ProofOp.Key, not .Data
key string
// To encode in ProofOp.Data
Proof *SimpleProof `json:"simple-proof"`
}
var _ ProofOperator = SimpleValueOp{}
func NewSimpleValueOp(key string, proof *SimpleProof) SimpleValueOp {
return SimpleValueOp{
key: key,
Proof: proof,
}
}
func (op SimpleValueOp) String() string {
return fmt.Sprintf("SimpleValueOp{%v}", op.GetKey())
}
func (op SimpleValueOp) Run(args [][]byte) ([][]byte, error) {
if len(args) != 1 {
return nil, cmn.NewError("expected 1 arg, got %v", len(args))
}
value := args[0]
hasher := tmhash.New()
hasher.Write(value) // does not error
vhash := hasher.Sum(nil)
// Wrap <op.key, vhash> to hash the KVPair.
hasher = tmhash.New()
encodeByteSlice(hasher, []byte(op.key)) // does not error
encodeByteSlice(hasher, []byte(vhash)) // does not error
kvhash := hasher.Sum(nil)
if !bytes.Equal(kvhash, op.Proof.LeafHash) {
return nil, cmn.NewError("leaf hash mismatch: want %X got %X", op.Proof.LeafHash, kvhash)
}
return [][]byte{
op.Proof.ComputeRootHash(),
}, nil
}
func (op SimpleValueOp) GetKey() string {
return op.key
}
func (op SimpleValueOp) ProofOp() ProofOp {
bz := cdc.MustMarshalBinary(op)
return ProofOp{
Type: ProofOpSimpleValue,
Key: op.key,
Data: bz,
}
}

View File

@ -3,11 +3,22 @@ package merkle
import (
"bytes"
"fmt"
cmn "github.com/tendermint/tmlibs/common"
)
// SimpleProof represents a simple merkle proof.
// SimpleProof represents a simple Merkle proof.
// NOTE: The convention for proofs is to include leaf hashes but to
// exclude the root hash.
// This convention is implemented across IAVL range proofs as well.
// Keep this consistent unless there's a very good reason to change
// everything. This also affects the generalized proof system as
// well.
type SimpleProof struct {
Aunts [][]byte `json:"aunts"` // Hashes from leaf's sibling to a root's child.
Total int `json:"total"` // Total number of items.
Index int `json:"index"` // Index of item to prove.
LeafHash []byte `json:"leaf_hash"` // Hash of item value.
Aunts [][]byte `json:"aunts"` // Hashes from leaf's sibling to a root's child.
}
// SimpleProofsFromHashers computes inclusion proof for given items.
@ -18,7 +29,10 @@ func SimpleProofsFromHashers(items []Hasher) (rootHash []byte, proofs []*SimpleP
proofs = make([]*SimpleProof, len(items))
for i, trail := range trails {
proofs[i] = &SimpleProof{
Aunts: trail.FlattenAunts(),
Total: len(items),
Index: i,
LeafHash: trail.Hash,
Aunts: trail.FlattenAunts(),
}
}
return
@ -49,11 +63,32 @@ func SimpleProofsFromMap(m map[string]Hasher) (rootHash []byte, proofs map[strin
return
}
// Verify that leafHash is a leaf hash of the simple-merkle-tree
// which hashes to rootHash.
func (sp *SimpleProof) Verify(index int, total int, leafHash []byte, rootHash []byte) bool {
computedHash := computeHashFromAunts(index, total, leafHash, sp.Aunts)
return computedHash != nil && bytes.Equal(computedHash, rootHash)
// Verify that the SimpleProof proves the root hash.
func (sp *SimpleProof) Verify(rootHash []byte, index int, total int, leafHash []byte) error {
if sp.Index != index {
return cmn.NewError("invalid index: wanted %v got %v", index, sp.Index)
}
if sp.Total != total {
return cmn.NewError("invalid total: wanted %v got %v", total, sp.Total)
}
if !bytes.Equal(sp.LeafHash, leafHash) {
return cmn.NewError("invalid leaf hash: wanted %X got %X", leafHash, sp.LeafHash)
}
computedHash := sp.ComputeRootHash()
if !bytes.Equal(computedHash, rootHash) {
return cmn.NewError("invalid root hash: wanted %X got %X", rootHash, computedHash)
}
return nil
}
// Compute the root hash given a leaf hash. Does not verify the result.
func (sp *SimpleProof) ComputeRootHash() []byte {
return computeHashFromAunts(
sp.Index,
sp.Total,
sp.LeafHash,
sp.Aunts,
)
}
// String implements the stringer interface for SimpleProof.

16
crypto/merkle/wire.go Normal file
View File

@ -0,0 +1,16 @@
package merkle
import (
"github.com/tendermint/go-amino"
)
var cdc *amino.Codec
func init() {
cdc = amino.NewCodec()
RegisterWire(cdc)
}
func RegisterWire(cdc *amino.Codec) {
// Nothing to do.
}

View File

@ -408,7 +408,7 @@ In go:
func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
if reqQuery.Prove {
value, proof, exists := app.state.Proof(reqQuery.Data)
value, proof, exists := app.state.GetWithProof(reqQuery.Data)
resQuery.Index = -1 // TODO make Proof return index
resQuery.Key = reqQuery.Data
resQuery.Value = value
@ -437,22 +437,20 @@ In Java:
ResponseQuery requestQuery(RequestQuery req) {
final boolean isProveQuery = req.getProve();
final ResponseQuery.Builder responseBuilder = ResponseQuery.newBuilder();
byte[] queryData = req.getData().toByteArray();
if (isProveQuery) {
com.app.example.ProofResult proofResult = generateProof(req.getData().toByteArray());
final byte[] proofAsByteArray = proofResult.getAsByteArray();
responseBuilder.setProof(ByteString.copyFrom(proofAsByteArray));
com.app.example.QueryResultWithProof result = generateQueryResultWithProof(queryData);
responseBuilder.setIndex(result.getLeftIndex());
responseBuilder.setKey(req.getData());
responseBuilder.setValue(ByteString.copyFrom(proofResult.getData()));
responseBuilder.setValue(result.getValueOrNull(0));
responseBuilder.setHeight(result.getHeight());
responseBuilder.setProof(result.getProof());
responseBuilder.setLog(result.getLogValue());
} else {
byte[] queryData = req.getData().toByteArray();
final com.app.example.QueryResult result = generateQueryResult(queryData);
com.app.example.QueryResult result = generateQueryResult(queryData);
responseBuilder.setIndex(result.getIndex());
responseBuilder.setValue(ByteString.copyFrom(result.getValue()));
responseBuilder.setValue(result.getValue());
responseBuilder.setLog(result.getLogValue());
}

View File

@ -8,9 +8,9 @@ import (
"sync"
"time"
"github.com/tendermint/tendermint/crypto/tmhash"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/merkle"
"golang.org/x/crypto/ripemd160"
)
// Block defines the atomic unit of a Tendermint blockchain.
@ -615,7 +615,7 @@ type hasher struct {
}
func (h hasher) Hash() []byte {
hasher := ripemd160.New()
hasher := tmhash.New()
if h.item != nil && !cmn.IsTypedNil(h.item) && !cmn.IsEmpty(h.item) {
bz, err := cdc.MarshalBinaryBare(h.item)
if err != nil {
@ -627,7 +627,6 @@ func (h hasher) Hash() []byte {
}
}
return hasher.Sum(nil)
}
func aminoHash(item interface{}) []byte {