types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName defines the module name.
	ModuleName = "attest"
)

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 (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)

Functions

func AttestationFromProto

func AttestationFromProto(att *Attestation) (xchain.Attestation, error)

AttestationFromProto converts a protobuf Attestation to a xchain.Attestation.

func AttestationsFromProto

func AttestationsFromProto(atts []*Attestation) ([]xchain.Attestation, error)

AttestationsFromProto converts a slice of protobuf Attestations to a slice of xchain.Attestations.

func BlockHeaderFromProto

func BlockHeaderFromProto(header *BlockHeader) (xchain.BlockHeader, error)

BlockHeaderFromProto converts a protobuf BlockHeader to a xchain.BlockHeader.

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterMsgServiceServer

func RegisterMsgServiceServer(s grpc1.Server, srv MsgServiceServer)

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func SigFromProto

func SigFromProto(sig *SigTuple) (xchain.SigTuple, error)

SigFromProto converts a protobuf SigTuple to a xchain.SigTuple.

Types

type AddVotesResponse

type AddVotesResponse struct {
}

func (*AddVotesResponse) Descriptor

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

func (*AddVotesResponse) Marshal

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

func (*AddVotesResponse) MarshalTo

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

func (*AddVotesResponse) MarshalToSizedBuffer

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

func (*AddVotesResponse) ProtoMessage

func (*AddVotesResponse) ProtoMessage()

func (*AddVotesResponse) Reset

func (m *AddVotesResponse) Reset()

func (*AddVotesResponse) Size

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

func (*AddVotesResponse) String

func (m *AddVotesResponse) String() string

func (*AddVotesResponse) Unmarshal

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

func (*AddVotesResponse) XXX_DiscardUnknown

func (m *AddVotesResponse) XXX_DiscardUnknown()

func (*AddVotesResponse) XXX_Marshal

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

func (*AddVotesResponse) XXX_Merge

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

func (*AddVotesResponse) XXX_Size

func (m *AddVotesResponse) XXX_Size() int

func (*AddVotesResponse) XXX_Unmarshal

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

type AggVote

type AggVote struct {
	BlockHeader     *BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"`
	AttestationRoot []byte       `protobuf:"bytes,2,opt,name=attestation_root,json=attestationRoot,proto3" json:"attestation_root,omitempty"`
	Signatures      []*SigTuple  `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"`
}

AggVote aggregates multiple votes of a cross-chain Block.

func (*AggVote) Descriptor

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

func (*AggVote) GetAttestationRoot added in v0.1.1

func (m *AggVote) GetAttestationRoot() []byte

func (*AggVote) GetBlockHeader

func (m *AggVote) GetBlockHeader() *BlockHeader

func (*AggVote) GetSignatures

func (m *AggVote) GetSignatures() []*SigTuple

func (*AggVote) Marshal

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

func (*AggVote) MarshalTo

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

func (*AggVote) MarshalToSizedBuffer

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

func (*AggVote) ProtoMessage

func (*AggVote) ProtoMessage()

func (*AggVote) Reset

func (m *AggVote) Reset()

func (*AggVote) Size

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

func (*AggVote) String

func (m *AggVote) String() string

func (*AggVote) Unmarshal

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

func (*AggVote) Verify

func (a *AggVote) Verify() error

func (*AggVote) XXX_DiscardUnknown

func (m *AggVote) XXX_DiscardUnknown()

func (*AggVote) XXX_Marshal

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

func (*AggVote) XXX_Merge

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

func (*AggVote) XXX_Size

func (m *AggVote) XXX_Size() int

func (*AggVote) XXX_Unmarshal

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

type Attestation

type Attestation struct {
	BlockHeader     *BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"`
	AttestationRoot []byte       `protobuf:"bytes,2,opt,name=attestation_root,json=attestationRoot,proto3" json:"attestation_root,omitempty"`
	Signatures      []*SigTuple  `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"`
	ValidatorSetId  uint64       `protobuf:"varint,4,opt,name=validator_set_id,json=validatorSetId,proto3" json:"validator_set_id,omitempty"`
}

