types

package
v0.0.0-...-aee1c25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrZeroStart = errors.New("the first block is 0")
)

Functions

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type BinaryMerkleProof

type BinaryMerkleProof struct {
	// total is the total number of items.
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	// index is the index of the item to prove.
	Index int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	// leaf_hash is the hash of the item value.
	LeafHash HexBytes `protobuf:"bytes,3,opt,name=leaf_hash,json=leafHash,proto3,casttype=HexBytes" json:"leaf_hash,omitempty"`
	// aunts are the hashes from the leaf's sibling to a root's child.
	Aunts HexBytesSlice `protobuf:"bytes,4,rep,name=aunts,proto3,castrepeated=HexBytesSlice" json:"aunts,omitempty"`
}

BinaryMerkleProof is a merkle proof with hex byte fields, since we want this to be encoded in hex in results.

func NewBinaryMerkleProof

func NewBinaryMerkleProof(proof merkle.Proof) *BinaryMerkleProof

NewBinaryMerkleProof creates a BinaryMerkleProof from a merkle.Proof.

func (*BinaryMerkleProof) Descriptor

func (*BinaryMerkleProof) Descriptor() ([]byte, []int)

func (*BinaryMerkleProof) GetAunts

func (m *BinaryMerkleProof) GetAunts() HexBytesSlice

func (*BinaryMerkleProof) GetIndex

func (m *BinaryMerkleProof) GetIndex() int64

func (*BinaryMerkleProof) GetLeafHash

func (m *BinaryMerkleProof) GetLeafHash() HexBytes

func (*BinaryMerkleProof) GetTotal

func (m *BinaryMerkleProof) GetTotal() int64

func (*BinaryMerkleProof) Marshal

func (m *BinaryMerkleProof) Marshal() (dAtA []byte, err error)

func (*BinaryMerkleProof) MarshalTo

func (m *BinaryMerkleProof) MarshalTo(dAtA []byte) (int, error)

func (*BinaryMerkleProof) MarshalToSizedBuffer

func (m *BinaryMerkleProof) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BinaryMerkleProof) ProtoMessage

func (*BinaryMerkleProof) ProtoMessage()

func (*BinaryMerkleProof) Reset

func (m *BinaryMerkleProof) Reset()

func (*BinaryMerkleProof) Size

func (m *BinaryMerkleProof) Size() (n int)

func (*BinaryMerkleProof) String

func (m *BinaryMerkleProof) String() string

func (*BinaryMerkleProof) ToMerkleProof

func (proof *BinaryMerkleProof) ToMerkleProof() *merkle.Proof

ToMerkleProof converts BinaryMerkleProof into the original merkle.Proof.

func (*BinaryMerkleProof) Unmarshal

func (m *BinaryMerkleProof) Unmarshal(dAtA []byte) error

func (*BinaryMerkleProof) XXX_DiscardUnknown

func (m *BinaryMerkleProof) XXX_DiscardUnknown()

func (*BinaryMerkleProof) XXX_Marshal

func (m *BinaryMerkleProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BinaryMerkleProof) XXX_Merge

func (m *BinaryMerkleProof) XXX_Merge(src proto.Message)

func (*BinaryMerkleProof) XXX_Size

func (m *BinaryMerkleProof) XXX_Size() int

func (*BinaryMerkleProof) XXX_Unmarshal

func (m *BinaryMerkleProof) XXX_Unmarshal(b []byte) error

type BridgeCommitmentLeaf

type BridgeCommitmentLeaf struct {
	// height is the block from which the last results hash was derived.
	Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// The ResultsHash of blocks is derived at (Height + 1) in the LastResultsHash
	// variable in the Tendermint block header, ref:
	// https://github.com/cometbft/cometbft/blob/v0.38.5/proto/tendermint/types/types.proto#L66.
	// Thus, to reconstruct this root at Height X, you would need the transactions
	// results from Height X - 1.
	LastResultsHash HexBytes `` /* 126-byte string literal not displayed */
}

