proofs

package
v0.0.0-...-1329066 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthProofs        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProofs          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupProofs = fmt.Errorf("proto: unexpected end of group")
)

Functions

func IsErrorInvalidProof

func IsErrorInvalidProof(err error) bool

IsErrorInvalidProof returns true if the error is an ErrInvalidProof

func ValidateBitcoinHeader

func ValidateBitcoinHeader(headerBytes []byte, blockHash []byte, chainID int64) error

Types

type BlockHeader

type BlockHeader struct {
	Height     int64  `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	Hash       []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	ParentHash []byte `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
	ChainId    int64  `protobuf:"varint,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	// chain specific header
	Header HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"`
}

func (*BlockHeader) Descriptor

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

func (*BlockHeader) GetChainId

func (m *BlockHeader) GetChainId() int64

func (*BlockHeader) GetHash

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

func (*BlockHeader) GetHeader

func (m *BlockHeader) GetHeader() HeaderData

func (*BlockHeader) GetHeight

func (m *BlockHeader) GetHeight() int64

func (*BlockHeader) GetParentHash

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

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) Unmarshal

func (m *BlockHeader) Unmarshal(dAtA []byte) 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 ErrInvalidProof

type ErrInvalidProof struct {
	Err error
}

ErrInvalidProof is a error type for invalid proofs embedding the underlying error

func NewErrInvalidProof

func NewErrInvalidProof(err error) ErrInvalidProof

func (ErrInvalidProof) Error

func (e ErrInvalidProof) Error() string

type HeaderData

type HeaderData struct {
	// Types that are valid to be assigned to Data:
	//
	//	*HeaderData_EthereumHeader
	//	*HeaderData_BitcoinHeader
	Data isHeaderData_Data `protobuf_oneof:"data"`
}

func NewBitcoinHeader

func NewBitcoinHeader(header []byte) HeaderData

NewBitcoinHeader returns a new HeaderData containing a Bitcoin header

func NewEthereumHeader

func NewEthereumHeader(header []byte) HeaderData

NewEthereumHeader returns a new HeaderData containing an Ethereum header

func (*HeaderData) Descriptor

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

func (*HeaderData) GetBitcoinHeader

func (m *HeaderData) GetBitcoinHeader() []byte

func (*HeaderData) GetData

func (m *HeaderData) GetData() isHeaderData_Data

func (*HeaderData) GetEthereumHeader

func (m *HeaderData) GetEthereumHeader() []byte

func (*HeaderData) Marshal

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

func (*HeaderData) MarshalTo

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

func (*HeaderData) MarshalToSizedBuffer

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

func (HeaderData) ParentHash

func (h HeaderData) ParentHash() ([]byte, error)

ParentHash extracts the parent hash from the header

func (*HeaderData) ProtoMessage

func (*HeaderData) ProtoMessage()

func (*HeaderData) Reset

func (m *HeaderData) Reset()

func (*HeaderData) Size

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

func (*HeaderData) String

func (m *HeaderData) String() string

func (*HeaderData) Unmarshal

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

func (HeaderData) Validate

func (h HeaderData) Validate(blockHash []byte, chainID int64, height int64) error

Validate performs a basic validation of the HeaderData

func (HeaderData) ValidateTimestamp

func (h HeaderData) ValidateTimestamp(zetaTime time.Time) error

func (*HeaderData) XXX_DiscardUnknown

func (m *HeaderData) XXX_DiscardUnknown()

func (*HeaderData) XXX_Marshal

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

func (*HeaderData) XXX_Merge

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

func (*HeaderData) XXX_OneofWrappers

func (*HeaderData) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*HeaderData) XXX_Size

func (m *HeaderData) XXX_Size() int

func (*HeaderData) XXX_Unmarshal

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

type HeaderData_BitcoinHeader

type HeaderData_BitcoinHeader struct {
	BitcoinHeader []byte `protobuf:"bytes,2,opt,name=bitcoin_header,json=bitcoinHeader,proto3,oneof" json:"bitcoin_header,omitempty"`
}

func (*HeaderData_BitcoinHeader) MarshalTo

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

func (*HeaderData_BitcoinHeader) MarshalToSizedBuffer

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

func (*HeaderData_BitcoinHeader) Size

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

type HeaderData_EthereumHeader

type HeaderData_EthereumHeader struct {
	EthereumHeader []byte `protobuf:"bytes,1,opt,name=ethereum_header,json=ethereumHeader,proto3,oneof" json:"ethereum_header,omitempty"`
}

func (*HeaderData_EthereumHeader) MarshalTo

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

func (*HeaderData_EthereumHeader) MarshalToSizedBuffer

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

func (*HeaderData_EthereumHeader) Size

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

type Proof

type Proof struct {
	// Types that are valid to be assigned to Proof:
	//
	//	*Proof_EthereumProof
	//	*Proof_BitcoinProof
	Proof isProof_Proof `protobuf_oneof:"proof"`
}

func NewBitcoinProof

func NewBitcoinProof(txBytes []byte, path []byte, index uint) *Proof

NewBitcoinProof returns a new Proof containing a Bitcoin proof

func NewEthereumProof

func NewEthereumProof(proof *ethereum.Proof) *Proof

NewEthereumProof returns a new Proof containing an Ethereum proof

func (*Proof) Descriptor

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

func (*Proof) GetBitcoinProof

func (m *Proof) GetBitcoinProof() *bitcoin.Proof

func (*Proof) GetEthereumProof

func (m *Proof) GetEthereumProof() *ethereum.Proof

func (*Proof) GetProof

func (m *Proof) GetProof() isProof_Proof

func (*Proof) Marshal

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

func (*Proof) MarshalTo

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

func (*Proof) MarshalToSizedBuffer

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

func (*Proof) ProtoMessage

func (*Proof) ProtoMessage()

func (*Proof) Reset

func (m *Proof) Reset()

func (*Proof) Size

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

func (*Proof) String

func (m *Proof) String() string

func (*Proof) Unmarshal

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

func (Proof) Verify

func (p Proof) Verify(headerData HeaderData, txIndex int) ([]byte, error)

Verify verifies the proof against the header Returns the verified tx in bytes if the verification is successful

func (*Proof) XXX_DiscardUnknown

func (m *Proof) XXX_DiscardUnknown()

func (*Proof) XXX_Marshal

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

func (*Proof) XXX_Merge

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

func (*Proof) XXX_OneofWrappers

func (*Proof) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Proof) XXX_Size

func (m *Proof) XXX_Size() int

func (*Proof) XXX_Unmarshal

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

type Proof_BitcoinProof

type Proof_BitcoinProof struct {
	BitcoinProof *bitcoin.Proof `protobuf:"bytes,2,opt,name=bitcoin_proof,json=bitcoinProof,proto3,oneof" json:"bitcoin_proof,omitempty"`
}

func (*Proof_BitcoinProof) MarshalTo

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

func (*Proof_BitcoinProof) MarshalToSizedBuffer

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

func (*Proof_BitcoinProof) Size

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

type Proof_EthereumProof

type Proof_EthereumProof struct {
	EthereumProof *ethereum.Proof `protobuf:"bytes,1,opt,name=ethereum_proof,json=ethereumProof,proto3,oneof" json:"ethereum_proof,omitempty"`
}

func (*Proof_EthereumProof) MarshalTo

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

func (*Proof_EthereumProof) MarshalToSizedBuffer

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

func (*Proof_EthereumProof) Size

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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