parachain

package
v0.0.3-rc-1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorStateProofRootMismatch sc.U8 = iota
	ErrorStateProofReadEntry
	ErrorStateProofSlot
	ErrorStateProofUpgradeGoAhead
	ErrorStateProofUpgradeRestriction
	ErrorStateProofConfig
	ErrorStateProofDmqMqcHead
	ErrorStateProofRelayDispatchQueueRemainingCapacity
	ErrorStateProofHrmpIngressChannelIndex
	ErrorStateProofHrmpEgressChannelIndex
	ErrorStateProofHrmpChannel
	ErrorStateProofParaHead
)
View Source
const (
	UnincludedSegmentCapacityInnerExpectParentIncluded sc.U8 = iota
	UnincludedSegmentCapacityInnerValue
)
View Source
const (
	UpgradeGoAheadAbort sc.U8 = iota
	UpgradeGoAheadGoAhead
)
View Source
const (
	UpgradeRestrictionSignalPresent sc.U8 = iota
)

Variables

View Source
var (
	ConsensusTypeId = [4]byte{'R', 'S', 'P', 'R'}
)

Functions

func BuildTrie

func BuildTrie(rootHash []byte, db db.Database) (t *inmemory.InMemoryTrie, err error)

BuildTrie sets a partial trie based on the proof slice of encoded nodes.

func DecodeOptionUpgradeGoAhead

func DecodeOptionUpgradeGoAhead(buffer *bytes.Buffer) (sc.Option[sc.U8], error)

func DecodeOptionUpgradeRestrictionSignal

func DecodeOptionUpgradeRestrictionSignal(buffer *bytes.Buffer) (sc.Option[sc.U8], error)

func DecodeOutboundHrmpMessages

func DecodeOutboundHrmpMessages(buffer *bytes.Buffer) (sc.Sequence[OutboundHrmpMessage], error)

func DecodeUpgradeGoAhead

func DecodeUpgradeGoAhead(buffer *bytes.Buffer) (sc.U8, error)

func DecodeUpgradeRestrictionSignal

func DecodeUpgradeRestrictionSignal(buffer *bytes.Buffer) (sc.U8, error)

func DecodeUpwardMessages

func DecodeUpwardMessages(buffer *bytes.Buffer) (sc.Sequence[UpwardMessage], error)

func NewDigestRelayParentStorageRoot

func NewDigestRelayParentStorageRoot(storageRoot primitives.H256, number RelayChainBlockNumber) primitives.DigestItem

Types

type AbridgedHRMPChannel

type AbridgedHRMPChannel struct {
	MaxCapacity    sc.U32
	MaxTotalSize   sc.U32
	MaxMessageSize sc.U32
	MsgCount       sc.U32
	TotalSize      sc.U32
	MqcHead        sc.Option[types.H256]
}

func DecodeAbridgedHRMPChannel

func DecodeAbridgedHRMPChannel(buffer *bytes.Buffer) (AbridgedHRMPChannel, error)

func (AbridgedHRMPChannel) Bytes

func (ahc AbridgedHRMPChannel) Bytes() []byte

func (AbridgedHRMPChannel) Encode

func (ahc AbridgedHRMPChannel) Encode(buffer *bytes.Buffer) error

type AbridgedHostConfiguration

type AbridgedHostConfiguration struct {
	MaxCodeSize                     sc.U32
	MaxHeadDataSize                 sc.U32
	MaxUpwardQueueCount             sc.U32
	MaxUpwardQueueSize              sc.U32
	MaxUpwardMessageSize            sc.U32
	MaxUpwardMessageNumPerCandidate sc.U32
	MaxHrmpMessageNumPerCandidate   sc.U32
	ValidationUpgradeCooldown       sc.U32
	ValidationUpgradeDelay          sc.U32
	AsyncBackingParams              AsyncBackingParams
}

func DecodeAbridgeHostConfiguration

func DecodeAbridgeHostConfiguration(buffer *bytes.Buffer) (AbridgedHostConfiguration, error)

func (AbridgedHostConfiguration) Bytes

func (ahc AbridgedHostConfiguration) Bytes() []byte

func (AbridgedHostConfiguration) Encode

func (ahc AbridgedHostConfiguration) Encode(buffer *bytes.Buffer) error

type Ancestor

