types

package
v0.0.0-...-30704ab Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultCodespace is the default code space
	DefaultCodespace sdk.CodespaceType = ModuleName

	// BadHeaderLength means Header array length not divisible by 80
	BadHeaderLength sdk.CodeType = 101
	// BadHeaderLengthMessage is the corresponding message
	BadHeaderLengthMessage = "Header array length must be divisble by 80 but header labeled %s with header %x has length %d"

	// BadHeight occurs when a proposed descendant is below a proposed ancestor
	BadHeight sdk.CodeType = 102
	// BadHeightMessage is the corresponding message
	BadHeightMessage = "Block labeled %s with digest %x is below the ancestor height"

	// HeightMismatch occurs when blocks do not have have consecutive height increments
	HeightMismatch sdk.CodeType = 103
	// HeightMismatchMessage is the corresponding message
	HeightMismatchMessage = "Height mismatch between blocks %x and %x"

	// UnknownBlock is the error code for unknown blocks
	UnknownBlock sdk.CodeType = 104
	// UnknownBlockMessage is the corresponding message
	UnknownBlockMessage = "Unknown block labeled %s with digest %x"

	// BadHash256Digest occurs when a wrong-length hash256 digest is found
	BadHash256Digest sdk.CodeType = 105
	// BadHash256DigestMessage is the corresponding message
	BadHash256DigestMessage = "Digest %s had wrong length"

	// BadHex occurs when a hex argument couldn't be deserialized
	BadHex sdk.CodeType = 106
	// BadHexMessage is the corresponding message
	BadHexMessage = "Bad hex string in query or msg: %s"

	// BadHexLen occurs when a hex argument is the wrong length
	BadHexLen sdk.CodeType = 107
	// BadHexLenMessage is the corresponding message
	BadHexLenMessage = "Expected %d bytes in a RequestID, got %d"

	// BitcoinSPV is the code for errors bubbled up from Bitcoin SPV
	BitcoinSPV sdk.CodeType = 108

	// AlreadyInit is the code for a second attempt to init the relay
	AlreadyInit sdk.CodeType = 109
	// AlreadyInitMessage is the corresponding message
	AlreadyInitMessage = "Relay has already set genesis state"

	// BadOffset occurs when chain has traversed to block with no link
	BadOffset sdk.CodeType = 110
	// BadOffsetMessage is the corresponding message
	BadOffsetMessage = "Reached bottom of relay chain: block with digest %x has no link"

	// UnexpectedRetarget indicates a retarget was seen during AddHeaders loop
	UnexpectedRetarget sdk.CodeType = 201
	// UnexpectedRetargetMessage is the corresponding message
	UnexpectedRetargetMessage = "Target changed unexpectedly at block %x"

	// WrongEnd means the end block is at the wrong height
	WrongEnd sdk.CodeType = 301
	// WrongEndMessage is the corresponding message
	WrongEndMessage = "Must provide the last header of the closing difficulty period"

	// WrongStart means the start block is at the wrong height
	WrongStart sdk.CodeType = 302
	// WrongStartMessage is the corresponding message
	WrongStartMessage = "Must provide exactly 1 difficulty period"

	// PeriodMismatch means the start and end block do not have the same difficulty
	PeriodMismatch sdk.CodeType = 303
	// PeriodMismatchMessage is the corresponding message
	PeriodMismatchMessage = "Period header difficulties do not match"

	// BadRetarget means the provided blocks did not create the expected retarget
	BadRetarget sdk.CodeType = 304
	// BadRetargetMessage is the corresponding message
	BadRetargetMessage = "Invalid retarget provided"

	// LimitTooHigh indicates that the requested limit is >2016
	LimitTooHigh sdk.CodeType = 402
	// LimitTooHighMessage is the corresponding message
	LimitTooHighMessage = "Requested lookup limit must be 2016 or lower. Got %d"

	// NotBestKnown means a block should have been the best known, but wasn't
	NotBestKnown sdk.CodeType = 403
	// NotBestKnownMessage is the corresponding message
	NotBestKnownMessage = "Provided digest %x is not current best known, expecting block with hash %x"

	// NotHeaviestAncestor means a later common ancestor was found
	NotHeaviestAncestor sdk.CodeType = 404
	// NotHeaviestAncestorMessage is the corresponding message
	NotHeaviestAncestorMessage = "Ancestor %x is not heaviest common ancestor"

	// NotHeavier means the proposed new best is not heavier than the current best
	NotHeavier sdk.CodeType = 405
	// NotHeavierMessage is the corresponding message
	NotHeavierMessage = "New best received %x does not have more work than previous best %x"

	// MarshalJSON means there was an error marshalling a query result to json
	MarshalJSON sdk.CodeType = 503
	// MarshalJSONMessage is the corresponding message
	MarshalJSONMessage = "Could not marshal result to JSON"

	// UnknownRequest means the request was not found
	UnknownRequest sdk.CodeType = 601
	// UnknownRequestMessage is the corresponding message
	UnknownRequestMessage = "Request not found"

	// SpendsLength means the spend value is not 36 bytes
	SpendsLength sdk.CodeType = 602
	// SpendsLengthMessage is the corresponding message
	SpendsLengthMessage = "Spends value is not 36 bytes"

	// PaysLength means the pays value is greater than 50 bytes
	PaysLength sdk.CodeType = 603
	// PaysLengthMessage is the corresponding message
	PaysLengthMessage = "Pays value is greater than 50 bytes"

	// InvalidVin means the vin is not valid
	InvalidVin sdk.CodeType = 604
	// InvalidVinMessage is the corresponding message
	InvalidVinMessage = "Vin is not valid"

	// InvalidVout means the vout is not valid
	InvalidVout sdk.CodeType = 605
	// InvalidVoutMessage is the corresponding message
	InvalidVoutMessage = "Vout is not valid"

	// ClosedRequest means the request is not active
	ClosedRequest sdk.CodeType = 606
	// ClosedRequestMessage is the corresponding message
	ClosedRequestMessage = "Request is not active"

	// RequestPays means the output does not match the pays request
	RequestPays sdk.CodeType = 607
	// RequestPaysMessage is the corresponding message
	RequestPaysMessage = "Output does not match pays for requestID %d"

	// RequestValue means the pays value and value of the output does not match
	RequestValue sdk.CodeType = 608
	// RequestValueMessage is the corresponding message
	RequestValueMessage = "Output value does not match pays value for requestID %d"

	// RequestSpends means the request spends does not match the input
	RequestSpends sdk.CodeType = 609
	// RequestSpendsMessage is the corresponding message
	RequestSpendsMessage = "Input does not match spends for requestID %d"

	// NotAncestor means the LCA is not an ancestor of the SPV Proof header
	NotAncestor sdk.CodeType = 610
	// NotAncestorMessage is the corresponding message
	NotAncestorMessage = "LCA %x not ancestor of proof header"

	// NotEnoughConfs means the proof does not have enough confirmations
	NotEnoughConfs sdk.CodeType = 611
	// NotEnoughConfsMessage is the corresponding message
	NotEnoughConfsMessage = "Not enough confirmations for requestID %d"

	// ActionLength means the pays value is greater than 50 bytes
	ActionLength sdk.CodeType = 612
	// ActionLengthMessage is the corresponding message
	ActionLengthMessage = "Action value is greater than 500 bytes"

	// ExternalError is an error from a dependency
	ExternalError sdk.CodeType = 701
)
View Source
const (
	EventTypeExtension     = "extension"
	EventTypeReorg         = "reorg"
	EventTypeProofRequest  = "proof_request"
	EventTypeProofProvided = "proof_provided"

	AttributeKeyFirstBlock = "first_block"
	AttributeKeyLastBlock  = "last_block"

	AttributeKeyPreviousBest = "previous_best"
	AttributeKeyNewBest      = "new_best"
	AttributeKeyLatestCommon = "latest_common_ancestor"

	AttributeKeyRequestID = "request_id"
	AttributeKeyPays      = "pays"
	AttributeKeySpends    = "spends"
	AttributeKeyPaysValue = "value"
	AttributeKeyOrigin    = "origin"

	AttributeKeyTXID   = "txid"
	AttributeKeyFilled = "filled"
)