Attestation contains quorum votes for a cross-chain block of a specific validator set.

func AttestationToProto

func AttestationToProto(att xchain.Attestation) *Attestation

AttestationToProto converts a xchain.Attestation to a protobuf Attestation.

func AttestationsToProto

func AttestationsToProto(atts []xchain.Attestation) []*Attestation

AttestationsToProto converts a slice of xchain.Attestations to a slice of protobuf Attestations.

func (*Attestation) Descriptor

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

func (*Attestation) GetAttestationRoot added in v0.1.1

func (m *Attestation) GetAttestationRoot() []byte

func (*Attestation) GetBlockHeader

func (m *Attestation) GetBlockHeader() *BlockHeader

func (*Attestation) GetSignatures

func (m *Attestation) GetSignatures() []*SigTuple

func (*Attestation) GetValidatorSetId added in v0.1.2

func (m *Attestation) GetValidatorSetId() uint64

func (*Attestation) Marshal

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

func (*Attestation) MarshalTo

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

func (*Attestation) MarshalToSizedBuffer

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

func (*Attestation) ProtoMessage

func (*Attestation) ProtoMessage()

func (*Attestation) Reset

func (m *Attestation) Reset()

func (*Attestation) Size

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

func (*Attestation) String

func (m *Attestation) String() string

func (*Attestation) ToXChain

func (a *Attestation) ToXChain() xchain.Attestation

func (*Attestation) Unmarshal

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

func (*Attestation) Verify

func (a *Attestation) Verify() error

func (*Attestation) XXX_DiscardUnknown

func (m *Attestation) XXX_DiscardUnknown()

func (*Attestation) XXX_Marshal

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

func (*Attestation) XXX_Merge

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

func (*Attestation) XXX_Size

func (m *Attestation) XXX_Size() int

func (*Attestation) XXX_Unmarshal

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

type AttestationsFromRequest

type AttestationsFromRequest struct {
	ChainId    uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	FromHeight uint64 `protobuf:"varint,2,opt,name=from_height,json=fromHeight,proto3" json:"from_height,omitempty"`
}

ApprovedFromRequest queries halo for approved attestations for the given chain_id and from the given height (inclusive). The response will contain at most max attestations sequentially following from_height.

func (*AttestationsFromRequest) Descriptor

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

func (*AttestationsFromRequest) GetChainId

func (m *AttestationsFromRequest) GetChainId() uint64

func (*AttestationsFromRequest) GetFromHeight

func (m *AttestationsFromRequest) GetFromHeight() uint64

func (*AttestationsFromRequest) Marshal

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

func (*AttestationsFromRequest) MarshalTo

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

func (*AttestationsFromRequest) MarshalToSizedBuffer

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

func (*AttestationsFromRequest) ProtoMessage

func (*AttestationsFromRequest) ProtoMessage()

func (*AttestationsFromRequest) Reset

func (m *AttestationsFromRequest) Reset()

func (*AttestationsFromRequest) Size

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

func (*AttestationsFromRequest) String

func (m *AttestationsFromRequest) String() string

func (*AttestationsFromRequest) Unmarshal

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

func (*AttestationsFromRequest) XXX_DiscardUnknown

func (m *AttestationsFromRequest) XXX_DiscardUnknown()

func (*AttestationsFromRequest) XXX_Marshal

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

func (*AttestationsFromRequest) XXX_Merge

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

func (*AttestationsFromRequest) XXX_Size

func (m *AttestationsFromRequest) XXX_Size() int

func (*AttestationsFromRequest) XXX_Unmarshal

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

type AttestationsFromResponse

type AttestationsFromResponse struct {
	Attestations []*Attestation `protobuf:"bytes,1,rep,name=attestations,proto3" json:"attestations,omitempty"`
}