type Ancestor struct {
	UsedBandwidth         UsedBandwidth
	ParaHeadHash          sc.Option[types.H256]
	ConsumedGoAheadSignal sc.Option[sc.U8]
}

Ancestor of the block being currently executed, not yet included into the relay chain.

func DecodeAncestor

func DecodeAncestor(buffer *bytes.Buffer) (Ancestor, error)

func (Ancestor) Bytes

func (a Ancestor) Bytes() []byte

func (Ancestor) Encode

func (a Ancestor) Encode(buffer *bytes.Buffer) error

type AsyncBackingParams

type AsyncBackingParams struct {
	MaxCandidateDepth  sc.U32
	AllowedAncestryLen sc.U32
}

func DecodeAsyncBackingParams

func DecodeAsyncBackingParams(buffer *bytes.Buffer) (AsyncBackingParams, error)

func (AsyncBackingParams) Bytes

func (abp AsyncBackingParams) Bytes() []byte

func (AsyncBackingParams) Encode

func (abp AsyncBackingParams) Encode(buffer *bytes.Buffer) error

type BlockData

type BlockData struct {
	Block        types.Block
	CompactProof StorageProof
}

func (BlockData) Bytes

func (bd BlockData) Bytes() []byte

func (BlockData) Encode

func (bd BlockData) Encode(buffer *bytes.Buffer) error

type Channel

type Channel struct {
	ParachainId         sc.U32
	AbridgedHRMPChannel AbridgedHRMPChannel
}

func DecodeChannel

func DecodeChannel(buffer *bytes.Buffer) (Channel, error)

func (Channel) Bytes

func (c Channel) Bytes() []byte

func (Channel) Encode

func (c Channel) Encode(buffer *bytes.Buffer) error

type CollationInfo

type CollationInfo struct {
	UpwardMessages            sc.Sequence[UpwardMessage]
	HorizontalMessages        sc.Sequence[OutboundHrmpMessage]
	ValidationCode            sc.Option[sc.Sequence[sc.U8]]
	ProcessedDownwardMessages sc.U32
	HrmpWatermark             RelayChainBlockNumber
	HeadData                  HeadData
}

func DecodeCollationInfo

func DecodeCollationInfo(buffer *bytes.Buffer) (CollationInfo, error)

func (CollationInfo) Bytes

func (ci CollationInfo) Bytes() []byte

func (CollationInfo) Encode

func (ci CollationInfo) Encode(buffer *bytes.Buffer) error

type DownwardMessage

type DownwardMessage = sc.Sequence[sc.U8]

type HeadData

type HeadData = sc.Sequence[sc.U8]

type HorizontalMessages

type HorizontalMessages struct {
	// contains filtered or unexported fields
}

func DecodeHorizontalMessages

func DecodeHorizontalMessages(buffer *bytes.Buffer) (HorizontalMessages, error)

func (HorizontalMessages) Bytes

func (hm HorizontalMessages) Bytes() []byte

func (HorizontalMessages) Encode

func (hm HorizontalMessages) Encode(buffer *bytes.Buffer) error

func (HorizontalMessages) UnprocessedMessages

func (hm HorizontalMessages) UnprocessedMessages(number RelayChainBlockNumber) HorizontalMessages

type HrmpChannelUpdate

type HrmpChannelUpdate struct {
	MsgCount   sc.U32
	TotalBytes sc.U32
}

func DecodeHrmpChannelUpdate

func DecodeHrmpChannelUpdate(buffer *bytes.Buffer) (HrmpChannelUpdate, error)

func (HrmpChannelUpdate) Bytes

func (hcu HrmpChannelUpdate) Bytes() []byte

func (HrmpChannelUpdate) Encode

func (hcu HrmpChannelUpdate) Encode(buffer *bytes.Buffer) error

func (HrmpChannelUpdate) IsEmpty

func (hcu HrmpChannelUpdate) IsEmpty() bool

func (*HrmpChannelUpdate) Subtract

func (hcu *HrmpChannelUpdate) Subtract(other HrmpChannelUpdate)

type HrmpOutboundLimits

type HrmpOutboundLimits struct {
	BytesRemaining    sc.U32
	MessagesRemaining sc.U32
}

func DecodeHrmpOutboundLimits

func DecodeHrmpOutboundLimits(buffer *bytes.Buffer) (HrmpOutboundLimits, error)

func (HrmpOutboundLimits) Bytes

func (hol HrmpOutboundLimits) Bytes() []byte