Relay module event types

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "relay"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// LinkStorePrefix to be used when accessing links
	LinkStorePrefix = ModuleName + "-links-"

	// HeaderStorePrefix to be used when accessing headers
	HeaderStorePrefix = ModuleName + "-headers-"

	// RequestStorePrefix to be used when making requests
	RequestStorePrefix = ModuleName + "-requests-"

	// ChainStorePrefix to be used when accessing chain metadata
	ChainStorePrefix = ModuleName + "-chain-"

	// RelayGenesisStorage is the storage key for the relay genesis digest
	RelayGenesisStorage = "RelayGenesis"

	// BestKnownDigestStorage is the storage key for the best known digest
	BestKnownDigestStorage = "BestKnownDigest"

	// LastReorgLCAStorage is the storage key for the last reorg LCA
	LastReorgLCAStorage = "LastReorgLCA"

	// CurrentEpochDiffStorage is the storage key for the current epoch difficulty
	CurrentEpochDiffStorage = "currentEpochDifficulty"

	// PrevEpochDiffStorage is the storage key for the prev epoch difficulty
	PrevEpochDiffStorage = "prevEpochDifficulty"

	// RequestIDTag is the storage key for the next Request ID to be used
	// when storing a request
	RequestIDTag = "id"
)
View Source
const (
	// DefaultLookupLimit is the default limit for lookup requests
	DefaultLookupLimit = 18

	// QueryIsAncestor is a query string tag for IsAncestor
	QueryIsAncestor = "isancestor"

	// QueryGetRelayGenesis is a query string tag for GetRelayGenesis
	QueryGetRelayGenesis = "getrelaygenesis"

	// QueryGetLastReorgLCA is a query string tag for GetLastReorgLCA
	QueryGetLastReorgLCA = "getlastreorglca"

	// QueryGetBestDigest is a query string tag for GetBestDigest
	QueryGetBestDigest = "getbestdigest"

	// QueryFindAncestor is a query string tag for FindAncestor
	QueryFindAncestor = "findancestor"

	// QueryHeaviestFromAncestor is a query string tag for HeaviestFromAncestor
	QueryHeaviestFromAncestor = "heaviestfromancestor"

	// QueryIsMostRecentCommonAncestor is a query string tag for IsMostRecentCommonAncestor
	QueryIsMostRecentCommonAncestor = "ismostrecentcommonancestor"

	// QueryGetRequest is a query string tag for getRequest
	QueryGetRequest = "getrequest"

	// QueryCheckRequests is a query string tag for checkRequests
	QueryCheckRequests = "checkrequests"

	// QueryCheckProof is a query string tag for checkProof
	QueryCheckProof = "checkproof"
)
View Source
const RouterKey = ModuleName // this was defined in your key.go file