func (*AttestationsFromResponse) Descriptor

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

func (*AttestationsFromResponse) GetAttestations

func (m *AttestationsFromResponse) GetAttestations() []*Attestation

func (*AttestationsFromResponse) Marshal

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

func (*AttestationsFromResponse) MarshalTo

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

func (*AttestationsFromResponse) MarshalToSizedBuffer

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

func (*AttestationsFromResponse) ProtoMessage

func (*AttestationsFromResponse) ProtoMessage()

func (*AttestationsFromResponse) Reset

func (m *AttestationsFromResponse) Reset()

func (*AttestationsFromResponse) Size

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

func (*AttestationsFromResponse) String

func (m *AttestationsFromResponse) String() string

func (*AttestationsFromResponse) Unmarshal

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

func (*AttestationsFromResponse) XXX_DiscardUnknown

func (m *AttestationsFromResponse) XXX_DiscardUnknown()

func (*AttestationsFromResponse) XXX_Marshal

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

func (*AttestationsFromResponse) XXX_Merge

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

func (*AttestationsFromResponse) XXX_Size

func (m *AttestationsFromResponse) XXX_Size() int

func (*AttestationsFromResponse) XXX_Unmarshal

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

type BlockHeader

type BlockHeader struct {
	ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	Height  uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	Hash    []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"`
}

BlockHeader uniquely identifies a cross chain block.

func BlockHeaderToProto

func BlockHeaderToProto(header xchain.BlockHeader) *BlockHeader

BlockHeaderToProto converts a xchain.BlockHeader to a protobuf BlockHeader.

func (*BlockHeader) Descriptor

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

func (*BlockHeader) GetChainId

func (m *BlockHeader) GetChainId() uint64

func (*BlockHeader) GetHash

func (m *BlockHeader) GetHash() []byte

func (*BlockHeader) GetHeight

func (m *BlockHeader) GetHeight() uint64

func (*BlockHeader) Marshal

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

func (*BlockHeader) MarshalTo

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

func (*BlockHeader) MarshalToSizedBuffer

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

func (*BlockHeader) ProtoMessage

func (*BlockHeader) ProtoMessage()

func (*BlockHeader) Reset

func (m *BlockHeader) Reset()

func (*BlockHeader) Size

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

func (*BlockHeader) String

func (m *BlockHeader) String() string

func (*BlockHeader) ToXChain

func (h *BlockHeader) ToXChain() xchain.BlockHeader

func (*BlockHeader) Unmarshal

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

func (*BlockHeader) Verify

func (h *BlockHeader) Verify() error

func (*BlockHeader) XXX_DiscardUnknown

func (m *BlockHeader) XXX_DiscardUnknown()

func (*BlockHeader) XXX_Marshal

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

func (*BlockHeader) XXX_Merge

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

func (*BlockHeader) XXX_Size

func (m *BlockHeader) XXX_Size() int

func (*BlockHeader) XXX_Unmarshal

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

type ChainNameFunc

type ChainNameFunc func(chainID uint64) string

ChainNameFunc is a function that returns the name of a chain given its ID.

type LatestAttestationRequest

type LatestAttestationRequest struct {
	ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}

func (*LatestAttestationRequest) Descriptor

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

func (*LatestAttestationRequest) GetChainId

func (m *LatestAttestationRequest) GetChainId() uint64

func (*LatestAttestationRequest) Marshal

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

func (*LatestAttestationRequest) MarshalTo

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

func (*LatestAttestationRequest) MarshalToSizedBuffer

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

func (*LatestAttestationRequest) ProtoMessage

func (*LatestAttestationRequest) ProtoMessage()

func (*LatestAttestationRequest) Reset

func (m *LatestAttestationRequest) Reset()

func (*LatestAttestationRequest) Size

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

func (*LatestAttestationRequest) String

