Documentation
¶
Index ¶
- Constants
- Variables
- func BorFailoverConfigured(cfg CustomConfig) bool
- func BroadcastTx(clientCtx client.Context, txf clienttx.Factory, msgs ...sdk.Msg) (*sdk.TxResponse, error)
- func CalculateSequence(blockNumber, logIndex uint64) string
- func CheckEventAlreadyProcessed(ctx context.Context, checker SequenceChecker, blockNumber, logIndex uint64, ...) bool
- func CloseBorChainClients()
- func DecorateWithCometBFTFlags(cmd *cobra.Command, v *viper.Viper, loggerInstance logger.Logger, ...)
- func DecorateWithHeimdallFlags(cmd *cobra.Command, v *viper.Viper, loggerInstance logger.Logger, ...)
- func ErrFailedToGetValidator(validatorAddr string) string
- func ErrFailedToGetValidatorPublicKey(validatorAddr string) string
- func ErrIncorrectNonceDuringPostHandle(handlerType string) string
- func ErrInvalidSideTxMsg(msgType string) string
- func ErrSkippingMsg(msgType string) string
- func ErrTypeMismatch(msgType string) string
- func EventByID(abiObject *abi.ABI, sigData []byte) *abi.Event
- func ExponentialBackoff(action func() error, maxValue uint, wait time.Duration) error
- func FetchAndValidateReceipt(ctx context.Context, contractCaller IContractCaller, ...) *ethTypes.Receipt
- func FetchFromAPI(URL string) ([]byte, error)
- func GenerateAuthObj(client *ethclient.Client, address common.Address, data []byte) (auth *bind.TransactOpts, err error)
- func GenerateAuthObjWithContext(ctx context.Context, timeout time.Duration, client *ethclient.Client, ...) (auth *bind.TransactOpts, err error)
- func GetAddress() []byte
- func GetAddressString() (string, error)
- func GetBeginBlockEvents(ctx context.Context, client *httpClient.HTTP, height int64) ([]abci.Event, error)
- func GetBorChainCallTimeout() time.Duration
- func GetBorClient() *ethclient.Client
- func GetBorGRPCClient() borgrpc.Client
- func GetBorRPCClient() *rpc.Client
- func GetBorStallThreshold(ctx sdk.Context) int64
- func GetChangeProducerThreshold(ctx sdk.Context) int64
- func GetDisableVPCheckHeight() int64
- func GetDisableValSetCheckHeight() int64
- func GetFallbackProducerVotes() []uint64
- func GetFaultyMilestoneNumber() uint64
- func GetFeeWithdrawValidatorGateHeight() int64
- func GetFromAddress(cliCtx client.Context) string
- func GetHeimdallServerEndpoint(endpoint string) string
- func GetInitialBlockHeight(chainID string) uint64
- func GetInitialHeight() int64
- func GetIthacaHeight() int64
- func GetLogsWriter(logsWriterFile string) io.Writer
- func GetMainChainRPCClient() *rpc.Client
- func GetMainClient() *ethclient.Client
- func GetMilestoneDeletionHeight() int64
- func GetNodeStatus(ctx context.Context, cliCtx cosmosContext.Context) (*ctypes.ResultStatus, error)
- func GetPhuketHardforkHeight() int64
- func GetPowerFromAmount(amount *big.Int) (*big.Int, error)
- func GetPrivKey() secp256k1.PrivKey
- func GetProducerSetLimit(ctx sdk.Context) uint64
- func GetProducerVotes() []uint64
- func GetPubKey() secp256k1.PubKey
- func GetRioHeight() int64
- func GetSetProducerDowntimeHeight() int64
- func GetSpanRotationBuffer(ctx sdk.Context) uint64
- func GetTallyFixHeight() int64
- func GetValidChains() []string
- func GetZurichHardforkHeight() int64
- func InitHeimdallConfig(homeDir string)
- func InitHeimdallConfigWith(homeDir string, heimdallConfigFileFromFlag string)
- func InitTestHeimdallConfig(chain string)
- func IsFeeWithdrawValidatorGate(height int64) bool
- func IsIthaca(height int64) bool
- func IsPhuketHardfork(height int64) bool
- func IsPubKeyFirstByteValid(pubKey []byte) bool
- func IsRio(blockNum uint64) bool
- func IsSideTxApproved(sideTxResult sidetxs.Vote) bool
- func IsZurichHardfork(height int64) bool
- func LogEventAlreadyProcessedIn(moduleName string) string
- func LogLevelOption(logLevelStr string) (logger.Option, error)
- func LogLevelOptionOrDefault(logLevelStr string, warnf func(string, ...any)) logger.Option
- func LogReceivedTaskToSend(msgType string) string
- func LogSuccessfullyValidated(msgType string) string
- func LogValidatingExternalCall(msgType string) string
- func LogValidatingMsg(msgType string) string
- func PrefetchReceipts(ctx context.Context, contractCaller IContractCaller, txHashes []common.Hash, ...)
- func QueryTxBytesFromBlock(cliCtx cosmosContext.Context, hash []byte, height int64) ([]byte, error)
- func QueryTxWithProof(cliCtx cosmosContext.Context, hash []byte) (*ctypes.ResultTx, error)
- func SanitizeConfig(rootViper *viper.Viper, logger log.Logger) error
- func SecureRandomInt(minValue, maxLimit int64) (int64, error)
- func SetFeeWithdrawValidatorGateHeight(height int64)
- func SetIthacaHeight(height int64)
- func SetPhuketHardforkHeight(height int64)
- func SetRioHeight(height int64)
- func SetTestConfig(cfg CustomAppConfig)
- func SetTestInitialHeight(height int64)
- func SetTestPrivPubKey(privKey secp256k1.PrivKey)
- func SetZurichHardforkHeight(height int64)
- func ToBytes32(x []byte) [32]byte
- func UnpackLog(abiObject *abi.ABI, out interface{}, event string, log *types.Log) error
- func UnpackSigAndVotes(payload []byte, abi abi.ABI) (data []byte, sigs []byte, reserved []byte, err error)
- func UpdateCometBFTConfig(cometBFTConfig *cfg.Config, v *viper.Viper)
- func ValidateChainID(msgChainID string, expectedChainID string, logger log.Logger, ...) bool
- func ValidateVotingPower(amount *big.Int, logger log.Logger, validatorID uint64, moduleName string) bool
- type BorGRPCClienter
- type ChainManagerAddressMigration
- type ContractCaller
- func (c *ContractCaller) ApproveTokens(amount *big.Int, stakeManager common.Address, tokenAddress common.Address, ...) error
- func (c *ContractCaller) BatchGetMainChainTxReceipts(ctx context.Context, txHashes []common.Hash) map[common.Hash]*ethTypes.Receipt
- func (c *ContractCaller) BeginPrefetchRound()
- func (c *ContractCaller) CheckIfBlocksExist(ctx context.Context, number uint64) (bool, error)
- func (c *ContractCaller) CurrentAccountStateRoot(stakingInfoInstance *stakinginfo.Stakinginfo) ([32]byte, error)
- func (c *ContractCaller) CurrentHeaderBlock(rootChainInstance *rootchain.Rootchain, childBlockInterval uint64) (uint64, error)
- func (c *ContractCaller) CurrentSpanNumber(validatorSetInstance *validatorset.Validatorset) (Number *big.Int)
- func (c *ContractCaller) CurrentStateCounter(stateSenderInstance *statesender.Statesender) (Number *big.Int)
- func (c *ContractCaller) DecodeNewHeaderBlockEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*rootchain.RootchainNewHeaderBlock, error)
- func (c *ContractCaller) DecodeSignerUpdateEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoSignerChange, error)
- func (c *ContractCaller) DecodeSlashedEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoSlashed, error)
- func (c *ContractCaller) DecodeStateSyncedEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*statesender.StatesenderStateSynced, error)
- func (c *ContractCaller) DecodeUnJailedEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoUnJailed, error)
- func (c *ContractCaller) DecodeValidatorExitEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoUnstakeInit, error)
- func (c *ContractCaller) DecodeValidatorJoinEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoStaked, error)
- func (c *ContractCaller) DecodeValidatorStakeUpdateEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoStakeUpdate, error)
- func (c *ContractCaller) DecodeValidatorTopupFeesEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoTopUpFee, error)
- func (c *ContractCaller) EndPrefetchRound()
- func (c *ContractCaller) GetBalance(address common.Address) (*big.Int, error)
- func (c *ContractCaller) GetBlockByNumber(ctx context.Context, blockNumber uint64) (*ethTypes.Block, error)
- func (c *ContractCaller) GetBlockNumberFromTxHash(tx common.Hash) (*big.Int, error)
- func (c *ContractCaller) GetBorChainBlock(ctx context.Context, blockNum *big.Int) (header *ethTypes.Header, err error)
- func (c *ContractCaller) GetBorChainBlockAuthor(ctx context.Context, blockNum *big.Int) (*common.Address, error)
- func (c *ContractCaller) GetBorChainBlockInfoInBatch(ctx context.Context, start, end int64) ([]*ethTypes.Header, []uint64, []common.Address, error)
- func (c *ContractCaller) GetBorChainBlockTd(ctx context.Context, blockHash common.Hash) (uint64, error)
- func (c *ContractCaller) GetBorTxReceipt(txHash common.Hash) (*ethTypes.Receipt, error)
- func (c *ContractCaller) GetCheckpointSign(txHash common.Hash) ([]byte, []byte, []byte, error)
- func (c *ContractCaller) GetConfirmedTxReceipt(ctx context.Context, tx common.Hash, requiredConfirmations uint64) (*ethTypes.Receipt, error)
- func (c *ContractCaller) GetHeaderInfo(ctx context.Context, headerID uint64, rootChainInstance *rootchain.Rootchain, ...) (root common.Hash, start, end, createdAt uint64, proposer string, err error)
- func (c *ContractCaller) GetLastChildBlock(rootChainInstance *rootchain.Rootchain) (uint64, error)
- func (c *ContractCaller) GetMainChainBlock(ctx context.Context, blockNum *big.Int) (header *ethTypes.Header, err error)
- func (c *ContractCaller) GetMainChainBlockTime(ctx context.Context, blockNum uint64) (time.Time, error)
- func (c *ContractCaller) GetMainChainFinalizedBlock(ctx context.Context) (header *ethTypes.Header, err error)
- func (c *ContractCaller) GetMainTxReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
- func (c *ContractCaller) GetRootChainInstance(rootChainAddress string) (*rootchain.Rootchain, error)
- func (c *ContractCaller) GetRootHash(ctx context.Context, start, end, checkpointLength uint64) ([]byte, error)
- func (c *ContractCaller) GetSlashManagerInstance(slashManagerAddress string) (*slashmanager.Slashmanager, error)
- func (c *ContractCaller) GetSpanDetails(id *big.Int, validatorSetInstance *validatorset.Validatorset) (*big.Int, *big.Int, *big.Int, error)
- func (c *ContractCaller) GetStakeManagerInstance(stakingManagerAddress string) (*stakemanager.Stakemanager, error)
- func (c *ContractCaller) GetStakingInfoInstance(stakingInfoAddress string) (*stakinginfo.Stakinginfo, error)
- func (c *ContractCaller) GetStateReceiverInstance(stateReceiverAddress string) (*statereceiver.Statereceiver, error)
- func (c *ContractCaller) GetStateSenderInstance(stateSenderAddress string) (*statesender.Statesender, error)
- func (c *ContractCaller) GetTokenInstance(tokenAddress string) (*erc20.Erc20, error)
- func (c *ContractCaller) GetValidatorInfo(valID uint64, stakingInfoInstance *stakinginfo.Stakinginfo) (validator types.Validator, err error)
- func (c *ContractCaller) GetValidatorSetInstance(validatorSetAddress string) (*validatorset.Validatorset, error)
- func (c *ContractCaller) GetVoteOnHash(start, end uint64, hash, milestoneID string) (bool, error)
- func (c *ContractCaller) IsTxConfirmed(ctx context.Context, txHash common.Hash, requiredConfirmations uint64) bool
- func (c *ContractCaller) SendCheckpoint(signedData []byte, sigs [][3]*big.Int, rootChainAddress common.Address, ...) error
- func (c *ContractCaller) StakeFor(val common.Address, stakeAmount *big.Int, feeAmount *big.Int, ...) error
- type CustomAppConfig
- type CustomConfig
- type EthClient
- type HTTPClient
- type IContractCaller
- type ReceiptValidationParams
- type SequenceChecker
- type TestOpts
Constants ¶
const ( // smart contracts' events names NewHeaderBlockEvent = "NewHeaderBlock" TopUpFeeEvent = "TopUpFee" StakedEvent = "Staked" StakeUpdateEvent = "StakeUpdate" UnstakeInitEvent = "UnstakeInit" SignerChangeEvent = "SignerChange" StateSyncedEvent = "StateSynced" SlashedEvent = "Slashed" UnJailedEvent = "UnJailed" )
const ( CometBFTNodeFlag = "node" WithHeimdallConfigFlag = "app" RestServerFlag = "rest-server" BridgeFlag = "bridge" AllProcessesFlag = "all" OnlyProcessesFlag = "only" LogsWriterFileFlag = "logs_writer_file" SeedsFlag = "seeds" MainChain = "mainnet" MumbaiChain = "mumbai" AmoyChain = "amoy" MainRPCUrlFlag = "eth_rpc_url" BorRPCUrlFlag = "bor_rpc_url" BorGRPCUrlFlag = "bor_grpc_url" BorGRPCFlagFlag = "bor_grpc_flag" BorGRPCTokenFlag = "bor_grpc_token" // #nosec G101 -- config key name, not a credential value CometBFTNodeURLFlag = "comet_bft_rpc_url" HeimdallServerURLFlag = "heimdall_rest_server" GRPCServerURLFlag = "grpc_server" AmqpURLFlag = "amqp_url" CheckpointerPollIntervalFlag = "checkpoint_poll_interval" SyncerPollIntervalFlag = "syncer_poll_interval" NoACKPollIntervalFlag = "noack_poll_interval" ClerkPollIntervalFlag = "clerk_poll_interval" SpanPollIntervalFlag = "span_poll_interval" MilestonePollIntervalFlag = "milestone_poll_interval" MainChainGasFeeCapFlag = "main_chain_gas_fee_cap" MainChainGasTipCapFlag = "main_chain_gas_tip_cap" NoACKWaitTimeFlag = "no_ack_wait_time" ChainFlag = "chain" ProducerVotesFlag = "producer_votes" DefaultMainRPCUrl = "http://localhost:9545" DefaultBorRPCUrl = "http://localhost:8545" DefaultBorGRPCUrl = "localhost:3131" DefaultBorGRPCFlag = false DefaultEthRPCTimeout = 5 * time.Second DefaultBorRPCTimeout = 1 * time.Second // DefaultAmqpURL represents default AMQP url DefaultAmqpURL = "amqp://guest:guest@localhost:5672/" //nolint:gosec // G101: well-known RabbitMQ default credentials for local development DefaultHeimdallServerURL = "tcp://0.0.0.0:1317" DefaultCometBFTNodeURL = "http://0.0.0.0:26657" NoACKWaitTime = 1800 * time.Second // Time ack service waits to clear the buffer and elect the new proposer (1800 seconds ~ 30 min) DefaultCheckpointPollInterval = 5 * time.Minute DefaultSyncerPollInterval = 1 * time.Minute DefaultNoACKPollInterval = 1010 * time.Second DefaultClerkPollInterval = 10 * time.Second DefaultSpanPollInterval = 1 * time.Minute DefaultMilestonePollInterval = 30 * time.Second // LogTimestampFormat is the millisecond-precision timestamp layout used for // all heimdall log output. Matches bor's log format for consistent // cross-service log analysis. LogTimestampFormat = "2006-01-02T15:04:05.000Z07:00" // Self-healing defaults DefaultEnableSH = false DefaultSHStateSyncedInterval = 3 * time.Hour DefaultSHStakeUpdateInterval = 3 * time.Hour DefaultSHCheckpointAckInterval = 30 * time.Minute DefaultSHMaxDepthDuration = 24 * time.Hour DefaultMainChainGasFeeCap = 500000000000 // 500 Gwei DefaultMainChainGasTipCap = 10000000000 // 10 Gwei DefaultBorChainID = "15001" DefaultHeimdallChainID = "heimdall-15001" DefaultLogsType = "json" DefaultChain = MainChain DefaultMainnetSeeds = "" /* 547-byte string literal not displayed */ DefaultAmoyTestnetSeeds = "" /* 483-byte string literal not displayed */ DefaultMainnetProducers = "91,92,93,94" DefaultAmoyTestnetProducers = "4,5" DefaultMumbaiTestnetProducers = "1,2,3" DefaultLocalTestnetProducers = "1,2,3,4" // MaxStateSyncSize is the new max state sync size after SpanOverrideHeight hard fork MaxStateSyncSize = 30000 EnforcedMinRetainBlocks = 2000000 )
const (
APIBodyLimit = 128 * 1024 * 1024 // 128 MB
)
const (
CommitTimeout = 2 * time.Minute
)
const DefaultConfigTemplate = `` /* 2606-byte string literal not displayed */
const ( // MaxBorRPCTimeout caps bor_rpc_timeout so BorRPCTimeout × maxBudgetedEndpoints // (the GetBorChainCallTimeout budget) stays within maxBorChainCallBudget. MaxBorRPCTimeout = maxBorChainCallBudget / maxBudgetedEndpoints )
Variables ¶
var ContractsABIsMap = make(map[string]*abi.ABI)
ContractsABIsMap is a cached map holding the ABIs of the contracts
var Logger logger.Logger
Logger stores global logger object
Functions ¶
func BorFailoverConfigured ¶ added in v0.9.0
func BorFailoverConfigured(cfg CustomConfig) bool
BorFailoverConfigured reports whether the Bor client config enables multi-endpoint failover on either transport.
func BroadcastTx ¶
func BroadcastTx(clientCtx client.Context, txf clienttx.Factory, msgs ...sdk.Msg) (*sdk.TxResponse, error)
BroadcastTx attempts to generate, sign, and broadcast a transaction with the given set of messages. It will also simulate gas requirements if necessary. It will return an error upon failure.
func CalculateSequence ¶ added in v0.6.0
CalculateSequence computes the unique sequence ID from block number and log index. Formula: sequence = (blockNumber × DefaultLogIndexUnit) + logIndex This creates a unique identifier for each event based on its position in the blockchain.
func CheckEventAlreadyProcessed ¶ added in v0.6.0
func CheckEventAlreadyProcessed( ctx context.Context, checker SequenceChecker, blockNumber, logIndex uint64, logger log.Logger, moduleName string, ) bool
CheckEventAlreadyProcessed checks if an event has already been processed based on its sequence. It calculates the sequence from blockNumber and logIndex, then checks if it exists in storage. Returns true if the event was already processed (caller should vote NO). Returns false if the event is new and can be processed.
func CloseBorChainClients ¶ added in v0.9.0
func CloseBorChainClients()
CloseBorChainClients stops the Bor failover background probers, closes the HTTP probe clients and the HTTP JSON-RPC client, and closes the gRPC connections. It is the termination path for those goroutines; wire it into Heimdall's shutdown. Safe to call when neither failover is configured.
func DecorateWithCometBFTFlags ¶
func DecorateWithCometBFTFlags(cmd *cobra.Command, v *viper.Viper, loggerInstance logger.Logger, message string)
DecorateWithCometBFTFlags creates cometBFT flags for the desired command and binds them to viper
func DecorateWithHeimdallFlags ¶
func DecorateWithHeimdallFlags(cmd *cobra.Command, v *viper.Viper, loggerInstance logger.Logger, caller string)
DecorateWithHeimdallFlags adds persistent flags for app configs and bind flags with command
func ErrFailedToGetValidator ¶ added in v0.6.0
ErrFailedToGetValidator generates an error message for validator retrieval failures
func ErrFailedToGetValidatorPublicKey ¶ added in v0.6.0
ErrFailedToGetValidatorPublicKey generates an error message for validator public key retrieval failures
func ErrIncorrectNonceDuringPostHandle ¶ added in v0.6.0
ErrIncorrectNonceDuringPostHandle generates a nonce error message for post-handlers
func ErrInvalidSideTxMsg ¶ added in v0.6.0
ErrInvalidSideTxMsg generates an error message for invalid side-tx messages
func ErrSkippingMsg ¶ added in v0.6.0
ErrSkippingMsg generates a message for when a handler is skipped
func ErrTypeMismatch ¶ added in v0.6.0
ErrTypeMismatch generates a type mismatch error message for a given message type
func ExponentialBackoff ¶
ExponentialBackoff performs exponential backoff attempts on a given action
func FetchAndValidateReceipt ¶ added in v0.6.0
func FetchAndValidateReceipt( ctx context.Context, contractCaller IContractCaller, params ReceiptValidationParams, logger log.Logger, ) *ethTypes.Receipt
FetchAndValidateReceipt fetches and validates the confirmed tx receipt; returns nil if either the fetch fails or the receipt's block number disagrees with the message's. Callers should vote NO on nil.
func FetchFromAPI ¶
FetchFromAPI fetches data from any URL with a limited read size
func GenerateAuthObj ¶
func GenerateAuthObj(client *ethclient.Client, address common.Address, data []byte) (auth *bind.TransactOpts, err error)
GenerateAuthObj creates a transaction auth object with EIP-1559 gas pricing.
func GenerateAuthObjWithContext ¶ added in v0.9.0
func GenerateAuthObjWithContext(ctx context.Context, timeout time.Duration, client *ethclient.Client, address common.Address, data []byte) (auth *bind.TransactOpts, err error)
GenerateAuthObjWithContext creates a transaction auth object using ctx as the parent cancellation signal and timeout as the budget for each RPC call.
func GetAddressString ¶
GetAddressString returns the address object as string
func GetBeginBlockEvents ¶
func GetBeginBlockEvents(ctx context.Context, client *httpClient.HTTP, height int64) ([]abci.Event, error)
GetBeginBlockEvents get block through per height
func GetBorChainCallTimeout ¶ added in v0.9.0
GetBorChainCallTimeout returns the time budget a caller should allow for a single Bor call. With failover it is the clamped per-endpoint timeout (min(BorRPCTimeout, MaxBorRPCTimeout)) times the budgeted endpoint count, so a cascade can reach a fallback within one caller-scoped context — go-ethereum's rpc.Client re-checks that context after the request returns, so a budget of only one attempt would race a successful fallback against the expired deadline. A single endpoint yields the clamped BorRPCTimeout unchanged.
The endpoint count is the larger of the HTTP and gRPC lists because both the HTTP client (used by the broadcaster) and the gRPC client (used by side handlers) share this single budget, and it is capped at maxBudgetedEndpoints so a large count can't push one call past CometBFT's ~10s ABCI budget. The cap is on the time budget, not the attempt count: the deadline stops the cascade, so fast-failing endpoints beyond the cap may still be tried within the budget, while slow ones beyond it are reached on later calls.
func GetBorGRPCClient ¶
GetBorGRPCClient returns bor gRPC client
func GetBorStallThreshold ¶ added in v0.10.0
GetBorStallThreshold is the number of Heimdall heights the >1/3-agreed pending bor head may stay static before a span rotation is forced. It reuses the change-producer threshold ("same number as regular forced rotation") but is a distinct getter so it can be tuned independently later.
func GetChangeProducerThreshold ¶ added in v0.5.2
func GetDisableVPCheckHeight ¶ added in v0.3.0
func GetDisableVPCheckHeight() int64
func GetDisableValSetCheckHeight ¶ added in v0.3.0
func GetDisableValSetCheckHeight() int64
func GetFallbackProducerVotes ¶ added in v0.1.33
func GetFallbackProducerVotes() []uint64
func GetFaultyMilestoneNumber ¶ added in v0.3.1
func GetFaultyMilestoneNumber() uint64
func GetFeeWithdrawValidatorGateHeight ¶ added in v0.8.1
func GetFeeWithdrawValidatorGateHeight() int64
func GetFromAddress ¶
GetFromAddress returns the from address from the context's name
func GetHeimdallServerEndpoint ¶
GetHeimdallServerEndpoint returns heimdall server endpoint
func GetInitialBlockHeight ¶ added in v0.2.10
func GetInitialHeight ¶ added in v0.3.0
func GetInitialHeight() int64
func GetIthacaHeight ¶ added in v0.10.0
func GetIthacaHeight() int64
func GetLogsWriter ¶
func GetMainChainRPCClient ¶
GetMainChainRPCClient returns main chain RPC client
func GetMainClient ¶
GetMainClient returns main chain's eth client
func GetMilestoneDeletionHeight ¶ added in v0.3.1
func GetMilestoneDeletionHeight() int64
func GetNodeStatus ¶
func GetNodeStatus(ctx context.Context, cliCtx cosmosContext.Context) (*ctypes.ResultStatus, error)
GetNodeStatus returns node status
func GetPhuketHardforkHeight ¶ added in v0.7.1
func GetPhuketHardforkHeight() int64
func GetPowerFromAmount ¶
GetPowerFromAmount returns power from amount -- note that this will populate the amount object
func GetProducerSetLimit ¶ added in v0.5.2
func GetProducerVotes ¶ added in v0.1.33
func GetProducerVotes() []uint64
func GetRioHeight ¶ added in v0.4.0
func GetRioHeight() int64
func GetSetProducerDowntimeHeight ¶ added in v0.5.2
func GetSetProducerDowntimeHeight() int64
func GetSpanRotationBuffer ¶ added in v0.5.2
func GetTallyFixHeight ¶ added in v0.3.0
func GetTallyFixHeight() int64
func GetZurichHardforkHeight ¶ added in v0.9.0
func GetZurichHardforkHeight() int64
func InitHeimdallConfig ¶
func InitHeimdallConfig(homeDir string)
InitHeimdallConfig initializes with viper config (from heimdall configuration)
func InitHeimdallConfigWith ¶
InitHeimdallConfigWith initializes passed heimdall/tendermint config files
func InitTestHeimdallConfig ¶
func InitTestHeimdallConfig(chain string)
InitTestHeimdallConfig initializes test config for the unit tests
func IsFeeWithdrawValidatorGate ¶ added in v0.8.1
func IsPhuketHardfork ¶ added in v0.7.1
func IsPubKeyFirstByteValid ¶
IsPubKeyFirstByteValid checks the validity of the public key's first byte. It must be 0x04 for uncompressed public keys
func IsSideTxApproved ¶ added in v0.6.0
IsSideTxApproved checks if a side transaction received YES votes. This is a simple helper to make post-handler code more readable. Returns true if the side transaction was approved (VOTE_YES).
func IsZurichHardfork ¶ added in v0.9.0
func LogEventAlreadyProcessedIn ¶ added in v0.6.0
LogEventAlreadyProcessedIn generates the module-specific event processing error
func LogLevelOption ¶ added in v0.10.0
LogLevelOption converts a log_level string into the matching logger option.
A plain level ("info", "debug", ...) applies to every module and is gated cheaply by zerolog itself. A comma-separated list of "module:level" pairs with an optional "*:level" default ("*:info,mempool:debug") filters per module instead, so debug can be scoped to a single subsystem without the firehose that a global debug level produces on a busy node.
func LogLevelOptionOrDefault ¶ added in v0.10.0
LogLevelOptionOrDefault is LogLevelOption with a fallback: on a malformed spec it warns via warnf and returns the info-level option. A typo in log_level then degrades to info visibly, instead of silently mis-filtering.
func LogReceivedTaskToSend ¶ added in v0.6.0
LogReceivedTaskToSend generates a log message for received bridge tasks
func LogSuccessfullyValidated ¶ added in v0.6.0
LogSuccessfullyValidated generates a success log message after validation
func LogValidatingExternalCall ¶ added in v0.6.0
LogValidatingExternalCall generates a debug log message for validation
func LogValidatingMsg ¶ added in v0.6.0
LogValidatingMsg generates a validation start message
func PrefetchReceipts ¶ added in v0.9.0
func PrefetchReceipts(ctx context.Context, contractCaller IContractCaller, txHashes []common.Hash, logger log.Logger)
PrefetchReceipts batch-fetches L1 receipts in a single JSON-RPC call and caches them. Finality is checked later by GetConfirmedTxReceipt when side handlers run.
func QueryTxBytesFromBlock ¶ added in v0.9.0
QueryTxBytesFromBlock returns the raw bytes of the tx with the given hash inside the block at the given height. It reads from the BlockStore via the node's /block RPC and does not depend on the cometbft tx_index — so it works even when the node is configured with `indexer = "null"`.
Used by the bridge checkpoint flow which previously called node.Tx(hash, true) just to retrieve the tx bytes for sign-bytes recomputation. The bridge already has the block height in hand, so the indexer detour is unnecessary.
func QueryTxWithProof ¶
QueryTxWithProof query tx with proof from the node
func SanitizeConfig ¶ added in v0.4.3
func SecureRandomInt ¶
SecureRandomInt generates a cryptographically secure random integer between minValue and maxLimit inclusive.
func SetFeeWithdrawValidatorGateHeight ¶ added in v0.8.1
func SetFeeWithdrawValidatorGateHeight(height int64)
func SetIthacaHeight ¶ added in v0.10.0
func SetIthacaHeight(height int64)
func SetPhuketHardforkHeight ¶ added in v0.7.1
func SetPhuketHardforkHeight(height int64)
func SetRioHeight ¶ added in v0.4.0
func SetRioHeight(height int64)
func SetTestInitialHeight ¶ added in v0.3.0
func SetTestInitialHeight(height int64)
SetTestInitialHeight sets test the initial height for testing
func SetTestPrivPubKey ¶
SetTestPrivPubKey sets test the private and public keys for testing
func SetZurichHardforkHeight ¶ added in v0.9.0
func SetZurichHardforkHeight(height int64)
func ToBytes32 ¶
ToBytes32 is a convenience method for converting a byte slice to a fixed-sized 32-byte array. This method will truncate the input if it is larger than 32 bytes.
func UnpackSigAndVotes ¶
func UnpackSigAndVotes(payload []byte, abi abi.ABI) (data []byte, sigs []byte, reserved []byte, err error)
UnpackSigAndVotes Unpacks Sig and Votes from Tx Payload For current rootchain ABI: submitHeaderBlock(bytes data, bytes sigs) Returns: (data, sigs, empty, error) to maintain backward compatibility
func UpdateCometBFTConfig ¶
UpdateCometBFTConfig updates cometBFT config with flags and default values if needed
func ValidateChainID ¶ added in v0.6.0
func ValidateChainID( msgChainID string, expectedChainID string, logger log.Logger, moduleName string, ) bool
ValidateChainID checks if the message chain ID matches the expected Bor chain ID. Returns true if the chain ID is valid, false otherwise. This is used to ensure messages are from the correct blockchain network.
func ValidateVotingPower ¶ added in v0.6.0
func ValidateVotingPower( amount *big.Int, logger log.Logger, validatorID uint64, moduleName string, ) bool
ValidateVotingPower validates that the given amount can produce valid voting power. This is typically used in stake-related operations to ensure the staked amount is enough to generate meaningful voting power. Returns true if the amount produces valid voting power, false otherwise.
Types ¶
type BorGRPCClienter ¶ added in v0.9.0
type BorGRPCClienter interface {
HeaderByNumber(ctx context.Context, blockID int64) (*ethTypes.Header, error)
BlockByNumber(ctx context.Context, blockID int64) (*ethTypes.Block, error)
GetRootHash(ctx context.Context, startBlock uint64, endBlock uint64) (string, error)
GetVoteOnHash(ctx context.Context, startBlock uint64, endBlock uint64, rootHash string, milestoneId string) (bool, error)
GetAuthor(ctx context.Context, blockNum *big.Int) (*common.Address, error)
GetTdByHash(ctx context.Context, hash common.Hash) (uint64, error)
GetTdByNumber(ctx context.Context, blockNum *big.Int) (uint64, error)
GetBlockInfoInBatch(ctx context.Context, start, end int64) ([]*ethTypes.Header, []uint64, []common.Address, error)
TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
BorBlockReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
}
BorGRPCClienter is the subset of *grpc.BorGRPCClient used by helper code. Declared as an interface so tests can inject fakes without dialing a real bor gRPC server. The concrete *grpc.BorGRPCClient satisfies this interface automatically.
type ChainManagerAddressMigration ¶
type ChainManagerAddressMigration struct {
PolTokenAddress string
RootChainAddress string
StakingManagerAddress string
SlashManagerAddress string
StakingInfoAddress string
StateSenderAddress string
}
func GetChainManagerAddressMigration ¶
func GetChainManagerAddressMigration(blockNum int64) (ChainManagerAddressMigration, bool)
type ContractCaller ¶
type ContractCaller struct {
MainChainClient *ethclient.Client
MainChainRPCClient *rpc.Client
MainChainTimeout time.Duration
BorChainClient *ethclient.Client
BorChainRPCClient *rpc.Client
BorChainTimeout time.Duration
BorChainGrpcFlag bool
BorChainGrpcClient BorGRPCClienter
RootChainABI abi.ABI
StakingInfoABI abi.ABI
ValidatorSetABI abi.ABI
StateReceiverABI abi.ABI
StateSenderABI abi.ABI
StakeManagerABI abi.ABI
SlashManagerABI abi.ABI
PolTokenABI abi.ABI
ContractInstanceCache map[common.Address]interface{}
// contains filtered or unexported fields
}
ContractCaller contract caller
func NewContractCaller ¶
func NewContractCaller() (contractCallerObj ContractCaller, err error)
NewContractCaller contract caller
func (*ContractCaller) ApproveTokens ¶
func (c *ContractCaller) ApproveTokens(amount *big.Int, stakeManager common.Address, tokenAddress common.Address, tokenInstance *erc20.Erc20) error
ApproveTokens approves pol token for stake
func (*ContractCaller) BatchGetMainChainTxReceipts ¶ added in v0.9.0
func (c *ContractCaller) BatchGetMainChainTxReceipts(ctx context.Context, txHashes []common.Hash) map[common.Hash]*ethTypes.Receipt
BatchGetMainChainTxReceipts fetches multiple main chain tx receipts in a single JSON-RPC batch call. Returns a map of txHash → receipt. Failed individual requests are skipped.
func (*ContractCaller) BeginPrefetchRound ¶ added in v0.9.0
func (c *ContractCaller) BeginPrefetchRound()
BeginPrefetchRound starts a new round of prefetch lifecycle for ExtendVote.
func (*ContractCaller) CheckIfBlocksExist ¶
CheckIfBlocksExist - check if the given block number exists on the local chain. Here we check if the block number exists by fetching the header from the bor chain.
func (*ContractCaller) CurrentAccountStateRoot ¶
func (c *ContractCaller) CurrentAccountStateRoot(stakingInfoInstance *stakinginfo.Stakinginfo) ([32]byte, error)
CurrentAccountStateRoot get current account root from on the chain
func (*ContractCaller) CurrentHeaderBlock ¶
func (c *ContractCaller) CurrentHeaderBlock(rootChainInstance *rootchain.Rootchain, childBlockInterval uint64) (uint64, error)
CurrentHeaderBlock fetches the current header block
func (*ContractCaller) CurrentSpanNumber ¶
func (c *ContractCaller) CurrentSpanNumber(validatorSetInstance *validatorset.Validatorset) (Number *big.Int)
CurrentSpanNumber get current span
func (*ContractCaller) CurrentStateCounter ¶
func (c *ContractCaller) CurrentStateCounter(stateSenderInstance *statesender.Statesender) (Number *big.Int)
CurrentStateCounter get state counter
func (*ContractCaller) DecodeNewHeaderBlockEvent ¶
func (c *ContractCaller) DecodeNewHeaderBlockEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*rootchain.RootchainNewHeaderBlock, error)
DecodeNewHeaderBlockEvent represents the new header block event
func (*ContractCaller) DecodeSignerUpdateEvent ¶
func (c *ContractCaller) DecodeSignerUpdateEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoSignerChange, error)
DecodeSignerUpdateEvent represents sig update event
func (*ContractCaller) DecodeSlashedEvent ¶
func (c *ContractCaller) DecodeSlashedEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoSlashed, error)
DecodeSlashedEvent represents tick ack on contract
func (*ContractCaller) DecodeStateSyncedEvent ¶
func (c *ContractCaller) DecodeStateSyncedEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*statesender.StatesenderStateSynced, error)
DecodeStateSyncedEvent decode state sync data
func (*ContractCaller) DecodeUnJailedEvent ¶
func (c *ContractCaller) DecodeUnJailedEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoUnJailed, error)
DecodeUnJailedEvent represents unJail on contract
func (*ContractCaller) DecodeValidatorExitEvent ¶
func (c *ContractCaller) DecodeValidatorExitEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoUnstakeInit, error)
DecodeValidatorExitEvent represents validator stake unStake event
func (*ContractCaller) DecodeValidatorJoinEvent ¶
func (c *ContractCaller) DecodeValidatorJoinEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoStaked, error)
DecodeValidatorJoinEvent represents validator staked event
func (*ContractCaller) DecodeValidatorStakeUpdateEvent ¶
func (c *ContractCaller) DecodeValidatorStakeUpdateEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoStakeUpdate, error)
DecodeValidatorStakeUpdateEvent represents validator stake update event
func (*ContractCaller) DecodeValidatorTopupFeesEvent ¶
func (c *ContractCaller) DecodeValidatorTopupFeesEvent(contractAddressString string, receipt *ethTypes.Receipt, logIndex uint64) (*stakinginfo.StakinginfoTopUpFee, error)
DecodeValidatorTopupFeesEvent represents topUp for fees tokens
func (*ContractCaller) EndPrefetchRound ¶ added in v0.9.0
func (c *ContractCaller) EndPrefetchRound()
EndPrefetchRound clears the round of prefetch lifecycle for ExtendVote.
func (*ContractCaller) GetBalance ¶
GetBalance get balance of an account (returns big.Int balance won't fit in uint64)
func (*ContractCaller) GetBlockByNumber ¶
func (c *ContractCaller) GetBlockByNumber(ctx context.Context, blockNumber uint64) (*ethTypes.Block, error)
GetBlockByNumber returns blocks by number from the child chain (bor)
func (*ContractCaller) GetBlockNumberFromTxHash ¶
GetBlockNumberFromTxHash gets the block number of transaction
func (*ContractCaller) GetBorChainBlock ¶
func (c *ContractCaller) GetBorChainBlock(ctx context.Context, blockNum *big.Int) (header *ethTypes.Header, err error)
GetBorChainBlock returns bor chain block header
func (*ContractCaller) GetBorChainBlockAuthor ¶
func (c *ContractCaller) GetBorChainBlockAuthor(ctx context.Context, blockNum *big.Int) (*common.Address, error)
GetBorChainBlockAuthor returns the producer of the bor block
func (*ContractCaller) GetBorChainBlockInfoInBatch ¶ added in v0.1.33
func (c *ContractCaller) GetBorChainBlockInfoInBatch(ctx context.Context, start, end int64) ([]*ethTypes.Header, []uint64, []common.Address, error)
GetBorChainBlockInfoInBatch returns bor chain block headers, total difficulties, and authors for the inclusive range [start, end]. It dispatches to gRPC when BorChainGrpcFlag is set, otherwise falls back to the HTTP JSON-RPC batch. In both paths, it tries to get blocks from the range interval but returns only the ones found on the chain.
func (*ContractCaller) GetBorChainBlockTd ¶ added in v0.1.23
func (c *ContractCaller) GetBorChainBlockTd(ctx context.Context, blockHash common.Hash) (uint64, error)
GetBorChainBlockTd returns total difficulty of a block
func (*ContractCaller) GetBorTxReceipt ¶
GetBorTxReceipt returns bor tx receipt
func (*ContractCaller) GetCheckpointSign ¶
GetCheckpointSign returns sigs input of committed checkpoint transaction
func (*ContractCaller) GetConfirmedTxReceipt ¶
func (c *ContractCaller) GetConfirmedTxReceipt(ctx context.Context, tx common.Hash, requiredConfirmations uint64) (*ethTypes.Receipt, error)
GetConfirmedTxReceipt returns a tx receipt only if it is finalized (or has the required confirmations).
func (*ContractCaller) GetHeaderInfo ¶
func (c *ContractCaller) GetHeaderInfo(ctx context.Context, headerID uint64, rootChainInstance *rootchain.Rootchain, childBlockInterval uint64) ( root common.Hash, start, end, createdAt uint64, proposer string, err error, )
GetHeaderInfo get header info from the checkpoint number
func (*ContractCaller) GetLastChildBlock ¶
func (c *ContractCaller) GetLastChildBlock(rootChainInstance *rootchain.Rootchain) (uint64, error)
GetLastChildBlock fetch current child block
func (*ContractCaller) GetMainChainBlock ¶
func (c *ContractCaller) GetMainChainBlock(ctx context.Context, blockNum *big.Int) (header *ethTypes.Header, err error)
GetMainChainBlock returns main chain block header
func (*ContractCaller) GetMainChainBlockTime ¶
func (c *ContractCaller) GetMainChainBlockTime(ctx context.Context, blockNum uint64) (time.Time, error)
GetMainChainBlockTime returns main chain block time
func (*ContractCaller) GetMainChainFinalizedBlock ¶
func (c *ContractCaller) GetMainChainFinalizedBlock(ctx context.Context) (header *ethTypes.Header, err error)
GetMainChainFinalizedBlock returns the finalized main chain block header (post-merge)
func (*ContractCaller) GetMainTxReceipt ¶
func (c *ContractCaller) GetMainTxReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
GetMainTxReceipt returns main tx receipt
func (*ContractCaller) GetRootChainInstance ¶
func (c *ContractCaller) GetRootChainInstance(rootChainAddress string) (*rootchain.Rootchain, error)
GetRootChainInstance returns the RootChain contract instance for a selected chain
func (*ContractCaller) GetRootHash ¶
func (c *ContractCaller) GetRootHash(ctx context.Context, start, end, checkpointLength uint64) ([]byte, error)
GetRootHash get root hash from the bor chain for the corresponding start and end block
func (*ContractCaller) GetSlashManagerInstance ¶
func (c *ContractCaller) GetSlashManagerInstance(slashManagerAddress string) (*slashmanager.Slashmanager, error)
GetSlashManagerInstance returns the slashManager contract instance for a selected base chain
func (*ContractCaller) GetSpanDetails ¶
func (c *ContractCaller) GetSpanDetails(id *big.Int, validatorSetInstance *validatorset.Validatorset) ( *big.Int, *big.Int, *big.Int, error, )
GetSpanDetails get span details
func (*ContractCaller) GetStakeManagerInstance ¶
func (c *ContractCaller) GetStakeManagerInstance(stakingManagerAddress string) (*stakemanager.Stakemanager, error)
GetStakeManagerInstance returns stakingInfo contract instance for a selected base chain
func (*ContractCaller) GetStakingInfoInstance ¶
func (c *ContractCaller) GetStakingInfoInstance(stakingInfoAddress string) (*stakinginfo.Stakinginfo, error)
GetStakingInfoInstance returns stakingInfo contract instance for a selected chain
func (*ContractCaller) GetStateReceiverInstance ¶
func (c *ContractCaller) GetStateReceiverInstance(stateReceiverAddress string) (*statereceiver.Statereceiver, error)
GetStateReceiverInstance returns stakingInfo contract instance for a selected base chain
func (*ContractCaller) GetStateSenderInstance ¶
func (c *ContractCaller) GetStateSenderInstance(stateSenderAddress string) (*statesender.Statesender, error)
GetStateSenderInstance returns stakingInfo contract instance for a selected base chain
func (*ContractCaller) GetTokenInstance ¶
func (c *ContractCaller) GetTokenInstance(tokenAddress string) (*erc20.Erc20, error)
GetTokenInstance returns the contract instance for a selected chain
func (*ContractCaller) GetValidatorInfo ¶
func (c *ContractCaller) GetValidatorInfo(valID uint64, stakingInfoInstance *stakinginfo.Stakinginfo) (validator types.Validator, err error)
GetValidatorInfo get validator info
func (*ContractCaller) GetValidatorSetInstance ¶
func (c *ContractCaller) GetValidatorSetInstance(validatorSetAddress string) (*validatorset.Validatorset, error)
GetValidatorSetInstance returns stakingInfo contract instance for a selected chain
func (*ContractCaller) GetVoteOnHash ¶
func (c *ContractCaller) GetVoteOnHash(start, end uint64, hash, milestoneID string) (bool, error)
GetVoteOnHash get vote on hash from the bor chain for the corresponding milestone
func (*ContractCaller) IsTxConfirmed ¶
func (c *ContractCaller) IsTxConfirmed(ctx context.Context, txHash common.Hash, requiredConfirmations uint64) bool
IsTxConfirmed checks whether the tx corresponding to the given hash is confirmed with given requiredConfirmations numbers
func (*ContractCaller) SendCheckpoint ¶
func (c *ContractCaller) SendCheckpoint(signedData []byte, sigs [][3]*big.Int, rootChainAddress common.Address, rootChainInstance *rootchain.Rootchain) error
SendCheckpoint sends checkpoint to rootChain contract.
func (*ContractCaller) StakeFor ¶
func (c *ContractCaller) StakeFor(val common.Address, stakeAmount *big.Int, feeAmount *big.Int, acceptDelegation bool, stakeManagerAddress common.Address, stakeManagerInstance *stakemanager.Stakemanager) error
StakeFor stakes for a validator
type CustomAppConfig ¶
type CustomAppConfig struct {
serverconfig.Config `mapstructure:",squash"`
Custom CustomConfig `mapstructure:"custom"`
}
func (*CustomAppConfig) Merge ¶
func (c *CustomAppConfig) Merge(cc *CustomConfig)
func (*CustomAppConfig) Sanitize ¶ added in v0.4.3
func (c *CustomAppConfig) Sanitize() (notes []string, kv map[string]any)
Sanitize enforces minimums and returns notes and corrected key/values
func (*CustomAppConfig) UpdateWithFlags ¶
type CustomConfig ¶
type CustomConfig struct {
EthRPCUrl string `mapstructure:"eth_rpc_url"` // RPC endpoint for the main chain
BorRPCUrl string `mapstructure:"bor_rpc_url"` // RPC endpoint for bor chain
BorGRPCFlag bool `mapstructure:"bor_grpc_flag"` // gRPC flag for bor chain
BorGRPCUrl string `mapstructure:"bor_grpc_url"` // gRPC endpoint for bor chain
BorGRPCToken string `mapstructure:"bor_grpc_token"` // bearer token for bor gRPC; empty = no auth
CometBFTRPCUrl string `mapstructure:"comet_bft_rpc_url"` // cometBft node url
SubGraphUrl string `mapstructure:"sub_graph_url"` // sub graph url
EthRPCTimeout time.Duration `mapstructure:"eth_rpc_timeout"` // timeout for eth rpc
BorRPCTimeout time.Duration `mapstructure:"bor_rpc_timeout"` // timeout for bor rpc
AmqpURL string `mapstructure:"amqp_url"` // amqp url
MainChainGasFeeCap int64 `mapstructure:"main_chain_gas_fee_cap"` // max fee per gas for EIP-1559 txs (in wei)
MainChainGasTipCap int64 `mapstructure:"main_chain_gas_tip_cap"` // max priority fee per gas for EIP-1559 txs (in wei)
// config related to bridge
CheckpointPollInterval time.Duration `mapstructure:"checkpoint_poll_interval"` // Poll interval for checkpointer service to send new checkpoints or missing ACK
SyncerPollInterval time.Duration `mapstructure:"syncer_poll_interval"` // Poll interval for syncer service to sync for changes on the main chain
NoACKPollInterval time.Duration `mapstructure:"noack_poll_interval"` // Poll interval for ack service to send no-ack in case of no checkpoints
ClerkPollInterval time.Duration `mapstructure:"clerk_poll_interval"`
SpanPollInterval time.Duration `mapstructure:"span_poll_interval"`
MilestonePollInterval time.Duration `mapstructure:"milestone_poll_interval"`
EnableSH bool `mapstructure:"enable_self_heal"` // Enable self-healing
SHStateSyncedInterval time.Duration `mapstructure:"sh_state_synced_interval"` // Interval to self-heal StateSynced events if missing
SHStakeUpdateInterval time.Duration `mapstructure:"sh_stake_update_interval"` // Interval to self-heal StakeUpdate events if missing
SHCheckpointAckInterval time.Duration `mapstructure:"sh_checkpoint_ack_interval"` // Interval to self-heal Checkpoint ACKs (New Header Blocks) events if missing
SHMaxDepthDuration time.Duration `mapstructure:"sh_max_depth_duration"` // Max duration that allows to suggest self-healing is not needed
// wait-time-related options
NoACKWaitTime time.Duration `mapstructure:"no_ack_wait_time"` // Time ack service waits to clear the buffer and elect the new proposer
// Log related options
LogsType string `mapstructure:"logs_type"` // if true, enable logging in json format
LogsWriterFile string `mapstructure:"logs_writer_file"` // if given, Logs will be written to this file else os.Stdout
Chain string `mapstructure:"chain"`
ProducerVotes string `mapstructure:"producer_votes"`
// #### Health check configs ####
// MaxGoRoutineThreshold is the maximum number of goroutines before heimdall health check fails.
MaxGoRoutineThreshold int `mapstructure:"max_goroutine_threshold"`
// WarnGoRoutineThreshold is the maximum number of goroutines before heimdall health check warns.
WarnGoRoutineThreshold int `mapstructure:"warn_goroutine_threshold"`
// MinPeerThreshold is the minimum number of peers before heimdall health check fails.
MinPeerThreshold int `mapstructure:"min_peer_threshold"`
// WarnPeerThreshold is the minimum number of peers before heimdall health check warns.
WarnPeerThreshold int `mapstructure:"warn_peer_threshold"`
}
CustomConfig represents heimdall config
func GetDefaultHeimdallConfig ¶
func GetDefaultHeimdallConfig() CustomConfig
GetDefaultHeimdallConfig returns configuration with default params
type EthClient ¶ added in v0.9.0
type EthClient interface {
BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
ChainID(ctx context.Context) (*big.Int, error)
}
EthClient defines the interface for Ethereum client operations needed for transaction creation.
type HTTPClient ¶
var Client HTTPClient
type IContractCaller ¶
type IContractCaller interface {
GetHeaderInfo(ctx context.Context, headerID uint64, rootChainInstance *rootchain.Rootchain, childBlockInterval uint64) (root common.Hash, start, end, createdAt uint64, proposer string, err error)
GetRootHash(ctx context.Context, start, end, checkpointLength uint64) ([]byte, error)
GetVoteOnHash(start, end uint64, hash, milestoneID string) (bool, error)
GetValidatorInfo(valID uint64, stakingInfoInstance *stakinginfo.Stakinginfo) (validator types.Validator, err error)
GetLastChildBlock(rootChainInstance *rootchain.Rootchain) (uint64, error)
CurrentHeaderBlock(rootChainInstance *rootchain.Rootchain, childBlockInterval uint64) (uint64, error)
GetBalance(address common.Address) (*big.Int, error)
SendCheckpoint(signedData []byte, sigs [][3]*big.Int, rootChainAddress common.Address, rootChainInstance *rootchain.Rootchain) (err error)
GetCheckpointSign(txHash common.Hash) ([]byte, []byte, []byte, error)
GetMainChainBlock(ctx context.Context, blockNum *big.Int) (*ethTypes.Header, error)
GetMainChainFinalizedBlock(ctx context.Context) (*ethTypes.Header, error)
GetBorChainBlock(context.Context, *big.Int) (*ethTypes.Header, error)
GetBorChainBlockInfoInBatch(ctx context.Context, start, end int64) ([]*ethTypes.Header, []uint64, []common.Address, error)
GetBorChainBlockTd(ctx context.Context, blockHash common.Hash) (uint64, error)
GetBorChainBlockAuthor(ctx context.Context, blockNum *big.Int) (*common.Address, error)
IsTxConfirmed(ctx context.Context, txHash common.Hash, requiredConfirmations uint64) bool
GetConfirmedTxReceipt(ctx context.Context, txHash common.Hash, requiredConfirmations uint64) (*ethTypes.Receipt, error)
GetBlockNumberFromTxHash(common.Hash) (*big.Int, error)
DecodeNewHeaderBlockEvent(string, *ethTypes.Receipt, uint64) (*rootchain.RootchainNewHeaderBlock, error)
DecodeValidatorTopupFeesEvent(string, *ethTypes.Receipt, uint64) (*stakinginfo.StakinginfoTopUpFee, error)
DecodeValidatorJoinEvent(string, *ethTypes.Receipt, uint64) (*stakinginfo.StakinginfoStaked, error)
DecodeValidatorStakeUpdateEvent(string, *ethTypes.Receipt, uint64) (*stakinginfo.StakinginfoStakeUpdate, error)
DecodeValidatorExitEvent(string, *ethTypes.Receipt, uint64) (*stakinginfo.StakinginfoUnstakeInit, error)
DecodeSignerUpdateEvent(string, *ethTypes.Receipt, uint64) (*stakinginfo.StakinginfoSignerChange, error)
DecodeStateSyncedEvent(string, *ethTypes.Receipt, uint64) (*statesender.StatesenderStateSynced, error)
DecodeSlashedEvent(string, *ethTypes.Receipt, uint64) (*stakinginfo.StakinginfoSlashed, error)
DecodeUnJailedEvent(string, *ethTypes.Receipt, uint64) (*stakinginfo.StakinginfoUnJailed, error)
GetMainTxReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
GetBorTxReceipt(common.Hash) (*ethTypes.Receipt, error)
ApproveTokens(*big.Int, common.Address, common.Address, *erc20.Erc20) error
StakeFor(common.Address, *big.Int, *big.Int, bool, common.Address, *stakemanager.Stakemanager) error
CurrentAccountStateRoot(stakingInfoInstance *stakinginfo.Stakinginfo) ([32]byte, error)
CurrentSpanNumber(validatorSet *validatorset.Validatorset) (Number *big.Int)
GetSpanDetails(id *big.Int, validatorSet *validatorset.Validatorset) (*big.Int, *big.Int, *big.Int, error)
CurrentStateCounter(stateSenderInstance *statesender.Statesender) (Number *big.Int)
CheckIfBlocksExist(ctx context.Context, end uint64) (bool, error)
GetRootChainInstance(rootChainAddress string) (*rootchain.Rootchain, error)
GetStakingInfoInstance(stakingInfoAddress string) (*stakinginfo.Stakinginfo, error)
GetValidatorSetInstance(validatorSetAddress string) (*validatorset.Validatorset, error)
GetStakeManagerInstance(stakingManagerAddress string) (*stakemanager.Stakemanager, error)
GetSlashManagerInstance(slashManagerAddress string) (*slashmanager.Slashmanager, error)
GetStateSenderInstance(stateSenderAddress string) (*statesender.Statesender, error)
GetStateReceiverInstance(stateReceiverAddress string) (*statereceiver.Statereceiver, error)
GetTokenInstance(tokenAddress string) (*erc20.Erc20, error)
}
IContractCaller represents contract caller
type ReceiptValidationParams ¶ added in v0.6.0
type ReceiptValidationParams struct {
TxHash []byte
MsgBlockNumber uint64
Confirmations uint64
ModuleName string
}
ReceiptValidationParams holds parameters for receipt validation. ModuleName is used for logging to identify which module is performing the validation.
type SequenceChecker ¶ added in v0.6.0
type SequenceChecker interface {
// HasSequence checks if a sequence string exists in the keeper's storage.
HasSequence(ctx context.Context, sequence string) bool
}
SequenceChecker defines the interface for checking if a sequence exists in storage. Each keeper that uses sequence checking should implement this interface.
type TestOpts ¶
type TestOpts struct {
// contains filtered or unexported fields
}
func (*TestOpts) GetApplication ¶
func (t *TestOpts) GetApplication() abci.Application
func (*TestOpts) GetChainId ¶
func (*TestOpts) SetApplication ¶
func (t *TestOpts) SetApplication(app abci.Application)