RouterKey is a name for the router

Variables

View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module

Functions

func ErrActionLength

func ErrActionLength(codespace sdk.CodespaceType) sdk.Error

ErrActionLength throws an error

func ErrAlreadyInit

func ErrAlreadyInit(codespace sdk.CodespaceType) sdk.Error

ErrAlreadyInit throws an error

func ErrBadHash256Digest

func ErrBadHash256Digest(codespace sdk.CodespaceType, invalidDigest string) sdk.Error

ErrBadHash256Digest throws an error

func ErrBadHeaderLength

func ErrBadHeaderLength(codespace sdk.CodespaceType, label string, digest RawHeader, length int) sdk.Error

ErrBadHeaderLength throws an error

func ErrBadHeight

func ErrBadHeight(codespace sdk.CodespaceType, label string, digest Hash256Digest) sdk.Error

ErrBadHeight throws an error

func ErrBadHex

func ErrBadHex(codespace sdk.CodespaceType, invalidHex string) sdk.Error

ErrBadHex throws an error

func ErrBadHexLen

func ErrBadHexLen(codespace sdk.CodespaceType, expected, actual int) sdk.Error

ErrBadHexLen throws an error

func ErrBadOffset

func ErrBadOffset(codespace sdk.CodespaceType, digest Hash256Digest) sdk.Error

ErrBadOffset throws an error

func ErrBadRetarget

func ErrBadRetarget(codespace sdk.CodespaceType) sdk.Error