func (*BridgeCommitmentLeaf) Descriptor

func (*BridgeCommitmentLeaf) Descriptor() ([]byte, []int)

func (*BridgeCommitmentLeaf) GetHeight

func (m *BridgeCommitmentLeaf) GetHeight() uint64

func (*BridgeCommitmentLeaf) GetLastResultsHash

func (m *BridgeCommitmentLeaf) GetLastResultsHash() HexBytes

func (*BridgeCommitmentLeaf) Marshal

func (m *BridgeCommitmentLeaf) Marshal() (dAtA []byte, err error)

func (*BridgeCommitmentLeaf) MarshalTo

func (m *BridgeCommitmentLeaf) MarshalTo(dAtA []byte) (int, error)

func (*BridgeCommitmentLeaf) MarshalToSizedBuffer

func (m *BridgeCommitmentLeaf) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BridgeCommitmentLeaf) ProtoMessage

func (*BridgeCommitmentLeaf) ProtoMessage()

func (*BridgeCommitmentLeaf) Reset

func (m *BridgeCommitmentLeaf) Reset()

func (*BridgeCommitmentLeaf) Size

func (m *BridgeCommitmentLeaf) Size() (n int)

func (*BridgeCommitmentLeaf) String

func (m *BridgeCommitmentLeaf) String() string

func (*BridgeCommitmentLeaf) Unmarshal

func (m *BridgeCommitmentLeaf) Unmarshal(dAtA []byte) error

func (*BridgeCommitmentLeaf) XXX_DiscardUnknown

func (m *BridgeCommitmentLeaf) XXX_DiscardUnknown()

func (*BridgeCommitmentLeaf) XXX_Marshal

func (m *BridgeCommitmentLeaf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BridgeCommitmentLeaf) XXX_Merge

func (m *BridgeCommitmentLeaf) XXX_Merge(src proto.Message)

func (*BridgeCommitmentLeaf) XXX_Size

func (m *BridgeCommitmentLeaf) XXX_Size() int

func (*BridgeCommitmentLeaf) XXX_Unmarshal

func (m *BridgeCommitmentLeaf) XXX_Unmarshal(b []byte) error

type HexBytes

type HexBytes = cmtbytes.HexBytes

type HexBytesSlice

type HexBytesSlice = []cmtbytes.HexBytes

type QueryBridgeCommitmentInclusionProofRequest

type QueryBridgeCommitmentInclusionProofRequest struct {
	// height is the block from which the last results hash will be obtained.
	Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// tx_index is the index of the transaction at its original block height.
	TxIndex int64 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
	// start is the start of the block range including the height.
	Start uint64 `protobuf:"varint,3,opt,name=start,proto3" json:"start,omitempty"`
	// end is the exclusive end of the block range including the height.
	End uint64 `protobuf:"varint,4,opt,name=end,proto3" json:"end,omitempty"`
}

QueryBridgeCommitmentInclusionProofRequest is request type for the Query/BridgeCommitmentInclusionProof RPC method.

func (*QueryBridgeCommitmentInclusionProofRequest) Descriptor

func (*QueryBridgeCommitmentInclusionProofRequest) GetEnd

func (*QueryBridgeCommitmentInclusionProofRequest) GetHeight

func (*QueryBridgeCommitmentInclusionProofRequest) GetStart

func (*QueryBridgeCommitmentInclusionProofRequest) GetTxIndex

func (*QueryBridgeCommitmentInclusionProofRequest) Marshal

func (m *QueryBridgeCommitmentInclusionProofRequest) Marshal() (dAtA []byte, err error)

func (*QueryBridgeCommitmentInclusionProofRequest) MarshalTo

func (m *QueryBridgeCommitmentInclusionProofRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryBridgeCommitmentInclusionProofRequest) MarshalToSizedBuffer