func (m *LatestAttestationRequest) String() string

func (*LatestAttestationRequest) Unmarshal

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

func (*LatestAttestationRequest) XXX_DiscardUnknown

func (m *LatestAttestationRequest) XXX_DiscardUnknown()

func (*LatestAttestationRequest) XXX_Marshal

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

func (*LatestAttestationRequest) XXX_Merge

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

func (*LatestAttestationRequest) XXX_Size

func (m *LatestAttestationRequest) XXX_Size() int

func (*LatestAttestationRequest) XXX_Unmarshal

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

type LatestAttestationResponse

type LatestAttestationResponse struct {
	Attestation *Attestation `protobuf:"bytes,1,opt,name=attestation,proto3" json:"attestation,omitempty"`
}

func (*LatestAttestationResponse) Descriptor

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

func (*LatestAttestationResponse) GetAttestation

func (m *LatestAttestationResponse) GetAttestation() *Attestation

func (*LatestAttestationResponse) Marshal

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

func (*LatestAttestationResponse) MarshalTo

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

func (*LatestAttestationResponse) MarshalToSizedBuffer

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

func (*LatestAttestationResponse) ProtoMessage

func (*LatestAttestationResponse) ProtoMessage()

func (*LatestAttestationResponse) Reset

func (m *LatestAttestationResponse) Reset()

func (*LatestAttestationResponse) Size

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

func (*LatestAttestationResponse) String

func (m *LatestAttestationResponse) String() string

func (*LatestAttestationResponse) Unmarshal

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

func (*LatestAttestationResponse) XXX_DiscardUnknown

func (m *LatestAttestationResponse) XXX_DiscardUnknown()

func (*LatestAttestationResponse) XXX_Marshal

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

func (*LatestAttestationResponse) XXX_Merge

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

func (*LatestAttestationResponse) XXX_Size

func (m *LatestAttestationResponse) XXX_Size() int

func (*LatestAttestationResponse) XXX_Unmarshal

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

type MsgAddVotes

type MsgAddVotes struct {
	Authority string     `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
	Votes     []*AggVote `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes,omitempty"`
}

MsgAddVotes contains multiple aggregated votes for different cross-chain Blocks.

func (*MsgAddVotes) Descriptor

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

func (*MsgAddVotes) GetAuthority

func (m *MsgAddVotes) GetAuthority() string

func (*MsgAddVotes) GetVotes

func (m *MsgAddVotes) GetVotes() []*AggVote

func (*MsgAddVotes) Marshal

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

func (*MsgAddVotes) MarshalTo

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

func (*MsgAddVotes) MarshalToSizedBuffer

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

func (*MsgAddVotes) ProtoMessage

func (*MsgAddVotes) ProtoMessage()

func (*MsgAddVotes) Reset

func (m *MsgAddVotes) Reset()

func (*MsgAddVotes) Size

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

func (*MsgAddVotes) String

func (m *MsgAddVotes) String() string

func (*MsgAddVotes) Unmarshal

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

func (*MsgAddVotes) XXX_DiscardUnknown

func (m *MsgAddVotes) XXX_DiscardUnknown()

func (*MsgAddVotes) XXX_Marshal

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

func (*MsgAddVotes) XXX_Merge

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

func (*MsgAddVotes) XXX_Size

func (m *MsgAddVotes) XXX_Size() int

func (*MsgAddVotes) XXX_Unmarshal

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

type MsgServiceClient

type MsgServiceClient interface {
	// AddVotes processes aggregate votes included in a proposed or finalised block.
	AddVotes(ctx context.Context, in *MsgAddVotes, opts ...grpc.CallOption) (*AddVotesResponse, error)
}

MsgServiceClient is the client API for MsgService service.

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

func NewMsgServiceClient

func NewMsgServiceClient(cc grpc1.ClientConn) MsgServiceClient

type MsgServiceServer