ErrBadRetarget throws an error

func ErrClosedRequest

func ErrClosedRequest(codespace sdk.CodespaceType) sdk.Error

ErrClosedRequest throws an error

func ErrExternal

func ErrExternal(codespace sdk.CodespaceType, err error) sdk.Error

ErrExternal converts any external error into an sdk error

func ErrHeightMismatch

func ErrHeightMismatch(codespace sdk.CodespaceType, prevDigest, digest Hash256Digest) sdk.Error

ErrHeightMismatch throws an error

func ErrInvalidVin

func ErrInvalidVin(codespace sdk.CodespaceType) sdk.Error

ErrInvalidVin throws an error

func ErrInvalidVout

func ErrInvalidVout(codespace sdk.CodespaceType) sdk.Error

ErrInvalidVout throws an error

func ErrLimitTooHigh

func ErrLimitTooHigh(codespace sdk.CodespaceType, limit uint32) sdk.Error

ErrLimitTooHigh throws an error

func ErrMarshalJSON

func ErrMarshalJSON(codespace sdk.CodespaceType) sdk.Error

ErrMarshalJSON throws an error

func ErrNotAncestor

func ErrNotAncestor(codespace sdk.CodespaceType, lca Hash256Digest) sdk.Error

ErrNotAncestor throws an error

func ErrNotBestKnown

func ErrNotBestKnown(codespace sdk.CodespaceType, invalidBest, expectedBest Hash256Digest) sdk.Error

ErrNotBestKnown throws an error

func ErrNotEnoughConfs

func ErrNotEnoughConfs(codespace sdk.CodespaceType, requestID RequestID) sdk.Error

ErrNotEnoughConfs throws an error

func ErrNotHeavier

func ErrNotHeavier(codespace sdk.CodespaceType, newBest, prevBest Hash256Digest) sdk.Error

ErrNotHeavier throws an error

func ErrNotHeaviestAncestor

func ErrNotHeaviestAncestor(codespace sdk.CodespaceType, ancestor Hash256Digest) sdk.Error

ErrNotHeaviestAncestor throws an error

func ErrPaysLength

func ErrPaysLength(codespace sdk.CodespaceType) sdk.Error

ErrPaysLength throws an error

func ErrPeriodMismatch

func ErrPeriodMismatch(codespace sdk.CodespaceType) sdk.Error

ErrPeriodMismatch throws an error

func ErrRequestPays

func ErrRequestPays(codespace sdk.CodespaceType, requestID RequestID) sdk.Error

ErrRequestPays throws an error

func ErrRequestSpends

func ErrRequestSpends(codespace sdk.CodespaceType, requestID RequestID) sdk.Error

ErrRequestSpends throws an error

func ErrRequestValue

func ErrRequestValue(codespace sdk.CodespaceType, requestID RequestID) sdk.Error

ErrRequestValue throws an error

func ErrSpendsLength

func ErrSpendsLength(codespace sdk.CodespaceType) sdk.Error

ErrSpendsLength throws an error

func ErrUnexpectedRetarget

func ErrUnexpectedRetarget(codespace sdk.CodespaceType, rawHeader RawHeader) sdk.Error

ErrUnexpectedRetarget throws an error

func ErrUnknownBlock

func ErrUnknownBlock(codespace sdk.CodespaceType, label string, digest Hash256Digest) sdk.Error

ErrUnknownBlock throws an error

func ErrUnknownRequest

func ErrUnknownRequest(codespace sdk.CodespaceType) sdk.Error

ErrUnknownRequest throws an error

func ErrWrongEnd

func ErrWrongEnd(codespace sdk.CodespaceType) sdk.Error

ErrWrongEnd throws an error

func ErrWrongStart

func ErrWrongStart(codespace sdk.CodespaceType) sdk.Error

ErrWrongStart throws an error

func FromBTCSPVError

func FromBTCSPVError(codespace sdk.CodespaceType, err error) sdk.Error

FromBTCSPVError converts a btcutils error into an sdk error

func NewExtensionEvent

func NewExtensionEvent(first, last BitcoinHeader) sdk.Event

NewExtensionEvent instantiates an extension event

func NewProofProvidedEvent

