diff --git a/Gopkg.lock b/Gopkg.lock index 496e8967c..5571ea0bb 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -302,6 +302,15 @@ revision = "2106ca61d91029c931fd54968c2bb02dc96b1412" version = "0.10.1" +[[projects]] + name = "github.com/tendermint/iavl" + packages = [ + ".", + "sha256truncated" + ] + revision = "8ca620e7e401976d0324938c9a361cf78bca9770" + version = "v0.9.3-rc0" + [[projects]] name = "github.com/tendermint/tmlibs" packages = [ @@ -423,6 +432,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "c25289282b94abc7f0c390e592e5e1636b7f26cb4773863ac39cde7fdc7b5bdf" + inputs-digest = "e473d5da80b2f997f7b1e42ff6eb0fff055fa0ff9ab1a9f0bd01ed239b479fe3" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 18e2767a9..010b1512a 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -73,6 +73,10 @@ name = "github.com/tendermint/go-amino" version = "~0.10.1" +[[constraint]] + name = "github.com/tendermint/iavl" + version = "0.9.3-rc0" + [[override]] name = "github.com/tendermint/tmlibs" version = "~0.9.0" diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index e4d4ce829..9cad7a8a2 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -22,6 +22,7 @@ import ( servertest "github.com/tendermint/tendermint/abci/tests/server" "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/abci/version" + "github.com/tendermint/tendermint/crypto/merkle" ) // client is a global variable so it can be reused by the console @@ -100,7 +101,7 @@ type queryResponse struct { Key []byte Value []byte Height int64 - Proof []types.ProofOp + Proof *merkle.Proof } func Execute() error { diff --git a/abci/example/code/code.go b/abci/example/code/code.go index 94e9d015e..988b2a93e 100644 --- a/abci/example/code/code.go +++ b/abci/example/code/code.go @@ -6,4 +6,5 @@ const ( CodeTypeEncodingError uint32 = 1 CodeTypeBadNonce uint32 = 2 CodeTypeUnauthorized uint32 = 3 + CodeTypeUnknownError uint32 = 4 ) diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index 27a417b24..65fe6c833 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -2,10 +2,10 @@ package kvstore import ( "bytes" - "encoding/binary" "encoding/json" "fmt" + "github.com/tendermint/iavl" "github.com/tendermint/tendermint/abci/example/code" "github.com/tendermint/tendermint/abci/types" cmn "github.com/tendermint/tmlibs/common" @@ -13,20 +13,21 @@ import ( ) var ( - stateKey = []byte("stateKey") - kvPairPrefixKey = []byte("kvPairKey:") + stateKey = []byte("stateKey") ) type State struct { - db dbm.DB + db dbm.DB + tree *iavl.VersionedTree + Size int64 `json:"size"` Height int64 `json:"height"` AppHash []byte `json:"app_hash"` } -func loadState(db dbm.DB) State { +func loadState(db dbm.DB) *State { stateBytes := db.Get(stateKey) - var state State + var state = new(State) if len(stateBytes) != 0 { err := json.Unmarshal(stateBytes, &state) if err != nil { @@ -34,10 +35,22 @@ func loadState(db dbm.DB) State { } } state.db = db + state.tree = iavl.NewVersionedTree(db, 0) + state.tree.LoadVersion(state.Height) return state } -func saveState(state State) { +func saveState(state *State) { + hash, version, err := state.tree.SaveVersion() + if err != nil { + panic(err) + } + state.AppHash = hash + if state.Height+1 != version { + panic("should not happen, expected version to be 1+state.Height.") + } + state.Height = version + stateBytes, err := json.Marshal(state) if err != nil { panic(err) @@ -45,10 +58,6 @@ func saveState(state State) { state.db.Set(stateKey, stateBytes) } -func prefixKey(key []byte) []byte { - return append(kvPairPrefixKey, key...) -} - //--------------------------------------------------- var _ types.Application = (*KVStoreApplication)(nil) @@ -56,7 +65,7 @@ var _ types.Application = (*KVStoreApplication)(nil) type KVStoreApplication struct { types.BaseApplication - state State + state *State } func NewKVStoreApplication() *KVStoreApplication { @@ -77,11 +86,11 @@ func (app *KVStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx { } else { key, value = tx, tx } - app.state.db.Set(prefixKey(key), value) + app.state.tree.Set(key, value) app.state.Size += 1 tags := []cmn.KVPair{ - {[]byte("app.creator"), []byte("jae")}, + {[]byte("app.creator"), []byte("Cosmoshi Netowoko")}, {[]byte("app.key"), key}, } return types.ResponseDeliverTx{Code: code.CodeTypeOK, Tags: tags} @@ -92,20 +101,20 @@ func (app *KVStoreApplication) CheckTx(tx []byte) types.ResponseCheckTx { } func (app *KVStoreApplication) Commit() types.ResponseCommit { - // Using a memdb - just return the big endian size of the db - appHash := make([]byte, 8) - binary.PutVarint(appHash, app.state.Size) - app.state.AppHash = appHash - app.state.Height += 1 saveState(app.state) - return types.ResponseCommit{Data: appHash} + return types.ResponseCommit{Data: app.state.AppHash} } func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) { - // NOTE: This isn't proving anything yet. + key := reqQuery.Data if reqQuery.Prove { - value := app.state.db.Get(prefixKey(reqQuery.Data)) - resQuery.Index = -1 // TODO make Proof return index + value, proof, err := app.state.tree.GetWithProof(key) + if err != nil { + resQuery.Code = code.CodeTypeUnknownError + resQuery.Log = err.Error() + return + } + resQuery.Index = proof.LeftIndex() // TODO make Proof return index resQuery.Key = reqQuery.Data resQuery.Value = value if value != nil { @@ -115,7 +124,9 @@ func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery type } return } else { - value := app.state.db.Get(prefixKey(reqQuery.Data)) + index, value := app.state.tree.Get64(key) + resQuery.Index = index + resQuery.Key = reqQuery.Data resQuery.Value = value if value != nil { resQuery.Log = "exists" diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 6b102d057..d2cc508f3 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -37,7 +37,6 @@ It has these top-level messages: BlockSize TxSize BlockGossip - ProofOp Header Validator SigningValidator @@ -52,6 +51,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import common "github.com/tendermint/tmlibs/common" +import merkle "github.com/tendermint/tendermint/crypto/merkle" import context "golang.org/x/net/context" import grpc "google.golang.org/grpc" @@ -1289,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 []ProofOp `protobuf:"bytes,8,rep,name=proof" json:"tags,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 *merkle.Proof `protobuf:"bytes,8,opt,name=proof" json:"proof,omitempty"` + Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` } func (m *ResponseQuery) Reset() { *m = ResponseQuery{} } @@ -1345,7 +1345,7 @@ func (m *ResponseQuery) GetValue() []byte { return nil } -func (m *ResponseQuery) GetProof() []ProofOp { +func (m *ResponseQuery) GetProof() *merkle.Proof { if m != nil { return m.Proof } @@ -1679,39 +1679,6 @@ 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 @@ -1732,7 +1699,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{30} } +func (*Header) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{29} } func (m *Header) GetChainID() string { if m != nil { @@ -1807,7 +1774,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{31} } +func (*Validator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{30} } func (m *Validator) GetAddress() []byte { if m != nil { @@ -1839,7 +1806,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{32} } +func (*SigningValidator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{31} } func (m *SigningValidator) GetValidator() Validator { if m != nil { @@ -1863,7 +1830,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{33} } +func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{32} } func (m *PubKey) GetType() string { if m != nil { @@ -1890,7 +1857,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{34} } +func (*Evidence) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{33} } func (m *Evidence) GetType() string { if m != nil { @@ -1957,7 +1924,6 @@ 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") @@ -2370,122 +2336,123 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("types/types.proto", fileDescriptorTypes) } var fileDescriptorTypes = []byte{ - // 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, 0x56, 0xaa, 0x72, 0x41, 0x0d, 0xb0, 0xc3, 0xc5, 0x96, 0xb0, 0x3f, 0xde, 0x19, 0xd0, - 0xa0, 0x6e, 0xb9, 0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0xe7, 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, + // 1874 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x4b, 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0x80, 0xb6, 0xba, 0x23, 0xfe, 0xa8, 0xeb, 0x30, 0x6e, 0xb7, 0x70, 0x5d, + 0x9a, 0xc9, 0x7f, 0xac, 0x41, 0x37, 0x9e, 0x86, 0x4a, 0x95, 0x72, 0x97, 0xae, 0xbf, 0xeb, 0xa5, + 0xab, 0x46, 0xc9, 0x38, 0xd6, 0x9a, 0x99, 0x58, 0x3b, 0x02, 0xa2, 0x42, 0xea, 0x3a, 0x10, 0xae, + 0xef, 0x4c, 0x94, 0x37, 0x55, 0x6c, 0xf5, 0x91, 0xf3, 0x12, 0x19, 0x97, 0x72, 0xff, 0xe4, 0x9b, + 0x16, 0xf4, 0x4e, 0xcf, 0xce, 0x2f, 0x4e, 0xc3, 0x70, 0xe1, 0xce, 0x28, 0x36, 0x61, 0x23, 0x68, + 0x62, 0x9b, 0x59, 0xf2, 0x58, 0x35, 0x2c, 0x9b, 0x77, 0xc8, 0x09, 0xb4, 0xb0, 0xdb, 0x24, 0x65, + 0x6f, 0x56, 0xc3, 0xd2, 0xb1, 0x47, 0x7e, 0x44, 0xf5, 0xa3, 0x9b, 0x4f, 0x57, 0xc3, 0xb2, 0xd9, + 0x87, 0x7c, 0x0a, 0x46, 0xda, 0x27, 0x56, 0x3d, 0x60, 0x0d, 0x2b, 0xa7, 0x20, 0xa9, 0x9f, 0xd6, + 0xda, 0xaa, 0xe7, 0x9e, 0x61, 0xe5, 0xb8, 0x40, 0x1e, 0x43, 0x27, 0xee, 0x56, 0xca, 0x9f, 0x98, + 0x86, 0x15, 0x13, 0x8a, 0x74, 0x8f, 0x6a, 0x00, 0xcb, 0xde, 0xc1, 0x86, 0xa5, 0x63, 0x14, 0x79, + 0x08, 0x6d, 0x5d, 0x30, 0x4a, 0x1f, 0x8b, 0x86, 0xe5, 0x73, 0x86, 0x34, 0x32, 0x6d, 0x7e, 0xab, + 0xde, 0xea, 0x86, 0x95, 0xf3, 0x1e, 0x39, 0x05, 0xc8, 0x74, 0x79, 0x95, 0x8f, 0x70, 0xc3, 0xea, + 0x39, 0x8e, 0x3c, 0x85, 0x6e, 0x3a, 0x9b, 0x97, 0x3f, 0x8e, 0x0d, 0xab, 0x46, 0xab, 0x69, 0x1b, + 0x1f, 0x50, 0x3f, 0xfa, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0x49, 0xc5, 0xab, 0xf9, 0x15, + 0x00, 0x00, } diff --git a/abci/types/types.proto b/abci/types/types.proto index 2dec6209e..3ac761e27 100644 --- a/abci/types/types.proto +++ b/abci/types/types.proto @@ -5,6 +5,7 @@ package types; // 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/tendermint/crypto/merkle/merkle.proto"; // This file is copied from http://github.com/tendermint/abci // NOTE: When using custom types, mind the warnings. @@ -143,7 +144,7 @@ message ResponseQuery { int64 index = 5; bytes key = 6; bytes value = 7; - repeated ProofOp proof = 8 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"]; + merkle.Proof proof = 8; int64 height = 9; } @@ -215,13 +216,6 @@ 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 diff --git a/crypto/merkle/proof.go b/crypto/merkle/proof.go index 1947dc418..51d891a98 100644 --- a/crypto/merkle/proof.go +++ b/crypto/merkle/proof.go @@ -114,10 +114,14 @@ func (prt *ProofRuntime) DecodeProof(proof *Proof) (poz ProofOperators, err erro return } +// XXX Reorder value/keys, and figure out how to merge keys into a single string +// after figuring out encoding between bytes/string. func (prt *ProofRuntime) VerifyValue(proof *Proof, root []byte, value []byte, keys ...string) (err error) { return prt.Verify(proof, root, [][]byte{value}, keys...) } +// XXX Reorder value/keys, and figure out how to merge keys into a single string +// after figuring out encoding between bytes/string. func (prt *ProofRuntime) Verify(proof *Proof, root []byte, args [][]byte, keys ...string) (err error) { poz, err := prt.DecodeProof(proof) if err != nil { diff --git a/lite/proxy/query.go b/lite/proxy/query.go index aa25cdcf2..51fc83944 100644 --- a/lite/proxy/query.go +++ b/lite/proxy/query.go @@ -3,127 +3,88 @@ package proxy import ( "fmt" - "github.com/pkg/errors" - cmn "github.com/tendermint/tmlibs/common" + "github.com/tendermint/tendermint/crypto/merkle" "github.com/tendermint/tendermint/lite" rpcclient "github.com/tendermint/tendermint/rpc/client" ctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/tendermint/tendermint/types" ) -// KeyProof represents a proof of existence or absence of a single key. -// Copied from iavl repo. TODO -type KeyProof interface { - // Verify verfies the proof is valid. To verify absence, - // the value should be nil. - Verify(key, value, root []byte) error - - // Root returns the root hash of the proof. - Root() []byte - - // Serialize itself - Bytes() []byte -} - // GetWithProof will query the key on the given node, and verify it has // a valid proof, as defined by the certifier. // // If there is any error in checking, returns an error. -// If val is non-empty, proof should be KeyExistsProof -// If val is empty, proof should be KeyMissingProof func GetWithProof(key []byte, reqHeight int64, node rpcclient.Client, cert lite.Certifier) ( - val cmn.HexBytes, height int64, proof KeyProof, err error) { + val cmn.HexBytes, height int64, proof *merkle.Proof, err error) { if reqHeight < 0 { - err = errors.Errorf("Height cannot be negative") + err = cmn.NewError("Height cannot be negative") return } - _resp, proof, err := GetWithProofOptions("/key", key, - rpcclient.ABCIQueryOptions{Height: int64(reqHeight)}, + res, err := GetWithProofOptions("/key", key, + rpcclient.ABCIQueryOptions{Height: int64(reqHeight), Prove: true}, node, cert) - if _resp != nil { - resp := _resp.Response - val, height = resp.Value, resp.Height + if err != nil { + return } + + resp := res.Response + val, height, proof = resp.Value, resp.Height, resp.Proof return val, height, proof, err } -// GetWithProofOptions is useful if you want full access to the ABCIQueryOptions +// GetWithProofOptions is useful if you want full access to the ABCIQueryOptions. func GetWithProofOptions(path string, key []byte, opts rpcclient.ABCIQueryOptions, node rpcclient.Client, cert lite.Certifier) ( - *ctypes.ResultABCIQuery, KeyProof, error) { + *ctypes.ResultABCIQuery, error) { - _resp, err := node.ABCIQueryWithOptions(path, key, opts) + if !opts.Prove { + return nil, cmn.NewError("require ABCIQueryOptions.Prove to be true") + } + + res, err := node.ABCIQueryWithOptions(path, key, opts) if err != nil { - return nil, nil, err + return nil, err } - resp := _resp.Response + resp := res.Response - // make sure the proof is the proper height + // Validate the response, e.g. height. if resp.IsErr() { - err = errors.Errorf("Query error for key %d: %d", key, resp.Code) - return nil, nil, err + err = cmn.NewError("Query error for key %d: %d", key, resp.Code) + return nil, err } - if len(resp.Key) == 0 || len(resp.Proof) == 0 { - return nil, nil, ErrNoData() + if len(resp.Key) == 0 || resp.Proof == nil { + return nil, ErrNoData() } if resp.Height == 0 { - return nil, nil, errors.New("Height returned is zero") + return nil, cmn.NewError("Height returned is zero") } // AppHash for height H is in header H+1 signedHeader, err := GetCertifiedCommit(resp.Height+1, node, cert) if err != nil { - return nil, nil, err + return nil, err } - _ = signedHeader - return &ctypes.ResultABCIQuery{Response: resp}, nil, nil - - /* // TODO refactor so iavl stuff is not in tendermint core - // https://github.com/tendermint/tendermint/issues/1183 if len(resp.Value) > 0 { - // The key was found, construct a proof of existence. - proof, err := iavl.ReadKeyProof(resp.Proof) - if err != nil { - return nil, nil, errors.Wrap(err, "Error reading proof") - } - - eproof, ok := proof.(*iavl.KeyExistsProof) - if !ok { - return nil, nil, errors.New("Expected KeyExistsProof for non-empty value") - } - // Validate the proof against the certified header to ensure data integrity. - err = eproof.Verify(resp.Key, resp.Value, signedHeader.AppHash) + // XXX Pass this in somehow so iavl can be registered. + // XXX How do we encode the key into a string... + prt := merkle.NewProofRuntime() + err = prt.VerifyValue(resp.Proof, signedHeader.AppHash, resp.Value, string(resp.Key)) if err != nil { - return nil, nil, errors.Wrap(err, "Couldn't verify proof") + return nil, cmn.ErrorWrap(err, "Couldn't verify proof") } - return &ctypes.ResultABCIQuery{Response: resp}, eproof, nil + return &ctypes.ResultABCIQuery{Response: resp}, nil + } else { + return nil, cmn.NewError("proof of absence not yet supported") } - // The key wasn't found, construct a proof of non-existence. - proof, err := iavl.ReadKeyProof(resp.Proof) - if err != nil { - return nil, nil, errors.Wrap(err, "Error reading proof") - } - - aproof, ok := proof.(*iavl.KeyAbsentProof) - if !ok { - return nil, nil, errors.New("Expected KeyAbsentProof for empty Value") - } - - // Validate the proof against the certified header to ensure data integrity. - err = aproof.Verify(resp.Key, nil, signedHeader.AppHash) - if err != nil { - return nil, nil, errors.Wrap(err, "Couldn't verify proof") - } - return &ctypes.ResultABCIQuery{Response: resp}, aproof, ErrNoData() - */ + return &ctypes.ResultABCIQuery{Response: resp}, ErrNoData() } // GetCertifiedCommit gets the signed header for a given height and certifies diff --git a/lite/proxy/query_test.go b/lite/proxy/query_test.go index fcc6659af..ca8d713d3 100644 --- a/lite/proxy/query_test.go +++ b/lite/proxy/query_test.go @@ -10,6 +10,7 @@ import ( "github.com/tendermint/tendermint/abci/example/kvstore" + "github.com/tendermint/tendermint/crypto/merkle" "github.com/tendermint/tendermint/lite" certclient "github.com/tendermint/tendermint/lite/client" nm "github.com/tendermint/tendermint/node" @@ -38,7 +39,7 @@ func kvstoreTx(k, v []byte) []byte { return []byte(fmt.Sprintf("%s=%s", k, v)) } -func _TestAppProofs(t *testing.T) { +func TestAppProofs(t *testing.T) { assert, require := assert.New(t), require.New(t) cl := client.NewLocal(node) @@ -64,11 +65,13 @@ func _TestAppProofs(t *testing.T) { latest, err := source.LatestFullCommit(chainID, 1, 1<<63-1) require.NoError(err, "%+v", err) rootHash := latest.SignedHeader.AppHash + require.NotNil(rootHash) // verify a query before the tx block has no data (and valid non-exist proof) bs, height, proof, err := GetWithProof(k, brh-1, cl, cert) - fmt.Println(bs, height, proof, err) require.NotNil(err) + require.NotNil(proof) + // XXX test proof require.True(IsErrNoData(err), err.Error()) require.Nil(bs) @@ -78,15 +81,10 @@ func _TestAppProofs(t *testing.T) { require.NotNil(proof) require.True(height >= int64(latest.Height())) - // Alexis there is a bug here, somehow the above code gives us rootHash = nil - // and proof.Verify doesn't care, while proofNotExists.Verify fails. - // I am hacking this in to make it pass, but please investigate further. - rootHash = proof.Root() + prt := merkle.NewProofRuntime() - //err = wire.ReadBinaryBytes(bs, &data) - //require.NoError(err, "%+v", err) assert.EqualValues(v, bs) - err = proof.Verify(k, bs, rootHash) + err = prt.VerifyValue(proof, rootHash, k, string(bs)) assert.NoError(err, "%+v", err) // Test non-existing key. @@ -95,9 +93,9 @@ func _TestAppProofs(t *testing.T) { require.True(IsErrNoData(err)) require.Nil(bs) require.NotNil(proof) - err = proof.Verify(missing, nil, rootHash) + err = prt.VerifyValue(proof, rootHash, missing, "") // XXX VerifyAbsence() assert.NoError(err, "%+v", err) - err = proof.Verify(k, nil, rootHash) + err = prt.VerifyValue(proof, rootHash, k, "") // XXX VerifyAbsence() assert.Error(err) } diff --git a/lite/proxy/wrapper.go b/lite/proxy/wrapper.go index 82b1fb092..c8cfa3eae 100644 --- a/lite/proxy/wrapper.go +++ b/lite/proxy/wrapper.go @@ -36,7 +36,7 @@ func SecureClient(c rpcclient.Client, cert *lite.InquiringCertifier) Wrapper { func (w Wrapper) ABCIQueryWithOptions(path string, data cmn.HexBytes, 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) return res, err }