func (m *QueryBridgeCommitmentInclusionProofRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryBridgeCommitmentInclusionProofRequest) ProtoMessage

func (*QueryBridgeCommitmentInclusionProofRequest) Reset

func (*QueryBridgeCommitmentInclusionProofRequest) Size

func (*QueryBridgeCommitmentInclusionProofRequest) String

func (*QueryBridgeCommitmentInclusionProofRequest) Unmarshal

func (*QueryBridgeCommitmentInclusionProofRequest) XXX_DiscardUnknown

func (m *QueryBridgeCommitmentInclusionProofRequest) XXX_DiscardUnknown()

func (*QueryBridgeCommitmentInclusionProofRequest) XXX_Marshal

func (m *QueryBridgeCommitmentInclusionProofRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryBridgeCommitmentInclusionProofRequest) XXX_Merge

func (*QueryBridgeCommitmentInclusionProofRequest) XXX_Size

func (*QueryBridgeCommitmentInclusionProofRequest) XXX_Unmarshal

type QueryBridgeCommitmentInclusionProofResponse

type QueryBridgeCommitmentInclusionProofResponse struct {
	// bridge_commitment_leaf is the bridge commitment leaf involved in the
	// BridgeCommitmentMerkleProof and also the one containing the LastResultsHash
	// that is the root of the LastResultsMerkleProof.
	BridgeCommitmentLeaf BridgeCommitmentLeaf `protobuf:"bytes,1,opt,name=bridge_commitment_leaf,json=bridgeCommitmentLeaf,proto3" json:"bridge_commitment_leaf"`
	// bridge_commitment_proof is a merkle proof proving a BridgeCommitmentLeaf
	// was used to construct the BridgeCommitment merkle root.
	BridgeCommitmentProof BinaryMerkleProof `protobuf:"bytes,2,opt,name=bridge_commitment_proof,json=bridgeCommitmentProof,proto3" json:"bridge_commitment_proof"`
	// tx_result_marshalled is the marshalled deterministic form of the queried
	// transaction's ExecTxResult.
	TxResultMarshalled HexBytes `` /* 135-byte string literal not displayed */
	// last_results_proof is a merkle proof proving a transaction response was
	// used to form the LastResultsHash merkle root.
	LastResultsProof *BinaryMerkleProof `protobuf:"bytes,4,opt,name=last_results_proof,json=lastResultsProof,proto3" json:"last_results_proof,omitempty"`
}

QueryBridgeCommitmentInclusionProofResponse contains merkle proofs to show that a transaction response was used to construct the BridgeCommitment merkle root. It also includes the marshalled deterministic transaction result.

func (*QueryBridgeCommitmentInclusionProofResponse) Descriptor

func (*QueryBridgeCommitmentInclusionProofResponse) GetBridgeCommitmentLeaf

func (*QueryBridgeCommitmentInclusionProofResponse) GetBridgeCommitmentProof

func (m *QueryBridgeCommitmentInclusionProofResponse) GetBridgeCommitmentProof() BinaryMerkleProof

func (*QueryBridgeCommitmentInclusionProofResponse) GetLastResultsProof

func (*QueryBridgeCommitmentInclusionProofResponse) GetTxResultMarshalled

func (m *QueryBridgeCommitmentInclusionProofResponse) GetTxResultMarshalled() HexBytes

func (*QueryBridgeCommitmentInclusionProofResponse) Marshal

func (m *QueryBridgeCommitmentInclusionProofResponse) Marshal() (dAtA []byte, err error)

func (*QueryBridgeCommitmentInclusionProofResponse) MarshalTo

func (*QueryBridgeCommitmentInclusionProofResponse) MarshalToSizedBuffer

func (m *QueryBridgeCommitmentInclusionProofResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryBridgeCommitmentInclusionProofResponse) ProtoMessage

func (*QueryBridgeCommitmentInclusionProofResponse) Reset