func NewProofProvidedEvent(txid Hash256Digest, filled []RequestID) sdk.Event

NewProofProvidedEvent instantiates a proof provided event

func NewProofRequestEvent

func NewProofRequestEvent(pays, spends []byte, paysValue uint64, id RequestID, origin Origin) sdk.Event

NewProofRequestEvent instantiates a proof request event

func NewReorgEvent

func NewReorgEvent(prev, new, lca Hash256Digest) sdk.Event

NewReorgEvent instantiates a reorg event

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type BitcoinHeader

type BitcoinHeader = btcspv.BitcoinHeader

BitcoinHeader is a parsed Bitcoin header

type FilledRequestInfo

type FilledRequestInfo struct {
	InputIndex  uint32    `json:"inputIndex"`
	OutputIndex uint32    `json:"outputIndex"`
	ID          RequestID `json:"id"`
}

FilledRequestInfo contains information about what input and/or output satisfied the request

type FilledRequests

type FilledRequests struct {
	Proof  SPVProof            `json:"proof"`
	Filled []FilledRequestInfo `json:"requests"`
}

FilledRequests contains a proof that satisfies one or more requests

func NewFilledRequests

func NewFilledRequests(proof SPVProof, filled []FilledRequestInfo) FilledRequests

NewFilledRequests instantiates a FilledRequests

type Hash160Digest

type Hash160Digest = btcspv.Hash160Digest

Hash160Digest is a 20-byte ripemd160+sha2 hash

type Hash256Digest

type Hash256Digest = btcspv.Hash256Digest

Hash256Digest 32-byte double-sha2 digest

func Hash256DigestFromHex

func Hash256DigestFromHex(hexStr string) (Hash256Digest, sdk.Error)

Hash256DigestFromHex converts a hex into a Hash256Digest

type HexBytes

type HexBytes = btcspv.HexBytes

HexBytes is a type alias to make JSON hex ser/deser easier

type MsgIngestDifficultyChange

type MsgIngestDifficultyChange struct {
	Signer  sdk.AccAddress  `json:"signer"`
	Start   Hash256Digest   `json:"prevEpochStartLE"`
	Headers []BitcoinHeader `json:"headers"`
}

MsgIngestDifficultyChange defines a IngestDifficultyChange message

func NewMsgIngestDifficultyChange

func NewMsgIngestDifficultyChange(address sdk.AccAddress, start Hash256Digest, headers []BitcoinHeader) MsgIngestDifficultyChange

NewMsgIngestDifficultyChange instantiates a MsgIngestDifficultyChange

func (MsgIngestDifficultyChange) GetSignBytes

func (msg MsgIngestDifficultyChange) GetSignBytes() []byte

GetSignBytes returns the sighash for the message

func (MsgIngestDifficultyChange) GetSigners

func (msg MsgIngestDifficultyChange) GetSigners() []sdk.AccAddress

GetSigners gets signers

func (MsgIngestDifficultyChange) Route

func (msg MsgIngestDifficultyChange) Route() string

Route returns the route key

func (MsgIngestDifficultyChange) Type

func (msg MsgIngestDifficultyChange) Type() string

Type returns an identifier

func (MsgIngestDifficultyChange) ValidateBasic

func (msg MsgIngestDifficultyChange) ValidateBasic() sdk.Error

ValidateBasic runs stateless validation

type MsgIngestHeaderChain

type MsgIngestHeaderChain struct {
	Signer  sdk.AccAddress  `json:"signer"`
	Headers []BitcoinHeader `json:"headers"`
}

MsgIngestHeaderChain defines a IngestHeaderChain message

func NewMsgIngestHeaderChain

func NewMsgIngestHeaderChain(address sdk.AccAddress, headers []BitcoinHeader) MsgIngestHeaderChain

NewMsgIngestHeaderChain instantiates a MsgIngestHeaderChain

func (MsgIngestHeaderChain) GetSignBytes

func (msg MsgIngestHeaderChain) GetSignBytes() []byte

GetSignBytes returns the sighash for the message

func (MsgIngestHeaderChain) GetSigners

func (msg MsgIngestHeaderChain) GetSigners() []sdk.AccAddress

