portalrelaying

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Relaying header
	RelayingHeaderRejectedChainStatus    = "rejected"
	RelayingHeaderConsideringChainStatus = "considering"
)

Variables

Global instant to use

Functions

func GetBNBBlockByHeight

func GetBNBBlockByHeight(bnbChainState *bnbrelaying.BNBChainState, blockHeight int64) (*bnbTypes.Block, error)

GetBNBBlockByHeight gets bnb header by height

func GetLatestBNBBlockHeight

func GetLatestBNBBlockHeight(bnbChainState *bnbrelaying.BNBChainState) (int64, error)

GetLatestBNBBlockHeight return latest block height of bnb chain

func HandleRelayingInsts

func HandleRelayingInsts(
	bc metadata.ChainRetriever,
	relayingState *RelayingHeaderChainState,
	relayingProcessors map[int]RelayingProcessor,
) [][]string

HandleRelayingInsts: beacon producers handle these relaying actions

func ProcessRelayingBTCHeaderInst

func ProcessRelayingBTCHeaderInst(
	instruction []string,
	relayingState *RelayingHeaderChainState,
) error

func ProcessRelayingInstructions

func ProcessRelayingInstructions(instructions [][]string, relayingState *RelayingHeaderChainState) error

Types

type PortalRelayingLogger

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

func (*PortalRelayingLogger) Init

func (p *PortalRelayingLogger) Init(inst common.Logger)

type RelayingBNBChain

type RelayingBNBChain struct {
	*RelayingChain
}

func (*RelayingBNBChain) BuildRelayingInst

func (rbnbChain *RelayingBNBChain) BuildRelayingInst(
	bc metadata.ChainRetriever,
	relayingHeaderAction metadata.RelayingHeaderAction,
	relayingHeaderChain *RelayingHeaderChainState,
) [][]string

type RelayingBTCChain

type RelayingBTCChain struct {
	*RelayingChain
}

func (*RelayingBTCChain) BuildRelayingInst

func (rbtcChain *RelayingBTCChain) BuildRelayingInst(
	bc metadata.ChainRetriever,
	relayingHeaderAction metadata.RelayingHeaderAction,
	relayingState *RelayingHeaderChainState,
) [][]string

type RelayingChain

type RelayingChain struct {
	Actions [][]string
}

func (*RelayingChain) BuildHeaderRelayingInst

func (rChain *RelayingChain) BuildHeaderRelayingInst(
	senderAddressStr string,
	header string,
	blockHeight uint64,
	metaType int,
	shardID byte,
	txReqID common.Hash,
	status string,
) []string

buildHeaderRelayingInst builds a new instruction from action received from ShardToBeaconBlock

func (*RelayingChain) GetActions

func (rChain *RelayingChain) GetActions() [][]string

func (*RelayingChain) PutAction

func (rChain *RelayingChain) PutAction(action []string)

type RelayingHeaderChainState

type RelayingHeaderChainState struct {
	BNBHeaderChain *bnbrelaying.BNBChainState
	BTCHeaderChain *btcrelaying.BlockChain
}

RelayingHeaderChainState is state of relaying header chains include btc and bnb header chain

func InitRelayingHeaderChainStateFromDB

func InitRelayingHeaderChainStateFromDB(bnbChain *bnbrelaying.BNBChainState, btcChain *btcrelaying.BlockChain) (*RelayingHeaderChainState, error)

type RelayingParams

type RelayingParams struct {
	BNBRelayingHeaderChainID string
	BTCRelayingHeaderChainID string
	BTCDataFolderName        string
	BNBFullNodeProtocol      string
	BNBFullNodeHost          string
	BNBFullNodePort          string
}

type RelayingProcessor

type RelayingProcessor interface {
	GetActions() [][]string
	PutAction(action []string)
	BuildRelayingInst(
		bc metadata.ChainRetriever,
		relayingHeaderAction metadata.RelayingHeaderAction,
		relayingState *RelayingHeaderChainState,
	) [][]string
	BuildHeaderRelayingInst(
		senderAddressStr string,
		header string,
		blockHeight uint64,
		metaType int,
		shardID byte,
		txReqID common.Hash,
		status string,
	) []string
}

Jump to

Keyboard shortcuts

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