func (*QueryBridgeCommitmentInclusionProofResponse) Size

func (*QueryBridgeCommitmentInclusionProofResponse) String

func (*QueryBridgeCommitmentInclusionProofResponse) Unmarshal

func (*QueryBridgeCommitmentInclusionProofResponse) XXX_DiscardUnknown

func (m *QueryBridgeCommitmentInclusionProofResponse) XXX_DiscardUnknown()

func (*QueryBridgeCommitmentInclusionProofResponse) XXX_Marshal

func (m *QueryBridgeCommitmentInclusionProofResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryBridgeCommitmentInclusionProofResponse) XXX_Merge

func (*QueryBridgeCommitmentInclusionProofResponse) XXX_Size

func (*QueryBridgeCommitmentInclusionProofResponse) XXX_Unmarshal

type QueryBridgeCommitmentRequest

type QueryBridgeCommitmentRequest struct {
	// start is the start of the block range that the bridge commitment covers.
	Start uint64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"`
	// end is the exclusive end of the block range that the bridge commitment
	// covers.
	End uint64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"`
}

QueryBridgeCommitmentRequest is request type for the Query/BridgeCommitment RPC method.

func (*QueryBridgeCommitmentRequest) Descriptor

func (*QueryBridgeCommitmentRequest) Descriptor() ([]byte, []int)

func (*QueryBridgeCommitmentRequest) GetEnd

func (*QueryBridgeCommitmentRequest) GetStart

func (m *QueryBridgeCommitmentRequest) GetStart() uint64

func (*QueryBridgeCommitmentRequest) Marshal

func (m *QueryBridgeCommitmentRequest) Marshal() (dAtA []byte, err error)

func (*QueryBridgeCommitmentRequest) MarshalTo

func (m *QueryBridgeCommitmentRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryBridgeCommitmentRequest) MarshalToSizedBuffer

func (m *QueryBridgeCommitmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryBridgeCommitmentRequest) ProtoMessage

func (*QueryBridgeCommitmentRequest) ProtoMessage()

func (*QueryBridgeCommitmentRequest) Reset

func (m *QueryBridgeCommitmentRequest) Reset()

func (*QueryBridgeCommitmentRequest) Size

func (m *QueryBridgeCommitmentRequest) Size() (n int)

func (*QueryBridgeCommitmentRequest) String

func (*QueryBridgeCommitmentRequest) Unmarshal

func (m *QueryBridgeCommitmentRequest) Unmarshal(dAtA []byte) error

func (*QueryBridgeCommitmentRequest) XXX_DiscardUnknown

func (m *QueryBridgeCommitmentRequest) XXX_DiscardUnknown()

func (*QueryBridgeCommitmentRequest) XXX_Marshal

func (m *QueryBridgeCommitmentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryBridgeCommitmentRequest) XXX_Merge

func (m *QueryBridgeCommitmentRequest) XXX_Merge(src proto.Message)

func (*QueryBridgeCommitmentRequest) XXX_Size

func (m *QueryBridgeCommitmentRequest) XXX_Size() int

func (*QueryBridgeCommitmentRequest) XXX_Unmarshal

func (m *QueryBridgeCommitmentRequest) XXX_Unmarshal(b []byte) error

type QueryBridgeCommitmentResponse

type QueryBridgeCommitmentResponse struct {
	BridgeCommitment HexBytes `` /* 127-byte string literal not displayed */
}

QueryBridgeCommitmentResponse contains the merkle root of successive BridgeCommitmentLeaf.

func (*QueryBridgeCommitmentResponse) Descriptor

func (*QueryBridgeCommitmentResponse) Descriptor() ([]byte, []int)

func (*QueryBridgeCommitmentResponse) GetBridgeCommitment

func (m *QueryBridgeCommitmentResponse) GetBridgeCommitment() HexBytes

func (*QueryBridgeCommitmentResponse) Marshal

