2019-02-01 17:03:09 -08:00
|
|
|
package rootmulti
|
2018-08-29 21:50:41 -07:00
|
|
|
|
|
|
|
import (
|
2018-11-04 19:36:35 -08:00
|
|
|
"github.com/tendermint/tendermint/crypto/merkle"
|
2020-06-08 12:02:25 -07:00
|
|
|
|
|
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
2018-08-29 21:50:41 -07:00
|
|
|
)
|
|
|
|
|
2018-11-04 19:36:35 -08:00
|
|
|
// RequireProof returns whether proof is required for the subpath.
|
|
|
|
func RequireProof(subpath string) bool {
|
|
|
|
// XXX: create a better convention.
|
|
|
|
// Currently, only when query subpath is "/key", will proof be included in
|
|
|
|
// response. If there are some changes about proof building in iavlstore.go,
|
|
|
|
// we must change code here to keep consistency with iavlStore#Query.
|
2019-02-08 12:45:23 -08:00
|
|
|
return subpath == "/key"
|
2018-08-29 21:50:41 -07:00
|
|
|
}
|
|
|
|
|
2018-11-04 19:36:35 -08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// XXX: This should be managed by the rootMultiStore which may want to register
|
|
|
|
// more proof ops?
|
|
|
|
func DefaultProofRuntime() (prt *merkle.ProofRuntime) {
|
|
|
|
prt = merkle.NewProofRuntime()
|
2020-06-08 12:02:25 -07:00
|
|
|
prt.RegisterOpDecoder(storetypes.ProofOpIAVLCommitment, storetypes.CommitmentOpDecoder)
|
|
|
|
prt.RegisterOpDecoder(storetypes.ProofOpSimpleMerkleCommitment, storetypes.CommitmentOpDecoder)
|
2018-11-04 19:36:35 -08:00
|
|
|
return
|
2018-08-30 19:03:48 -07:00
|
|
|
}
|