GetSigners gets signers

func (MsgIngestHeaderChain) Route

func (msg MsgIngestHeaderChain) Route() string

Route returns the route key

func (MsgIngestHeaderChain) Type

func (msg MsgIngestHeaderChain) Type() string

Type returns an identifier

func (MsgIngestHeaderChain) ValidateBasic

func (msg MsgIngestHeaderChain) ValidateBasic() sdk.Error

ValidateBasic runs stateless validation

type MsgMarkNewHeaviest

type MsgMarkNewHeaviest struct {
	Signer      sdk.AccAddress `json:"signer"`
	Ancestor    Hash256Digest  `json:"ancestor"`
	CurrentBest RawHeader      `json:"currentBest"`
	NewBest     RawHeader      `json:"newBest"`
	Limit       uint32         `json:"limit"`
}

MsgMarkNewHeaviest defines a MarkNewHeaviest message

func NewMsgMarkNewHeaviest

func NewMsgMarkNewHeaviest(address sdk.AccAddress, ancestor Hash256Digest, currentBest RawHeader, newBest RawHeader, limit uint32) MsgMarkNewHeaviest

NewMsgMarkNewHeaviest instantiates a MsgMarkNewHeaviest

func (MsgMarkNewHeaviest) GetSignBytes

func (msg MsgMarkNewHeaviest) GetSignBytes() []byte

GetSignBytes returns the sighash for the message

func (MsgMarkNewHeaviest) GetSigners

func (msg MsgMarkNewHeaviest) GetSigners() []sdk.AccAddress

GetSigners gets signers

func (MsgMarkNewHeaviest) Route

func (msg MsgMarkNewHeaviest) Route() string

Route returns the route key

func (MsgMarkNewHeaviest) Type

func (msg MsgMarkNewHeaviest) Type() string

Type returns an identifier

func (MsgMarkNewHeaviest) ValidateBasic

func (msg MsgMarkNewHeaviest) ValidateBasic() sdk.Error

ValidateBasic runs stateless validation

type MsgNewRequest

type MsgNewRequest struct {
	Signer    sdk.AccAddress `json:"signer"`
	Spends    HexBytes       `json:"spends"`
	Pays      HexBytes       `json:"pays"`
	PaysValue uint64         `json:"paysValue"`
	NumConfs  uint8          `json:"numConfs"`
	Origin    Origin         `json:"origin"`
	Action    HexBytes       `json:"action"`
}

MsgNewRequest defines a NewRequest message

func NewMsgNewRequest

func NewMsgNewRequest(address sdk.AccAddress, spends, pays []byte, paysValue uint64, numConfs uint8, origin Origin, action HexBytes) MsgNewRequest

NewMsgNewRequest instantiates a MsgNewRequest

func (MsgNewRequest) GetSignBytes

func (msg MsgNewRequest) GetSignBytes() []byte

GetSignBytes returns the sighash for the message

func (MsgNewRequest) GetSigners

func (msg MsgNewRequest) GetSigners() []sdk.AccAddress

GetSigners gets signers

func (MsgNewRequest) Route

func (msg MsgNewRequest) Route() string

Route returns the route key

func (MsgNewRequest) Type

func (msg MsgNewRequest) Type() string

Type returns an identifier

func (MsgNewRequest) ValidateBasic

func (msg MsgNewRequest) ValidateBasic() sdk.Error

ValidateBasic runs stateless validation

type MsgProvideProof

type MsgProvideProof struct {
	Signer sdk.AccAddress `json:"signer"`
	Filled FilledRequests `json:"filled"`
}

MsgProvideProof defines a NewRequest message

func NewMsgProvideProof

func NewMsgProvideProof(address sdk.AccAddress, filledRequests FilledRequests) MsgProvideProof

NewMsgProvideProof instantiates a MsgProvideProof

func (MsgProvideProof) GetSignBytes

func (msg MsgProvideProof) GetSignBytes() []byte

GetSignBytes returns the sighash for the message

func (MsgProvideProof) GetSigners

func (msg MsgProvideProof) GetSigners() []sdk.AccAddress

GetSigners gets signers

func (MsgProvideProof) Route

func (msg MsgProvideProof) Route() string

Route returns the route key

func (MsgProvideProof) Type

func (msg MsgProvideProof) Type() string

Type returns an identifier

func (MsgProvideProof) ValidateBasic

func (msg MsgProvideProof) ValidateBasic() sdk.Error

ValidateBasic runs stateless validation

type NullHandler

type NullHandler struct{}

NullHandler does nothing

func NewNullHandler

func NewNullHandler() NullHandler

NewNullHandler instantiates a new null handler

func (NullHandler) HandleValidProof

func (n NullHandler) HandleValidProof(ctx sdk.Context, filled FilledRequests, requests []ProofRequest)

HandleValidProof handles a valid proof (by doing nothing)

type Origin

type Origin int

Origin an enum of types denoting requests either from the local chain or a remote chain

const (
	Local  Origin = 0
	Remote Origin = 1
)

Origin possible types

type ProofHandler

type ProofHandler interface {
	HandleValidProof(ctx sdk.Context, filled FilledRequests, requests []ProofRequest)
}

ProofHandler is an interface to which the keeper dispatches valid proofs

type ProofRequest

type ProofRequest struct {
	Spends      Hash256Digest `json:"spends"`
	Pays        Hash256Digest `json:"pays"`
	PaysValue   uint64        `json:"paysValue"`
	ActiveState bool          `json:"activeState"`
	NumConfs    uint8         `json:"numConfs"`
	Origin      Origin        `json:"origin"`
	Action      HexBytes      `json:"action"`
}

ProofRequest is info about a proof request

type QueryParamsCheckProof

type QueryParamsCheckProof struct {
	Proof SPVProof `json:"proof"`
}

QueryParamsCheckProof is the response struct for queryCheckProof

type QueryParamsCheckRequests

type QueryParamsCheckRequests struct {
	Filled FilledRequests `json:"filledRequests"`
}

QueryParamsCheckRequests is the response struct for queryCheckRequests

type QueryParamsFindAncestor

type QueryParamsFindAncestor struct {
	DigestLE Hash256Digest `json:"digestLE"`
	Offset   uint32        `json:"offset"`
}

QueryParamsFindAncestor represents the parameters for a FindAncestor query

type QueryParamsGetRequest

type QueryParamsGetRequest struct {
	ID RequestID `json:"id"`
}

QueryParamsGetRequest is the response struct for queryGetRequest

type QueryParamsHeaviestFromAncestor

type QueryParamsHeaviestFromAncestor struct {
	Ancestor    Hash256Digest `json:"ancestor"`
	CurrentBest Hash256Digest `json:"currentBest"`
	NewBest     Hash256Digest `json:"newBest"`
	Limit       uint32        `json:"limit"`
}

QueryParamsHeaviestFromAncestor is the params struct for queryHeaviestFromAncestor

type QueryParamsIsAncestor

type QueryParamsIsAncestor struct {
	DigestLE            Hash256Digest `json:"digest"`
	ProspectiveAncestor Hash256Digest `json:"prospectiveAncestor"`
	Limit               uint32        `json:"limit"`
}

QueryParamsIsAncestor represents the parameters for an IsAncestor query

type QueryParamsIsMostRecentCommonAncestor

type QueryParamsIsMostRecentCommonAncestor struct {
	Ancestor Hash256Digest `json:"ancestor"`
	Left     Hash256Digest `json:"left"`
	Right    Hash256Digest `json:"right"`
	Limit    uint32        `json:"limit"`
}

QueryParamsIsMostRecentCommonAncestor is the params struct for queryIsMostRecentCommonAncestor

type QueryResCheckProof

type QueryResCheckProof struct {
	Params       QueryParamsCheckProof `json:"params"`
	Valid        bool                  `json:"valid"`
	ErrorMessage string                `json:"errorMessage"`
}

QueryResCheckProof is the response struct for queryCheckProof

func (QueryResCheckProof) String

func (r QueryResCheckProof) String() string

String formats a QueryResCheckProof struct

type QueryResCheckRequests

type QueryResCheckRequests struct {
	Params       QueryParamsCheckRequests `json:"params"`
	Valid        bool                     `json:"valid"`
	ErrorMessage string                   `json:"errorMessage"`
}

