* switch iavl store to use ics proof * fix proofs to return for correct height * appease linter * Register commitment op correctly * Make CommitmentOp generic over all ics23 specs (#6331) * Make the CommitmentOp generic over all ics23 ProofSpecs, using Type to distinguish * Register SimpleMerkle ics23 proof op as well * Addressed linter issues * move commitment proof to types * Apply suggestions from code review Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com> * address review comments: * Apply suggestions from code review Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * allow proofs against empty store * address review comments * Update store/types/proof.go Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * add changelog Co-authored-by: Ethan Frey <ethanfrey@users.noreply.github.com> Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Marko <marbar3778@yahoo.com>
29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
package rootmulti
|
|
|
|
import (
|
|
"github.com/tendermint/tendermint/crypto/merkle"
|
|
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
)
|
|
|
|
// 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.
|
|
return subpath == "/key"
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// XXX: This should be managed by the rootMultiStore which may want to register
|
|
// more proof ops?
|
|
func DefaultProofRuntime() (prt *merkle.ProofRuntime) {
|
|
prt = merkle.NewProofRuntime()
|
|
prt.RegisterOpDecoder(merkle.ProofOpSimpleValue, merkle.SimpleValueOpDecoder)
|
|
prt.RegisterOpDecoder(storetypes.ProofOpIAVLCommitment, storetypes.CommitmentOpDecoder)
|
|
prt.RegisterOpDecoder(storetypes.ProofOpSimpleMerkleCommitment, storetypes.CommitmentOpDecoder)
|
|
return
|
|
}
|