func (m *QueryBridgeCommitmentResponse) Marshal() (dAtA []byte, err error)

func (*QueryBridgeCommitmentResponse) MarshalTo

func (m *QueryBridgeCommitmentResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryBridgeCommitmentResponse) MarshalToSizedBuffer

func (m *QueryBridgeCommitmentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryBridgeCommitmentResponse) ProtoMessage

func (*QueryBridgeCommitmentResponse) ProtoMessage()

func (*QueryBridgeCommitmentResponse) Reset

func (m *QueryBridgeCommitmentResponse) Reset()

func (*QueryBridgeCommitmentResponse) Size

func (m *QueryBridgeCommitmentResponse) Size() (n int)

func (*QueryBridgeCommitmentResponse) String

func (*QueryBridgeCommitmentResponse) Unmarshal

func (m *QueryBridgeCommitmentResponse) Unmarshal(dAtA []byte) error

func (*QueryBridgeCommitmentResponse) XXX_DiscardUnknown

func (m *QueryBridgeCommitmentResponse) XXX_DiscardUnknown()

func (*QueryBridgeCommitmentResponse) XXX_Marshal

func (m *QueryBridgeCommitmentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryBridgeCommitmentResponse) XXX_Merge

func (m *QueryBridgeCommitmentResponse) XXX_Merge(src proto.Message)

func (*QueryBridgeCommitmentResponse) XXX_Size

func (m *QueryBridgeCommitmentResponse) XXX_Size() int

func (*QueryBridgeCommitmentResponse) XXX_Unmarshal

func (m *QueryBridgeCommitmentResponse) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	// BridgeCommitment collects the transactions results roots over a provided
	// ordered range of blocks, and then creates a new merkle root. The range is
	// end exclusive.
	//
	// e.g. bridge_commitment?start=1&end=2
	BridgeCommitment(ctx context.Context, in *QueryBridgeCommitmentRequest, opts ...grpc.CallOption) (*QueryBridgeCommitmentResponse, error)
	// BridgeCommitmentInclusionProof creates two inclusion proofs to verify that
	// a transaction response is included in a BridgeCommitment. Users can also
	// verify any data in the transactions responses for data availability. Users
	// need to provide the height and the transaction index that the inclusion
	// proof is for. They also need to provide the indexes of the start and end
	// blocks for which the BridgeCommitment merkle root is constructed from. The
	// range for BridgeCommitment is end exclusive.
	//
	// e.g. bridge_commitment_inclusion_proof?height=2&tx_index=0&start=2&end=10
	BridgeCommitmentInclusionProof(ctx context.Context, in *QueryBridgeCommitmentInclusionProofRequest, opts ...grpc.CallOption) (*QueryBridgeCommitmentInclusionProofResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryServer

type QueryServer interface {
	// BridgeCommitment collects the transactions results roots over a provided
	// ordered range of blocks, and then creates a new merkle root. The range is
	// end exclusive.
	//
	// e.g. bridge_commitment?start=1&end=2
	BridgeCommitment(context.Context, *QueryBridgeCommitmentRequest) (*QueryBridgeCommitmentResponse, error)
	// BridgeCommitmentInclusionProof creates two inclusion proofs to verify that
	// a transaction response is included in a BridgeCommitment. Users can also
	// verify any data in the transactions responses for data availability. Users
	// need to provide the height and the transaction index that the inclusion
	// proof is for. They also need to provide the indexes of the start and end
	// blocks for which the BridgeCommitment merkle root is constructed from. The
	// range for BridgeCommitment is end exclusive.
	//
	// e.g. bridge_commitment_inclusion_proof?height=2&tx_index=0&start=2&end=10
	BridgeCommitmentInclusionProof(context.Context, *QueryBridgeCommitmentInclusionProofRequest) (*QueryBridgeCommitmentInclusionProofResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) BridgeCommitment

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL