Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyLightBlock(cs *ConsensusState, block *tmtypes.LightBlock) (bool, error)
- func EncodeLightBlockValidationResult(validatorSetChanged bool, consensusStateBytes []byte) []byte
- func GetTestConfig() *config.Config
- func InitExecutors() (*BSCExecutor, *GreenfieldExecutor)
- type BSCClient
- type BSCExecutor
- func (e *BSCExecutor) CallBuildInSystemContract(blsSignature []byte, validatorSet *big.Int, msgBytes []byte, nonce uint64) (common.Hash, error)
- func (e *BSCExecutor) ClaimRewardLoop()
- func (e *BSCExecutor) GetBlockHeaderAtHeight(height uint64) (*types.Header, error)
- func (e *BSCExecutor) GetEthClient() *ethclient.Client
- func (e *BSCExecutor) GetGreenfieldLightClient() *greenfieldlightclient.Greenfieldlightclient
- func (e *BSCExecutor) GetInturnRelayer() (*rtypes.InturnRelayer, error)
- func (e *BSCExecutor) GetLatestBlockHeightWithRetry() (latestHeight uint64, err error)
- func (e *BSCExecutor) GetLatestFinalizedBlockHeightWithRetry() (latestHeight uint64, err error)
- func (e *BSCExecutor) GetLightClientLatestHeight() (uint64, error)
- func (e *BSCExecutor) GetNextDeliveryOracleSequenceWithRetry(chainId sdk.ChainID) (sequence uint64, err error)
- func (e *BSCExecutor) GetNextReceiveSequenceForChannelWithRetry(channelID rtypes.ChannelId) (sequence uint64, err error)
- func (e *BSCExecutor) GetNextSendSequenceForChannelWithRetry() (sequence uint64, err error)
- func (e *BSCExecutor) GetNonce() (uint64, error)
- func (e *BSCExecutor) GetRpcClient() *rpc.Client
- func (e *BSCExecutor) GetValidatorsBlsPublicKey() ([]string, error)
- func (e *BSCExecutor) QueryCachedLatestValidators() ([]rtypes.Validator, error)
- func (e *BSCExecutor) QueryLatestTendermintHeaderWithRetry() (lightBlockBts []byte, err error)
- func (e *BSCExecutor) QueryLatestValidators() ([]rtypes.Validator, error)
- func (e *BSCExecutor) QueryTendermintLightBlockWithRetry(height int64) (lightBlock tmtypes.LightBlock, err error)
- func (e *BSCExecutor) SetGreenfieldExecutor(ge *GreenfieldExecutor)
- func (e *BSCExecutor) SwitchClient()
- func (e *BSCExecutor) SyncTendermintLightBlock(height uint64) (common.Hash, error)
- func (e *BSCExecutor) UpdateCachedLatestValidatorsLoop()
- func (e *BSCExecutor) UpdateClientLoop()
- type ConsensusState
- type GnfdCompositeClients
- type GreenfieldClient
- type GreenfieldExecutor
- func (e *GreenfieldExecutor) BroadcastVote(v *votepool.Vote) error
- func (e *GreenfieldExecutor) CallZkmeSBTAckMintedContract(chainId uint32, user ethcommon.Address, status uint8, nonce uint64) (ethcommon.Hash, error)
- func (e *GreenfieldExecutor) ClaimPackages(client *GreenfieldClient, payloadBts []byte, aggregatedSig []byte, ...) (string, error)
- func (e *GreenfieldExecutor) GetBlockAndBlockResultAtHeight(height int64) (*tmtypes.Block, *ctypes.ResultBlockResults, error)
- func (e *GreenfieldExecutor) GetEthClient() *ethclient.Client
- func (e *GreenfieldExecutor) GetGnfdClient() *GreenfieldClient
- func (e *GreenfieldExecutor) GetInturnRelayer(srcChain oracletypes.ClaimSrcChain) (*oracletypes.QueryInturnRelayerResponse, error)
- func (e *GreenfieldExecutor) GetLatestBlockHeight() (latestHeight uint64, err error)
- func (e *GreenfieldExecutor) GetNextDeliverySequenceForChannelWithRetry(channelID types.ChannelId) (sequence uint64, err error)
- func (e *GreenfieldExecutor) GetNextReceiveOracleSequence(destChainId sdk.ChainID) (uint64, error)
- func (e *GreenfieldExecutor) GetNextReceiveSequenceForChannel(destChainId sdk.ChainID, channelId types.ChannelId) (uint64, error)
- func (e *GreenfieldExecutor) GetNextSendSequenceForChannelWithRetry(destChainID sdk.ChainID, channelID types.ChannelId) (sequence uint64, err error)
- func (e *GreenfieldExecutor) GetNonce() (uint64, error)
- func (e *GreenfieldExecutor) GetNonceOnNextBlock() (uint64, error)
- func (e *GreenfieldExecutor) GetValidatorsBlsPublicKey() ([]string, error)
- func (e *GreenfieldExecutor) QueryCachedLatestValidators() ([]*tmtypes.Validator, error)
- func (e *GreenfieldExecutor) QueryTendermintLightBlock(height int64) (tmtypes.LightBlock, error)
- func (e *GreenfieldExecutor) QueryValidatorsAtHeight(height uint64) ([]*tmtypes.Validator, error)
- func (e *GreenfieldExecutor) QueryVotesByEventHashAndType(eventHash []byte, eventType votepool.EventType) ([]*votepool.Vote, error)
- func (e *GreenfieldExecutor) SetBSCExecutor(be *BSCExecutor)
- func (e *GreenfieldExecutor) UpdateCachedLatestValidatorsLoop()
Constants ¶
const ( DefaultGasPrice = 20000000000 // 20 GWei FallBehindThreshold = 5 SleepSecondForUpdateClient = 10 DataSeedDenyServiceThreshold = 60 RPCTimeout = 3 * time.Second RelayerBytesLength = 128 UpdateCachedValidatorsInterval = 1 * time.Minute ClaimRewardInterval = 1 * time.Minute MaxTxSizeForFixGasLimit = 32768 // 32kb EstimatedTxExtraMetaSize = 1024 // in bytes GnfdGasPrice = int64(5000000000) GasLimitRatio = int64(10) )
Variables ¶
Functions ¶
func ApplyLightBlock ¶
func ApplyLightBlock(cs *ConsensusState, block *tmtypes.LightBlock) (bool, error)
func EncodeLightBlockValidationResult ¶
output: | validatorSetChanged | empty | consensusStateBytesLength | new consensusState | | 1 byte | 23 bytes | 8 bytes | |
func GetTestConfig ¶
func InitExecutors ¶
func InitExecutors() (*BSCExecutor, *GreenfieldExecutor)
Types ¶
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 (*BSCExecutor) ClaimRewardLoop ¶
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 ¶
func (e *BSCExecutor) GetEthClient() *ethclient.Client
func (*BSCExecutor) GetGreenfieldLightClient ¶
func (e *BSCExecutor) GetGreenfieldLightClient() *greenfieldlightclient.Greenfieldlightclient
func (*BSCExecutor) GetInturnRelayer ¶
func (e *BSCExecutor) GetInturnRelayer() (*rtypes.InturnRelayer, error)
func (*BSCExecutor) GetLatestBlockHeightWithRetry ¶
func (e *BSCExecutor) GetLatestBlockHeightWithRetry() (latestHeight uint64, err error)
func (*BSCExecutor) GetLatestFinalizedBlockHeightWithRetry ¶
func (e *BSCExecutor) GetLatestFinalizedBlockHeightWithRetry() (latestHeight uint64, err error)
func (*BSCExecutor) GetLightClientLatestHeight ¶
func (e *BSCExecutor) GetLightClientLatestHeight() (uint64, error)
func (*BSCExecutor) GetNextDeliveryOracleSequenceWithRetry ¶
func (e *BSCExecutor) GetNextDeliveryOracleSequenceWithRetry(chainId sdk.ChainID) (sequence uint64, err error)
GetNextDeliveryOracleSequenceWithRetry gets the next delivery Oracle sequence from Greenfield
func (*BSCExecutor) GetNextReceiveSequenceForChannelWithRetry ¶
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 ¶
func (e *BSCExecutor) GetNextSendSequenceForChannelWithRetry() (sequence uint64, err error)
GetNextSendSequenceForChannelWithRetry gets the next send oracle sequence from BSC
func (*BSCExecutor) GetNonce ¶
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() (lightBlockBts []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 tmtypes.LightBlock, 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 ¶
type ConsensusState struct { ChainID string Height uint64 NextValidatorSetHash []byte ValidatorSet *cbfttypes.ValidatorSet }
func DecodeConsensusState ¶
func DecodeConsensusState(input []byte) (ConsensusState, error)
func DecodeLightBlockValidationInput ¶
func DecodeLightBlockValidationInput(input []byte) (*ConsensusState, error)
type GnfdCompositeClients ¶
type GnfdCompositeClients struct {
// contains filtered or unexported fields
}
func NewGnfdCompositClients ¶
func (*GnfdCompositeClients) GetClient ¶
func (gc *GnfdCompositeClients) GetClient() *GreenfieldClient
type GreenfieldClient ¶
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 ¶
func (e *GreenfieldExecutor) BroadcastVote(v *votepool.Vote) error
func (*GreenfieldExecutor) CallZkmeSBTAckMintedContract ¶
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 ¶
func (e *GreenfieldExecutor) GetBlockAndBlockResultAtHeight(height int64) (*tmtypes.Block, *ctypes.ResultBlockResults, error)
func (*GreenfieldExecutor) GetEthClient ¶
func (e *GreenfieldExecutor) GetEthClient() *ethclient.Client
func (*GreenfieldExecutor) GetGnfdClient ¶
func (e *GreenfieldExecutor) GetGnfdClient() *GreenfieldClient
func (*GreenfieldExecutor) GetInturnRelayer ¶
func (e *GreenfieldExecutor) GetInturnRelayer(srcChain oracletypes.ClaimSrcChain) (*oracletypes.QueryInturnRelayerResponse, error)
func (*GreenfieldExecutor) GetLatestBlockHeight ¶
func (e *GreenfieldExecutor) GetLatestBlockHeight() (latestHeight uint64, err error)
func (*GreenfieldExecutor) GetNextDeliverySequenceForChannelWithRetry ¶
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 ¶
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 ¶
func (e *GreenfieldExecutor) GetNonce() (uint64, error)
func (*GreenfieldExecutor) GetNonceOnNextBlock ¶
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) (tmtypes.LightBlock, error)
func (*GreenfieldExecutor) QueryValidatorsAtHeight ¶
func (e *GreenfieldExecutor) QueryValidatorsAtHeight(height uint64) ([]*tmtypes.Validator, error)
func (*GreenfieldExecutor) QueryVotesByEventHashAndType ¶
func (*GreenfieldExecutor) SetBSCExecutor ¶
func (e *GreenfieldExecutor) SetBSCExecutor(be *BSCExecutor)
func (*GreenfieldExecutor) UpdateCachedLatestValidatorsLoop ¶
func (e *GreenfieldExecutor) UpdateCachedLatestValidatorsLoop()