Documentation ¶
Index ¶
- Constants
- func ExtractCommitmentFromDigest(digest types.Digest) (*types.H256, error)
- func GetDestination(message OutboundQueueMessage) (string, error)
- func Hex(b []byte) string
- type BeefyListener
- type ByParaID
- type ChannelID
- type Config
- type EthereumWriter
- func (wr *EthereumWriter) Start(ctx context.Context, eg *errgroup.Group) error
- func (wr *EthereumWriter) WriteChannel(ctx context.Context, options *bind.TransactOpts, commitmentProof *MessageProof, ...) error
- func (wr *EthereumWriter) WriteChannels(ctx context.Context, options *bind.TransactOpts, task *Task) error
- type HexBytes
- type MerkleProof
- type MerkleProofData
- type MessageProof
- type OptionRawMerkleProof
- type OutboundQueueMessage
- type PersistedValidationData
- type PreLeaves
- type Proof
- type ProofInput
- type ProofOutput
- type RawMerkleProof
- type Relay
- type Scanner
- type ScheduleConfig
- type SinkConfig
- type SinkContractsConfig
- type SourceConfig
- type SourceContractsConfig
- type Task
Constants ¶
const FinalizationTimeout = 4
The process for finalizing a backed parachain header times out after these many blocks:
const MaxParaHeads = 1024
The maximum paras that will be included in the proof. https://github.com/paritytech/polkadot-sdk/blob/d66dee3c3da836bcf41a12ca4e1191faee0b6a5b/polkadot/runtime/parachains/src/paras/mod.rs#L1225-L1232
Variables ¶
This section is empty.
Functions ¶
func GetDestination ¶
func GetDestination(message OutboundQueueMessage) (string, error)
Types ¶
type BeefyListener ¶
type BeefyListener struct {
// contains filtered or unexported fields
}
func NewBeefyListener ¶
func NewBeefyListener( config *SourceConfig, scheduleConfig *ScheduleConfig, ethereumConn *ethereum.Connection, relaychainConn *relaychain.Connection, parachainConnection *parachain.Connection, ofac *ofac.OFAC, tasks chan<- *Task, ) *BeefyListener
type ByParaID ¶
type ByParaID []relaychain.ParaHead
ByLeafIndex implements sort.Interface based on the LeafIndex field.
type Config ¶
type Config struct { Source SourceConfig `mapstructure:"source"` Sink SinkConfig `mapstructure:"sink"` Schedule ScheduleConfig `mapstructure:"schedule"` OFAC config.OFACConfig `mapstructure:"ofac"` }
type EthereumWriter ¶
type EthereumWriter struct {
// contains filtered or unexported fields
}
func NewEthereumWriter ¶
func NewEthereumWriter( config *SinkConfig, conn *ethereum.Connection, tasks <-chan *Task, ) (*EthereumWriter, error)
func (*EthereumWriter) WriteChannel ¶
func (wr *EthereumWriter) WriteChannel( ctx context.Context, options *bind.TransactOpts, commitmentProof *MessageProof, proof *ProofOutput, ) error
Submit sends a SCALE-encoded message to an application deployed on the Ethereum network
func (*EthereumWriter) WriteChannels ¶
func (wr *EthereumWriter) WriteChannels( ctx context.Context, options *bind.TransactOpts, task *Task, ) error
type MerkleProof ¶
func NewMerkleProof ¶
func NewMerkleProof(rawProof RawMerkleProof) (MerkleProof, error)
type MerkleProofData ¶
type MerkleProofData struct { PreLeaves PreLeaves `json:"preLeaves"` NumberOfLeaves int `json:"numberOfLeaves"` ProvenPreLeaf HexBytes `json:"provenPreLeaf"` ProvenLeaf HexBytes `json:"provenLeaf"` ProvenLeafIndex int64 `json:"provenLeafIndex"` Root HexBytes `json:"root"` Proof Proof `json:"proof"` }
func CreateParachainMerkleProof ¶
func CreateParachainMerkleProof(heads []relaychain.ParaHead, paraID uint32) (MerkleProofData, error)
func (MerkleProofData) String ¶
func (d MerkleProofData) String() string
type MessageProof ¶
type MessageProof struct { Message OutboundQueueMessage Proof MerkleProof }
type OptionRawMerkleProof ¶
type OptionRawMerkleProof struct { HasValue bool Value RawMerkleProof }
type OutboundQueueMessage ¶
type OutboundQueueMessage struct { ChannelID types.H256 Nonce uint64 Command uint8 Params []byte MaxDispatchGas uint64 MaxFeePerGas types.U128 Reward types.U128 ID types.Bytes32 }
func (*OutboundQueueMessage) Decode ¶
func (m *OutboundQueueMessage) Decode(decoder scale.Decoder) error
func (OutboundQueueMessage) Encode ¶
func (m OutboundQueueMessage) Encode(encoder scale.Encoder) error
func (OutboundQueueMessage) IntoInboundMessage ¶
func (m OutboundQueueMessage) IntoInboundMessage() contracts.InboundMessage
type PersistedValidationData ¶
type ProofInput ¶
type ProofInput struct { // Parachain ID ParaID uint32 // Relay chain block number in which our parachain head was included RelayBlockNumber uint64 // Relay chain block hash in which our parachain head was included RelayBlockHash types.Hash // All included paraheads in RelayBlockNumber ParaHeads []relaychain.ParaHead }
A ProofInput is data needed to generate a proof of parachain header inclusion
type ProofOutput ¶
type ProofOutput struct { MMRProof merkle.SimplifiedMMRProof MMRRootHash types.Hash Header types.Header MerkleProofData MerkleProofData }
A ProofOutput represents the generated header inclusion proof
type RawMerkleProof ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func (*Scanner) Scan ¶
Scans for all parachain message commitments for the configured parachain channelID that need to be relayed and can be proven using the MMR root at the specified beefyBlockNumber of the relay chain.
The algorithm works roughly like this:
- Fetch channel nonce on both sides of the bridge and compare them
- If the nonce on the parachain side is larger that means messages need to be relayed. If not then exit early.
- Scan parachain blocks to figure out exactly which commitments need to be relayed.
- For all the parachain blocks with unsettled commitments, determine the relay chain block number in which the parachain block was included.
type ScheduleConfig ¶
type ScheduleConfig struct { // ID of current relayer, starting from 0 ID uint64 `mapstructure:"id"` // Number of total count of all relayers TotalRelayerCount uint64 `mapstructure:"totalRelayerCount"` // Sleep interval(in seconds) to check if message(nonce) has already been relayed SleepInterval uint64 `mapstructure:"sleepInterval"` }
func (ScheduleConfig) Validate ¶
func (r ScheduleConfig) Validate() error
type SinkConfig ¶
type SinkConfig struct { Ethereum config.EthereumConfig `mapstructure:"ethereum"` Contracts SinkContractsConfig `mapstructure:"contracts"` }
type SinkContractsConfig ¶
type SinkContractsConfig struct {
Gateway string `mapstructure:"Gateway"`
}
type SourceConfig ¶
type SourceConfig struct { Polkadot config.PolkadotConfig `mapstructure:"polkadot"` Parachain config.ParachainConfig `mapstructure:"parachain"` Ethereum config.EthereumConfig `mapstructure:"ethereum"` Contracts SourceContractsConfig `mapstructure:"contracts"` ChannelID ChannelID `mapstructure:"channel-id"` }
type SourceContractsConfig ¶
type Task ¶
type Task struct { // Parachain header Header *types.Header // Inputs for MMR proof generation ProofInput *ProofInput // Outputs of MMR proof generation ProofOutput *ProofOutput // Proofs for messages from outbound channel on Polkadot MessageProofs *[]MessageProof }
A Task contains the working state for message commitments in a single parachain block