func (HrmpOutboundLimits) Encode

func (hol HrmpOutboundLimits) Encode(buffer *bytes.Buffer) error

type InboundDownwardMessage

type InboundDownwardMessage struct {
	SentAt RelayChainBlockNumber
	Msg    DownwardMessage
}

func DecodeInboundDownwardMessage

func DecodeInboundDownwardMessage(buffer *bytes.Buffer) (InboundDownwardMessage, error)

func (InboundDownwardMessage) Bytes

func (idm InboundDownwardMessage) Bytes() []byte

func (InboundDownwardMessage) Encode

func (idm InboundDownwardMessage) Encode(buffer *bytes.Buffer) error

type InboundHrmpMessage

type InboundHrmpMessage struct {
	SentAt RelayChainBlockNumber
	Data   sc.Sequence[sc.U8]
}

func (InboundHrmpMessage) Bytes

func (ihm InboundHrmpMessage) Bytes() []byte

func (InboundHrmpMessage) Encode

func (ihm InboundHrmpMessage) Encode(buffer *bytes.Buffer) error

type InherentData

type InherentData struct {
	ValidationData     PersistedValidationData
	RelayChainState    StorageProof
	DownwardMessages   sc.Sequence[InboundDownwardMessage]
	HorizontalMessages HorizontalMessages
}

func DecodeInherentData

func DecodeInherentData(buffer *bytes.Buffer) (InherentData, error)

func (InherentData) Bytes

func (id InherentData) Bytes() []byte

func (InherentData) Encode

func (id InherentData) Encode(buffer *bytes.Buffer) error

type MessageQueueChain

type MessageQueueChain struct {
	RelayHash types.H256
}

func DecodeMessageQueueChain

func DecodeMessageQueueChain(buffer *bytes.Buffer) (MessageQueueChain, error)

func (MessageQueueChain) Bytes

func (mqc MessageQueueChain) Bytes() []byte

func (MessageQueueChain) Encode

func (mqc MessageQueueChain) Encode(buffer *bytes.Buffer) error

func (*MessageQueueChain) ExtendDownward

func (mqc *MessageQueueChain) ExtendDownward(downwardMessage InboundDownwardMessage, hashing io.Hashing) error

type MessagingStateSnapshot

type MessagingStateSnapshot struct {
	DmqMqcHead                          types.H256
	RelayDispatchQueueRemainingCapacity RelayDispatchQueueRemainingCapacity
	IngressChannels                     sc.Sequence[Channel]
	EgressChannels                      sc.Sequence[Channel]
}

func DecodeMessagingStateSnapshot

func DecodeMessagingStateSnapshot(buffer *bytes.Buffer) (MessagingStateSnapshot, error)

func (MessagingStateSnapshot) Bytes

func (mss MessagingStateSnapshot) Bytes() []byte

func (MessagingStateSnapshot) Encode

func (mss MessagingStateSnapshot) Encode(buffer *bytes.Buffer) error

type OutboundBandwidthLimits

type OutboundBandwidthLimits struct {
	UmpMessagesRemaining sc.U32
	UmpBytesRemaining    sc.U32
	HrmpOutgoing         sc.Dictionary[sc.U32, HrmpOutboundLimits]
}

func NewOutboundBandwidthLimitsFromMessagingStateSnapshot

func NewOutboundBandwidthLimitsFromMessagingStateSnapshot(mss MessagingStateSnapshot) OutboundBandwidthLimits

func (OutboundBandwidthLimits) Bytes

func (obl OutboundBandwidthLimits) Bytes() []byte

func (OutboundBandwidthLimits) Encode

func (obl OutboundBandwidthLimits) Encode(buffer *bytes.Buffer) error

type OutboundHrmpMessage

type OutboundHrmpMessage struct {
	Id   sc.U32
	Data sc.Sequence[sc.U8]
}

func DecodeOutboundHrmpMessage

func DecodeOutboundHrmpMessage(buffer *bytes.Buffer) (OutboundHrmpMessage, error)

func (OutboundHrmpMessage) Bytes

func (ohm OutboundHrmpMessage) Bytes() []byte

func (OutboundHrmpMessage) Encode

func (ohm OutboundHrmpMessage) Encode(buffer *bytes.Buffer) error

type PersistedValidationData

type PersistedValidationData struct {
	ParentHead             HeadData
	RelayParentNumber      RelayChainBlockNumber
	RelayParentStorageRoot types.H256
	MaxPovSize             sc.U32
}