type MsgServiceServer interface {
	// AddVotes processes aggregate votes included in a proposed or finalised block.
	AddVotes(context.Context, *MsgAddVotes) (*AddVotesResponse, error)
}

MsgServiceServer is the server API for MsgService service.

type QueryClient

type QueryClient interface {
	// AttestationsFrom queries halo for approved attestations for the given chain_id
	// and from the given height (inclusive). The response will contain at most max attestations sequentially
	// following from_height.
	AttestationsFrom(ctx context.Context, in *AttestationsFromRequest, opts ...grpc.CallOption) (*AttestationsFromResponse, error)
	// LatestAttestation queries halo for the latest approved attestations for the given chain_id.
	LatestAttestation(ctx context.Context, in *LatestAttestationRequest, opts ...grpc.CallOption) (*LatestAttestationResponse, error)
	// WindowCompare compares the given chain height to the vote window.
	// It returns whether the request is behind (-1), or in (0), or after (1) the vote window.
	// The vote window is a configured number of blocks around the latest approved attestation.
	WindowCompare(ctx context.Context, in *WindowCompareRequest, opts ...grpc.CallOption) (*WindowCompareResponse, 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 {
	// AttestationsFrom queries halo for approved attestations for the given chain_id
	// and from the given height (inclusive). The response will contain at most max attestations sequentially
	// following from_height.
	AttestationsFrom(context.Context, *AttestationsFromRequest) (*AttestationsFromResponse, error)
	// LatestAttestation queries halo for the latest approved attestations for the given chain_id.
	LatestAttestation(context.Context, *LatestAttestationRequest) (*LatestAttestationResponse, error)
	// WindowCompare compares the given chain height to the vote window.
	// It returns whether the request is behind (-1), or in (0), or after (1) the vote window.
	// The vote window is a configured number of blocks around the latest approved attestation.
	WindowCompare(context.Context, *WindowCompareRequest) (*WindowCompareResponse, error)
}

QueryServer is the server API for Query service.

type SigTuple

type SigTuple struct {
	ValidatorAddress []byte `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"`
	Signature        []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

SigTuple is a validator public key and signature (over the attestation root).

func SigToProto

func SigToProto(sig xchain.SigTuple) *SigTuple

SigToProto converts a xchain.SigTuple to a protobuf SigTuple.

func (*SigTuple) Descriptor

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

func (*SigTuple) GetSignature

func (m *SigTuple) GetSignature() []byte

func (*SigTuple) GetValidatorAddress

func (m *SigTuple) GetValidatorAddress() []byte

func (*SigTuple) Marshal

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

func (*SigTuple) MarshalTo

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

func (*SigTuple) MarshalToSizedBuffer

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

func (*SigTuple) ProtoMessage

func (*SigTuple) ProtoMessage()

func (*SigTuple) Reset

func (m *SigTuple) Reset()

func (*SigTuple) Size

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

func (*SigTuple) String

func (m *SigTuple) String() string

func (*SigTuple) ToXChain

func (s *SigTuple) ToXChain() xchain.SigTuple

func (*SigTuple) Unmarshal

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

func (*SigTuple) Verify

func (s *SigTuple) Verify() error

func (*SigTuple) XXX_DiscardUnknown

func (m *SigTuple) XXX_DiscardUnknown()

func (*SigTuple) XXX_Marshal

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

func (*SigTuple) XXX_Merge

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

func (*SigTuple) XXX_Size

func (m *SigTuple) XXX_Size() int

func (*SigTuple) XXX_Unmarshal

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

type UnimplementedMsgServiceServer

type UnimplementedMsgServiceServer struct {
}

UnimplementedMsgServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServiceServer) AddVotes

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) AttestationsFrom

func (*UnimplementedQueryServer) LatestAttestation

func (*UnimplementedQueryServer) WindowCompare

type UniqueKey added in v0.1.1

type UniqueKey struct {
	xchain.BlockHeader
	AttestationRoot common.Hash
}

UniqueKey uniquely identifies a vote/aggregate vote/attestation.

type Vote

type Vote struct {
	BlockHeader     *BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"`
	AttestationRoot []byte       `protobuf:"bytes,2,opt,name=attestation_root,json=attestationRoot,proto3" json:"attestation_root,omitempty"`
	Signature       *SigTuple    `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
}

Vote by a validator of a cross-chain Block.

func (*Vote) Descriptor

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

func (*Vote) GetAttestationRoot added in v0.1.1

func (m *Vote) GetAttestationRoot() []byte

func (*Vote) GetBlockHeader

func (m *Vote) GetBlockHeader() *BlockHeader

func (*Vote) GetSignature

func (m *Vote) GetSignature() *SigTuple

func (*Vote) Marshal

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

func (*Vote) MarshalTo

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

func (*Vote) MarshalToSizedBuffer

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

func (*Vote) ProtoMessage

func (*Vote) ProtoMessage()

func (*Vote) Reset

func (m *Vote) Reset()

func (*Vote) Size

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

func (*Vote) String

func (m *Vote) String() string

func (*Vote) ToXChain

func (v *Vote) ToXChain() xchain.Vote

func (*Vote) UniqueKey added in v0.1.1

func (v *Vote) UniqueKey() UniqueKey

UniqueKey returns a unique key for the vote It panics if the vote is invalid. Ensure Verify() is called before UniqueKey().

func (*Vote) Unmarshal

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

func (*Vote) Verify

func (v *Vote) Verify() error

func (*Vote) XXX_DiscardUnknown

func (m *Vote) XXX_DiscardUnknown()

func (*Vote) XXX_Marshal

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

func (*Vote) XXX_Merge

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

func (*Vote) XXX_Size

func (m *Vote) XXX_Size() int

func (*Vote) XXX_Unmarshal

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

type Voter

type Voter interface {
	// GetAvailable returns all "available" votes in the vote window.
	// This basically queries all "available" votes and filters by current vote window.
	GetAvailable() []*Vote

	// SetProposed updates the status of the provided votes to "proposed",
	// i.e., they were included by a proposer in a new proposed block.
	// All other existing "proposed" votes are reset to "available", i.e. they were
	// proposed previously by another proposer, but that block was never finalized/committed.
	SetProposed(headers []*BlockHeader) error

	// SetCommitted updates the status of the provided votes to "committed",
	// i.e., they were included in a finalized consensus block and is now part of the consensus chain.
	// All other existing "proposed" votes are reset to "available", i.e. we probably
	// missed the proposal step and only learnt of the finalized block post-fact.
	// All but the latest "confirmed" attestation for each source chain can be safely deleted from disk.
	SetCommitted(headers []*BlockHeader) error

	// LocalAddress returns the local validator's ethereum address.
	LocalAddress() common.Address

	// TrimBehind deletes all available votes that are behind the vote window edges (map[chainID]edge) since
	// they will never be committed. It returns the number that was deleted.
	TrimBehind(edgesByChain map[uint64]uint64) int
}

Voter abstracts the validator duty of v∂oting for all XBlocks for all source chains.

It streams all finalized XBlocks from all source chains. It creates a Vote for each (a signature). It stores these to disk, setting their status as "available".

type VoterDeps

type VoterDeps interface {
	// IsValidator returns true if the given address is a validator on the given chain at the time of calling.
	IsValidator(ctx context.Context, address common.Address) bool
	// WindowCompare returns wether the given attestation block header is behind (-1), or in (0), or ahead (1)
	// of the current vote window. The vote window is a configured number of blocks around the latest approved
	// attestation for the provided chain.
	WindowCompare(ctx context.Context, chainID uint64, height uint64) (int, error)
	// LatestAttestationHeight returns the latest approved attestation height for the given chain.
	LatestAttestationHeight(ctx context.Context, chainID uint64) (uint64, bool, error)
}

VoterDeps abstracts the Voter's internal cosmosSDK dependencies; basically the attest keeper. They have a circular dependency.

type Votes

type Votes struct {
	Votes []*Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes,omitempty"`
}

Votes contains multiple votes for different cross-chain Blocks. Usually by the same validator.

func (*Votes) Descriptor

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

func (*Votes) GetVotes

func (m *Votes) GetVotes() []*Vote

func (*Votes) Marshal

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

func (*Votes) MarshalTo

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

func (*Votes) MarshalToSizedBuffer

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

func (*Votes) ProtoMessage

func (*Votes) ProtoMessage()

func (*Votes) Reset

func (m *Votes) Reset()

func (*Votes) Size

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

func (*Votes) String

func (m *Votes) String() string

func (*Votes) Unmarshal

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

func (*Votes) XXX_DiscardUnknown

func (m *Votes) XXX_DiscardUnknown()

func (*Votes) XXX_Marshal

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

func (*Votes) XXX_Merge

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

func (*Votes) XXX_Size

func (m *Votes) XXX_Size() int

func (*Votes) XXX_Unmarshal

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

type WindowCompareRequest

type WindowCompareRequest struct {
	ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	Height  uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
}

func (*WindowCompareRequest) Descriptor

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

func (*WindowCompareRequest) GetChainId

func (m *WindowCompareRequest) GetChainId() uint64

func (*WindowCompareRequest) GetHeight

func (m *WindowCompareRequest) GetHeight() uint64

func (*WindowCompareRequest) Marshal

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

func (*WindowCompareRequest) MarshalTo

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

func (*WindowCompareRequest) MarshalToSizedBuffer

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

func (*WindowCompareRequest) ProtoMessage

func (*WindowCompareRequest) ProtoMessage()

func (*WindowCompareRequest) Reset

func (m *WindowCompareRequest) Reset()

func (*WindowCompareRequest) Size

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

func (*WindowCompareRequest) String

func (m *WindowCompareRequest) String() string

func (*WindowCompareRequest) Unmarshal

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

func (*WindowCompareRequest) XXX_DiscardUnknown

func (m *WindowCompareRequest) XXX_DiscardUnknown()

func (*WindowCompareRequest) XXX_Marshal

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

func (*WindowCompareRequest) XXX_Merge

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

func (*WindowCompareRequest) XXX_Size

func (m *WindowCompareRequest) XXX_Size() int

func (*WindowCompareRequest) XXX_Unmarshal

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

type WindowCompareResponse

type WindowCompareResponse struct {
	Cmp int32 `protobuf:"varint,1,opt,name=cmp,proto3" json:"cmp,omitempty"`
}

func (*WindowCompareResponse) Descriptor

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

func (*WindowCompareResponse) GetCmp

func (m *WindowCompareResponse) GetCmp() int32

func (*WindowCompareResponse) Marshal

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

func (*WindowCompareResponse) MarshalTo

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

func (*WindowCompareResponse) MarshalToSizedBuffer

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

func (*WindowCompareResponse) ProtoMessage

func (*WindowCompareResponse) ProtoMessage()

func (*WindowCompareResponse) Reset

func (m *WindowCompareResponse) Reset()

func (*WindowCompareResponse) Size

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

func (*WindowCompareResponse) String

func (m *WindowCompareResponse) String() string

func (*WindowCompareResponse) Unmarshal

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

func (*WindowCompareResponse) XXX_DiscardUnknown

func (m *WindowCompareResponse) XXX_DiscardUnknown()

func (*WindowCompareResponse) XXX_Marshal

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

func (*WindowCompareResponse) XXX_Merge

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

func (*WindowCompareResponse) XXX_Size

func (m *WindowCompareResponse) XXX_Size() int

func (*WindowCompareResponse) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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