beefy

package
v0.0.0-...-2eef473 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hex

func Hex(b []byte) string

func ScanBlocks

func ScanBlocks(ctx context.Context, api *gsrpc.SubstrateAPI, startBlock uint64) (chan ScanBlocksResult, error)

func ScanCommitments

func ScanCommitments(ctx context.Context, api *gsrpc.SubstrateAPI, startBlock uint64) (<-chan ScanCommitmentsResult, error)

func ScanSafeCommitments

func ScanSafeCommitments(ctx context.Context, meta *types.Metadata, api *gsrpc.SubstrateAPI, startBlock uint64) (<-chan ScanSafeCommitmentsResult, error)

Types

type Config

type Config struct {
	Source SourceConfig `mapstructure:"source"`
	Sink   SinkConfig   `mapstructure:"sink"`
}

type ContractsConfig

type ContractsConfig struct {
	BeefyClient string `mapstructure:"BeefyClient"`
}

type EthereumWriter

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

func NewEthereumWriter

func NewEthereumWriter(
	config *SinkConfig,
	conn *ethereum.Connection,
) *EthereumWriter

func (*EthereumWriter) Start

func (wr *EthereumWriter) Start(ctx context.Context, eg *errgroup.Group, requests <-chan Request) error

type FinalRequestParams

type FinalRequestParams struct {
	Commitment     contracts.BeefyClientCommitment
	Bitfield       []*big.Int
	Proofs         []contracts.BeefyClientValidatorProof
	Leaf           contracts.BeefyClientMMRLeaf
	LeafProof      [][32]byte
	LeafProofOrder *big.Int
}

type InitialRequestParams

type InitialRequestParams struct {
	Commitment contracts.BeefyClientCommitment
	Bitfield   []*big.Int
	Proof      contracts.BeefyClientValidatorProof
}

type PolkadotListener

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

func NewPolkadotListener

func NewPolkadotListener(
	config *SourceConfig,
	conn *relaychain.Connection,
) *PolkadotListener

func (*PolkadotListener) Start

func (li *PolkadotListener) Start(
	ctx context.Context,
	eg *errgroup.Group,
	currentBeefyBlock uint64,
	currentValidatorSetID uint64,
) (<-chan Request, error)

type Relay

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

func NewRelay

func NewRelay(config *Config, ethereumKeypair *secp256k1.Keypair) (*Relay, error)

func (*Relay) Start

func (relay *Relay) Start(ctx context.Context, eg *errgroup.Group) error

type Request

type Request struct {
	Validators       []substrate.Authority
	SignedCommitment types.SignedCommitment
	Proof            merkle.SimplifiedMMRProof
	IsHandover       bool
}

func (*Request) CommitmentHash

func (r *Request) CommitmentHash() (*[32]byte, error)

func (*Request) MakeSubmitFinalParams

func (r *Request) MakeSubmitFinalParams(validatorIndices []uint64, initialBitfield []*big.Int) (*FinalRequestParams, error)

func (*Request) MakeSubmitInitialParams

func (r *Request) MakeSubmitInitialParams(valAddrIndex int64, initialBitfield []*big.Int) (*InitialRequestParams, error)

Generate RequestParams which contains merkle proof by validator's index together with the signature which will be verified in BeefyClient contract later

type ScanBlocksResult

type ScanBlocksResult struct {
	BlockNumber uint64
	BlockHash   types.Hash
	Depth       uint64
	Error       error
}

type ScanCommitmentsResult

type ScanCommitmentsResult struct {
	SignedCommitment types.SignedCommitment
	BlockNumber      uint64
	BlockHash        types.Hash
	Depth            uint64
	Error            error
}

type ScanSafeCommitmentsResult

type ScanSafeCommitmentsResult struct {
	SignedCommitment types.SignedCommitment
	MMRProof         merkle.SimplifiedMMRProof
	BlockHash        types.Hash
	Depth            uint64
	Error            error
}

type SinkConfig

type SinkConfig struct {
	Ethereum              config.EthereumConfig `mapstructure:"ethereum"`
	DescendantsUntilFinal uint64                `mapstructure:"descendants-until-final"`
	Contracts             ContractsConfig       `mapstructure:"contracts"`
}

type SourceConfig

type SourceConfig struct {
	Polkadot config.PolkadotConfig `mapstructure:"polkadot"`
	// Depth to ignore the beefy updates too far away (in number of blocks)
	FastForwardDepth uint64 `mapstructure:"fast-forward-depth"`
	// Period to sample the beefy updates (in number of blocks)
	UpdatePeriod uint64 `mapstructure:"update-period"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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