func DecodePersistedValidationData

func DecodePersistedValidationData(buffer *bytes.Buffer) (PersistedValidationData, error)

func (PersistedValidationData) Bytes

func (pvd PersistedValidationData) Bytes() []byte

func (PersistedValidationData) Encode

func (pvd PersistedValidationData) Encode(buffer *bytes.Buffer) error

type ReadEntryError

type ReadEntryError = sc.U8
const (
	ReadEntryErrorProof ReadEntryError = iota
	ReadEntryErrorDecode
	ReadEntryErrorAbsent
)

type RelayChainBlockNumber

type RelayChainBlockNumber = sc.U32

type RelayChainStateProof

type RelayChainStateProof interface {
	ReadSlot() (sc.U64, error)
	ReadUpgradeGoAheadSignal() (sc.Option[sc.U8], error)
	ReadRestrictionSignal() (sc.Option[sc.U8], error)
	ReadAbridgedHostConfiguration() (AbridgedHostConfiguration, error)
	ReadIncludedParaHeadHash() sc.Option[sc.FixedSequence[sc.U8]]
	ReadMessagingStateSnapshot(ahc AbridgedHostConfiguration) (MessagingStateSnapshot, error)
}

func NewRelayChainStateProof

func NewRelayChainStateProof(parachainId sc.U32, relayChainHash primitives.H256, proof StorageProof, hashing io.Hashing) (RelayChainStateProof, error)

type RelayDispatchQueueRemainingCapacity

type RelayDispatchQueueRemainingCapacity struct {
	RemainingCount sc.U32
	RemainingSize  sc.U32
}

func DecodeRelayDispatchQueueRemainingCapacity

func DecodeRelayDispatchQueueRemainingCapacity(buffer *bytes.Buffer) (RelayDispatchQueueRemainingCapacity, error)

func (RelayDispatchQueueRemainingCapacity) Bytes

func (rdqrc RelayDispatchQueueRemainingCapacity) Bytes() []byte

func (RelayDispatchQueueRemainingCapacity) Encode

func (rdqrc RelayDispatchQueueRemainingCapacity) Encode(buffer *bytes.Buffer) error

type SegmentTracker

type SegmentTracker struct {
	UsedBandwidth         UsedBandwidth
	HrmpWatermark         sc.Option[RelayChainBlockNumber]
	ConsumedGoAheadSignal sc.Option[sc.U8]
}

func DecodeSegmentTracker

func DecodeSegmentTracker(buffer *bytes.Buffer) (SegmentTracker, error)

func (SegmentTracker) Bytes

func (st SegmentTracker) Bytes() []byte

func (SegmentTracker) Encode

func (st SegmentTracker) Encode(buffer *bytes.Buffer) error

func (*SegmentTracker) Subtract

func (st *SegmentTracker) Subtract(block *Ancestor) error

Subtract removes previously added block from the tracker.

type StateProofError

type StateProofError struct {
	sc.VaryingData
}

func NewErrorStateProofConfig

func NewErrorStateProofConfig(entryError ReadEntryError) StateProofError

func NewErrorStateProofDmqMqcHead

func NewErrorStateProofDmqMqcHead(entryError ReadEntryError) StateProofError

func NewErrorStateProofHrmpChannel

func NewErrorStateProofHrmpChannel(from sc.U32, to sc.U32, entryError ReadEntryError) StateProofError

func NewErrorStateProofHrmpEgressChannelIndex

func NewErrorStateProofHrmpEgressChannelIndex(entryError ReadEntryError) StateProofError

func NewErrorStateProofHrmpIngressChannelIndex

func NewErrorStateProofHrmpIngressChannelIndex(entryError ReadEntryError) StateProofError

func NewErrorStateProofParaHead

func NewErrorStateProofParaHead(entryError ReadEntryError) StateProofError

func NewErrorStateProofReadEntry

func NewErrorStateProofReadEntry() StateProofError

func NewErrorStateProofRelayDispatchQueueRemainingCapacity

func NewErrorStateProofRelayDispatchQueueRemainingCapacity(entryError ReadEntryError) StateProofError

func NewErrorStateProofRootMismatch

func NewErrorStateProofRootMismatch() StateProofError

func NewErrorStateProofSlot

func NewErrorStateProofSlot(entryError ReadEntryError) StateProofError

