executor

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGasPrice                = 20000000000 // 20 GWei
	FallBehindThreshold            = 5
	SleepSecondForUpdateClient     = 10
	DataSeedDenyServiceThreshold   = 60
	RPCTimeout                     = 10 * time.Second
	RelayerBytesLength             = 48
	UpdateCachedValidatorsInterval = 1 * time.Minute
	ClaimRewardInterval            = 1 * time.Minute
	MaxTxSizeForFixGasLimit        = 32768 // 32kb
	EstimatedTxExtraMetaSize       = 1024  // in bytes
	GnfdGasPrice                   = int64(5000000000)
	GasLimitRatio                  = int64(10)
)

Variables

View Source
var (
	BSCBalanceThreshold = big.NewInt(1) // when relayer is lower than 1BNB, it should try to claim rewards
	BNBDecimal          = big.NewInt(1000000000000000000)

	BSCRewardThreshold = big.NewInt(100000000000000000) // if reward is lower than 0.1 BNB, it will not be claimed.
)

Functions

func GetTestConfig added in v0.2.0

func GetTestConfig() *config.Config

func InitExecutors

func InitExecutors() (*BSCExecutor, *GreenfieldExecutor)

Types

type BSCClient

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

type BSCExecutor

type BSCExecutor struct {
	GreenfieldExecutor *GreenfieldExecutor
	// contains filtered or unexported fields
}

func NewBSCExecutor

func NewBSCExecutor(cfg *config.Config, metricService *metric.MetricService) *BSCExecutor

func (*BSCExecutor) CallBuildInSystemContract

func (e *BSCExecutor) CallBuildInSystemContract(blsSignature []byte, validatorSet *big.Int, msgBytes []byte, nonce uint64) (common.Hash, error)

func (*BSCExecutor) ClaimRewardLoop added in v0.2.4

func (e *BSCExecutor) ClaimRewardLoop()

ClaimRewardLoop relayer would claim the reward if its balance is below 1BNB and the Reward is over 0.1BNB. if after refilled with the rewards, its balance is still lower than 1BNB, it will keep alerting

func (*BSCExecutor) GetBlockHeaderAtHeight

func (e *BSCExecutor) GetBlockHeaderAtHeight(height uint64) (*types.Header, error)

func (*BSCExecutor) GetEthClient added in v0.2.4

func (e *BSCExecutor) GetEthClient() *ethclient.Client

func (*BSCExecutor) GetInturnRelayer added in v0.0.4

func (e *BSCExecutor) GetInturnRelayer() (*rtypes.InturnRelayer, error)

func (*BSCExecutor) GetLatestBlockHeightWithRetry

func (e *BSCExecutor) GetLatestBlockHeightWithRetry() (latestHeight uint64, err error)

func (*BSCExecutor) GetLatestFinalizedBlockHeightWithRetry added in v0.2.4

func (e *BSCExecutor) GetLatestFinalizedBlockHeightWithRetry() (latestHeight uint64, err error)

func (*BSCExecutor) GetLightClientLatestHeight

func (e *BSCExecutor) GetLightClientLatestHeight() (uint64, error)

func (*BSCExecutor) GetNextDeliveryOracleSequenceWithRetry added in v0.0.4

func (e *BSCExecutor) GetNextDeliveryOracleSequenceWithRetry(chainId sdk.ChainID) (sequence uint64, err error)

GetNextDeliveryOracleSequenceWithRetry gets the next delivery Oracle sequence from Greenfield

func (*BSCExecutor) GetNextReceiveSequenceForChannelWithRetry added in v0.0.4

func (e *BSCExecutor) GetNextReceiveSequenceForChannelWithRetry(channelID rtypes.ChannelId) (sequence uint64, err error)

GetNextReceiveSequenceForChannelWithRetry gets the next receive sequence for specified channel from BSC

func (*BSCExecutor) GetNextSendSequenceForChannelWithRetry added in v0.0.8

func (e *BSCExecutor) GetNextSendSequenceForChannelWithRetry() (sequence uint64, err error)

GetNextSendSequenceForChannelWithRetry gets the next send oracle sequence from BSC

func (*BSCExecutor) GetNonce added in v0.0.4

func (e *BSCExecutor) GetNonce() (uint64, error)

func (*BSCExecutor) GetRpcClient

func (e *BSCExecutor) GetRpcClient() *rpc.Client

func (*BSCExecutor) GetValidatorsBlsPublicKey

func (e *BSCExecutor) GetValidatorsBlsPublicKey() ([]string, error)

func (*BSCExecutor) QueryCachedLatestValidators

func (e *BSCExecutor) QueryCachedLatestValidators() ([]rtypes.Validator, error)

QueryCachedLatestValidators Used for gnfd -> bsc

func (*BSCExecutor) QueryLatestTendermintHeaderWithRetry

func (e *BSCExecutor) QueryLatestTendermintHeaderWithRetry() (lightBlock []byte, err error)

func (*BSCExecutor) QueryLatestValidators

func (e *BSCExecutor) QueryLatestValidators() ([]rtypes.Validator, error)

QueryLatestValidators used for gnfd -> bsc

func (*BSCExecutor) QueryTendermintLightBlockWithRetry

func (e *BSCExecutor) QueryTendermintLightBlockWithRetry(height int64) (lightBlock []byte, err error)

func (*BSCExecutor) SetGreenfieldExecutor

func (e *BSCExecutor) SetGreenfieldExecutor(ge *GreenfieldExecutor)

func (*BSCExecutor) SwitchClient

func (e *BSCExecutor) SwitchClient()

func (*BSCExecutor) SyncTendermintLightBlock

func (e *BSCExecutor) SyncTendermintLightBlock(height uint64) (common.Hash, error)

func (*BSCExecutor) UpdateCachedLatestValidatorsLoop

func (e *BSCExecutor) UpdateCachedLatestValidatorsLoop()

func (*BSCExecutor) UpdateClientLoop

func (e *BSCExecutor) UpdateClientLoop()

type ConsensusState added in v0.2.0

type ConsensusState struct {
	ChainID              string
	Height               uint64
	NextValidatorSetHash []byte
	ValidatorSet         *cbfttypes.ValidatorSet
}

type GnfdCompositeClients added in v0.2.0

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

func NewGnfdCompositClients added in v0.2.0

func NewGnfdCompositClients(rpcAddrs []string, chainId string, account *types.Account, useWebsocket bool) GnfdCompositeClients

func (*GnfdCompositeClients) GetClient added in v0.2.0

func (gc *GnfdCompositeClients) GetClient() *GreenfieldClient

type GreenfieldClient

type GreenfieldClient struct {
	sdkclient.IClient
	Height int64
}

type GreenfieldExecutor

type GreenfieldExecutor struct {
	BscExecutor *BSCExecutor

	BlsPrivateKey []byte
	BlsPubKey     []byte
	// contains filtered or unexported fields
}

func NewGreenfieldExecutor

func NewGreenfieldExecutor(cfg *config.Config) *GreenfieldExecutor

func (*GreenfieldExecutor) BroadcastVote added in v0.0.3

func (e *GreenfieldExecutor) BroadcastVote(v *votepool.Vote) error

func (*GreenfieldExecutor) ClaimPackages

func (e *GreenfieldExecutor) ClaimPackages(client *GreenfieldClient, payloadBts []byte, aggregatedSig []byte, voteAddressSet []uint64, claimTs int64, oracleSeq uint64, nonce uint64) (string, error)

func (*GreenfieldExecutor) GetBlockAndBlockResultAtHeight added in v0.0.3

func (e *GreenfieldExecutor) GetBlockAndBlockResultAtHeight(height int64) (*tmtypes.Block, *ctypes.ResultBlockResults, error)

func (*GreenfieldExecutor) GetCrossTxPack added in v1.6.0

func (e *GreenfieldExecutor) GetCrossTxPack(destChainID sdk.ChainID, channelID types.ChannelId, sequence uint64) (pack []byte, err error)

func (*GreenfieldExecutor) GetGnfdClient added in v0.0.9

func (e *GreenfieldExecutor) GetGnfdClient() *GreenfieldClient

func (*GreenfieldExecutor) GetInturnRelayer added in v0.0.4

func (*GreenfieldExecutor) GetLatestBlockHeight added in v0.0.3

func (e *GreenfieldExecutor) GetLatestBlockHeight() (latestHeight uint64, err error)

func (*GreenfieldExecutor) GetNextDeliverySequenceForChannelWithRetry added in v0.0.4

func (e *GreenfieldExecutor) GetNextDeliverySequenceForChannelWithRetry(channelID types.ChannelId) (sequence uint64, err error)

GetNextDeliverySequenceForChannelWithRetry calls dest chain(BSC) to return a sequence # which should be used.

func (*GreenfieldExecutor) GetNextReceiveOracleSequence

func (e *GreenfieldExecutor) GetNextReceiveOracleSequence(destChainId sdk.ChainID) (uint64, error)

GetNextReceiveOracleSequence gets the next receive Oracle sequence from Greenfield

func (*GreenfieldExecutor) GetNextReceiveSequenceForChannel

func (e *GreenfieldExecutor) GetNextReceiveSequenceForChannel(destChainId sdk.ChainID, channelId types.ChannelId) (uint64, error)

GetNextReceiveSequenceForChannel gets the sequence specifically for bsc -> gnfd package's channel from Greenfield

func (*GreenfieldExecutor) GetNextSendSequenceForChannelWithRetry added in v0.0.8

func (e *GreenfieldExecutor) GetNextSendSequenceForChannelWithRetry(destChainID sdk.ChainID, channelID types.ChannelId) (sequence uint64, err error)

GetNextSendSequenceForChannelWithRetry gets the next send sequence of a specified channel from Greenfield

func (*GreenfieldExecutor) GetNonce added in v0.0.4

func (e *GreenfieldExecutor) GetNonce() (uint64, error)

func (*GreenfieldExecutor) GetNonceOnNextBlock added in v0.2.3

func (e *GreenfieldExecutor) GetNonceOnNextBlock() (uint64, error)

func (*GreenfieldExecutor) GetValidatorsBlsPublicKey

func (e *GreenfieldExecutor) GetValidatorsBlsPublicKey() ([]string, error)

func (*GreenfieldExecutor) QueryCachedLatestValidators

func (e *GreenfieldExecutor) QueryCachedLatestValidators() ([]*tmtypes.Validator, error)

func (*GreenfieldExecutor) QueryTendermintLightBlock

func (e *GreenfieldExecutor) QueryTendermintLightBlock(height int64) ([]byte, error)

func (*GreenfieldExecutor) QueryValidatorsAtHeight

func (e *GreenfieldExecutor) QueryValidatorsAtHeight(height uint64) ([]*tmtypes.Validator, error)

func (*GreenfieldExecutor) QueryVotesByEventHashAndType added in v0.0.3

func (e *GreenfieldExecutor) QueryVotesByEventHashAndType(eventHash []byte, eventType votepool.EventType) ([]*votepool.Vote, error)

func (*GreenfieldExecutor) SetBSCExecutor

func (e *GreenfieldExecutor) SetBSCExecutor(be *BSCExecutor)

func (*GreenfieldExecutor) UpdateCachedLatestValidatorsLoop

func (e *GreenfieldExecutor) UpdateCachedLatestValidatorsLoop()

Jump to

Keyboard shortcuts

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