QueryResCheckRequests is the response struct for queryCheckRequests

func (QueryResCheckRequests) String

func (r QueryResCheckRequests) String() string

String formats a QueryResCheckRequests struct

type QueryResFindAncestor

type QueryResFindAncestor struct {
	Params QueryParamsFindAncestor `json:"params"`
	Res    Hash256Digest           `json:"result"`
}

QueryResFindAncestor is the response struct for queryFindAncestor

func (QueryResFindAncestor) String

func (r QueryResFindAncestor) String() string

String formats a QueryResFindAncestor struct

type QueryResGetBestDigest

type QueryResGetBestDigest struct {
	Res Hash256Digest `json:"result"`
}

QueryResGetBestDigest is the response struct for queryGetBestDigest

func (QueryResGetBestDigest) String

func (r QueryResGetBestDigest) String() string

String formats a QueryResGetBestDigest struct

type QueryResGetLastReorgLCA

type QueryResGetLastReorgLCA struct {
	Res Hash256Digest `json:"result"`
}

QueryResGetLastReorgLCA is the response struct for queryGetLastReorgLCA

func (QueryResGetLastReorgLCA) String

func (r QueryResGetLastReorgLCA) String() string

String formats a QueryResGetLastReorgLCA struct

type QueryResGetRelayGenesis

type QueryResGetRelayGenesis struct {
	Res Hash256Digest `json:"result"`
}

QueryResGetRelayGenesis is the response struct for queryGetRelayGenesis

func (QueryResGetRelayGenesis) String

func (r QueryResGetRelayGenesis) String() string

String formats a QueryResGetRelayGenesis struct

type QueryResGetRequest

type QueryResGetRequest struct {
	Params QueryParamsGetRequest `json:"params"`
	Res    ProofRequest          `json:"result"`
}

QueryResGetRequest is the response struct for queryGetRequest

func (QueryResGetRequest) String

func (r QueryResGetRequest) String() string

String formats a QueryResIsMostRecentCommonAncestor struct

type QueryResHeaviestFromAncestor

type QueryResHeaviestFromAncestor struct {
	Params QueryParamsHeaviestFromAncestor `json:"params"`
	Res    Hash256Digest                   `json:"result"`
}

QueryResHeaviestFromAncestor is the response struct for queryHeaviestFromAncestor

func (QueryResHeaviestFromAncestor) String

String formats a QueryResHeaviestFromAncestor struct

type QueryResIsAncestor

type QueryResIsAncestor struct {
	Params QueryParamsIsAncestor `json:"params"`
	Res    bool                  `json:"result"`
}

QueryResIsAncestor is the response to a IsAncestor query

func (QueryResIsAncestor) String

func (r QueryResIsAncestor) String() string

String formats a QueryResIsAncestor struct

type QueryResIsMostRecentCommonAncestor

type QueryResIsMostRecentCommonAncestor struct {
	Params QueryParamsIsMostRecentCommonAncestor `json:"params"`
	Res    bool                                  `json:"result"`
}

QueryResIsMostRecentCommonAncestor is the response struct for queryIsMostRecentCommonAncestor

func (QueryResIsMostRecentCommonAncestor) String

String formats a QueryResIsMostRecentCommonAncestor struct

type RawHeader

type RawHeader = btcspv.RawHeader

RawHeader is an 80-byte raw header

type RequestID

type RequestID [8]byte

RequestID is an 8 byte id used to store requests

func NewRequestID

func NewRequestID(b []byte) (RequestID, sdk.Error)

NewRequestID instantiates a RequestID from a byte slice

func RequestIDFromString

func RequestIDFromString(s string) (RequestID, error)

RequestIDFromString converts a hex string or integer string into a RequestID

func (RequestID) MarshalJSON

func (r RequestID) MarshalJSON() ([]byte, error)

MarshalJSON marashalls 8 byte RequestID as 0x-prepended hex

func (*RequestID) UnmarshalJSON

func (r *RequestID) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls 8 byte requestID

type SPVProof

type SPVProof = btcspv.SPVProof

SPVProof is the base struct for an SPV proof

Jump to

Keyboard shortcuts

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