func NewErrorStateProofUpgradeGoAhead

func NewErrorStateProofUpgradeGoAhead(entryError ReadEntryError) StateProofError

func NewErrorStateProofUpgradeRestriction

func NewErrorStateProofUpgradeRestriction(entryError ReadEntryError) StateProofError

func (StateProofError) Error

func (err StateProofError) Error() string

type StorageProof

type StorageProof struct {
	TrieNodes sc.Sequence[sc.Sequence[sc.U8]]
}

func DecodeStorageProof

func DecodeStorageProof(buffer *bytes.Buffer) (StorageProof, error)

func (StorageProof) Bytes

func (sp StorageProof) Bytes() []byte

func (StorageProof) Encode

func (sp StorageProof) Encode(buffer *bytes.Buffer) error

func (StorageProof) ToBytes

func (sp StorageProof) ToBytes() [][]byte

type UnincludedSegment

type UnincludedSegment struct {
	Ancestors sc.Sequence[Ancestor]
}

func DecodeUnincludedSegment

func DecodeUnincludedSegment(buffer *bytes.Buffer) (UnincludedSegment, error)

func (UnincludedSegment) Bytes

func (us UnincludedSegment) Bytes() []byte

func (UnincludedSegment) Encode

func (us UnincludedSegment) Encode(buffer *bytes.Buffer) error

type UnincludedSegmentCapacity

type UnincludedSegmentCapacity struct {
	sc.VaryingData
}

func NewUnincludedSegmentCapacityInnerExpectParentIncluded

func NewUnincludedSegmentCapacityInnerExpectParentIncluded() UnincludedSegmentCapacity

func NewUnincludedSegmentCapacityValue

func NewUnincludedSegmentCapacityValue(value sc.U32) UnincludedSegmentCapacity

func (UnincludedSegmentCapacity) Get

func (usc UnincludedSegmentCapacity) Get() sc.U32

func (UnincludedSegmentCapacity) IsExpectingIncludedParent

func (usc UnincludedSegmentCapacity) IsExpectingIncludedParent() bool

type UpwardMessage

type UpwardMessage = sc.Sequence[sc.U8]

type UsedBandwidth

type UsedBandwidth struct {
	UmpMsgCount   sc.U32
	UmpTotalBytes sc.U32
	HrmpOutgoing  sc.Dictionary[sc.U32, HrmpChannelUpdate]
}

func DecodeUsedBandwidth

func DecodeUsedBandwidth(buffer *bytes.Buffer) (UsedBandwidth, error)

func (UsedBandwidth) Bytes

func (ub UsedBandwidth) Bytes() []byte

func (UsedBandwidth) Encode

func (ub UsedBandwidth) Encode(buffer *bytes.Buffer) error

func (*UsedBandwidth) Subtract

func (ub *UsedBandwidth) Subtract(other *UsedBandwidth) error

type ValidationParams

type ValidationParams struct {
	ParentHead             sc.Sequence[sc.U8]
	BlockData              sc.Sequence[sc.U8]
	RelayParentBlockNumber RelayChainBlockNumber
	RelayParentStorageRoot primitives.H256
}

func DecodeValidationParams

func DecodeValidationParams(buffer *bytes.Buffer) (ValidationParams, error)

func (ValidationParams) Bytes

func (vp ValidationParams) Bytes() []byte

func (ValidationParams) Encode

func (vp ValidationParams) Encode(buffer *bytes.Buffer) error

type ValidationResult

type ValidationResult struct {
	HeadData                  sc.Sequence[sc.U8]
	NewValidationCode         sc.Option[sc.Sequence[sc.U8]]
	UpwardMessages            sc.Sequence[UpwardMessage]       // Convert to bounded vec (aka to have max limit, max 16 * 1024)
	HorizontalMessages        sc.Sequence[OutboundHrmpMessage] // Convert to bounded vec (aka to have max limit, max 16 * 1024)
	ProcessedDownwardMessages sc.U32
	HrmpWatermark             RelayChainBlockNumber
}

func DecodeValidationResult

func DecodeValidationResult(buffer *bytes.Buffer) (ValidationResult, error)

func (ValidationResult) Bytes

func (vr ValidationResult) Bytes() []byte

func (ValidationResult) Encode

func (vr ValidationResult) Encode(buffer *bytes.Buffer) error

Jump to

Keyboard shortcuts

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