Documentation
¶
Index ¶
- Constants
- func GasPriceMultiplier(chainID int64) float64
- func GetInBoundVoteMessage(sender string, senderChain int64, txOrigin string, receiver string, ...) *types.MsgVoteOnObservedInboundTx
- func HandleBroadcastError(err error, nonce, toChain, outTxHash string) (bool, bool)
- func WrapMessageWithAuthz(msg sdk.Msg) (sdk.Msg, clientauthz.Signer, error)
- type Opt
- type PellCoreBridge
- func (b *PellCoreBridge) Broadcast(ctx context.Context, gaslimit uint64, authzWrappedMsgs []sdktypes.Msg, ...) (string, error)
- func (b *PellCoreBridge) Chain() chains.Chain
- func (b *PellCoreBridge) EnableMockSDKClient(client rpcclient.Client)
- func (b *PellCoreBridge) GetAccountNumberAndSequenceNumber(_ authz.KeyType) (uint64, uint64, error)
- func (c *PellCoreBridge) GetGenesisSupply(ctx context.Context) (sdkmath.Int, error)
- func (b *PellCoreBridge) GetKeys() keyinterfaces.ObserverKeys
- func (b *PellCoreBridge) GetLogger() *zerolog.Logger
- func (c *PellCoreBridge) GetPellHotKeyBalance(ctx context.Context) (sdkmath.Int, error)
- func (c *PellCoreBridge) MonitorVoteInboundBlockResult(ctx context.Context, pellTxHash string, retryGasLimit uint64, ...) error
- func (c *PellCoreBridge) MonitorVoteInboundTxResult(ctx context.Context, pellTxHash string, retryGasLimit uint64, ...) error
- func (c *PellCoreBridge) MonitorVoteOutboundTxResult(ctx context.Context, pellTxHash string, retryGasLimit uint64, ...) error
- func (c *PellCoreBridge) OnBeforeStop(callback func())
- func (b *PellCoreBridge) PostAddTxHashToOutTxTracker(ctx context.Context, chainID int64, nonce uint64, txHash string, ...) (string, error)
- func (b *PellCoreBridge) PostBlameData(ctx context.Context, blame *blame.Blame, chainID int64, index string) (string, error)
- func (b *PellCoreBridge) PostGasPrice(ctx context.Context, chain chains.Chain, gasPrice uint64, supply string, ...) (string, error)
- func (c *PellCoreBridge) PostVoteBlockHeader(ctx context.Context, chainID int64, blockHash []byte, height int64, ...) (string, error)
- func (b *PellCoreBridge) PostVoteInboundBlock(ctx context.Context, gasLimit, retryLimit uint64, ...) ([]string, []string, error)
- func (c *PellCoreBridge) PostVoteInboundEvents(ctx context.Context, gasLimit, retryGasLimit uint64, ...) (string, string, error)
- func (b *PellCoreBridge) PostVoteInboundFirstPart(ctx context.Context, gasLimit, retryLimit uint64, ...) (string, string, error)
- func (b *PellCoreBridge) PostVoteOnGasRecharge(ctx context.Context, chain chains.Chain, voteIndex uint64) (string, error)
- func (b *PellCoreBridge) PostVoteOnPellRecharge(ctx context.Context, chain chains.Chain, voteIndex uint64) (string, error)
- func (b *PellCoreBridge) PostVoteOutbound(ctx context.Context, xmsgIndex string, outTxHash string, outBlockHeight uint64, ...) (string, string, error)
- func (b *PellCoreBridge) PostVoteOutboundFromMsg(ctx context.Context, gasLimit, retryGasLimit uint64, ...) (string, string, error)
- func (c *PellCoreBridge) PostVoteTSS(ctx context.Context, tssPubKey string, keyGenPellHeight int64, ...) (string, error)
- func (b *PellCoreBridge) QueryTxResult(hash string) (*sdktypes.TxResponse, error)
- func (b *PellCoreBridge) SetAccountNumber(keyType authz.KeyType) error
- func (b *PellCoreBridge) SignTx(txf clienttx.Factory, name string, txBuilder client.TxBuilder, ...) error
- func (c *PellCoreBridge) Stop()
- func (b *PellCoreBridge) UpdateAppContext(ctx context.Context, appContext *pctx.AppContext, init bool, ...) error
- func (b *PellCoreBridge) UpdateAppContextWorker(ctx context.Context)
- func (b *PellCoreBridge) UpdateChainID(chainID string) error
- func (b *PellCoreBridge) WaitForPellCoreToCreateBlocks(ctx context.Context) error
- func (b *PellCoreBridge) WithKeys(keys keyinterfaces.ObserverKeys)
Constants ¶
const ( // DefaultBaseGasPrice is the default base gas price DefaultBaseGasPrice = 1_000_000 // DefaultGasLimit is the default gas limit used for broadcasting txs DefaultGasLimit = 200_000 // PostGasPriceGasLimit is the gas limit for voting new gas price PostGasPriceGasLimit = 1_500_000 // AddTxHashToOutTxTrackerGasLimit is the gas limit for adding tx hash to out tx tracker AddTxHashToOutTxTrackerGasLimit = 200_000 // PostTSSGasLimit is the gas limit for voting on TSS keygen PostTSSGasLimit = 500_000 // PostVoteInboundExecutionGasLimit is the gas limit for voting on observed inbound tx and executing it PostVoteInboundExecutionGasLimit = 6_500_000 // PostVoteInboundMessagePassingExecutionGasLimit is the gas limit for voting on, and executing ,observed inbound tx related to message passing (coin_type == pell) PostVoteInboundMessagePassingExecutionGasLimit = 4_000_000 // AddOutboundTrackerGasLimit is the gas limit for adding tx hash to out tx tracker AddOutboundTrackerGasLimit = 200_000 // PostBlameDataGasLimit is the gas limit for voting on blames PostBlameDataGasLimit = 200_000 // PostAddPellTokenGasLimit is the gas limit for voting on observed pell token PostAddPellTokenGasLimit = 1_500_000 // PostAddGasTokenGasLimit is the gas limit for voting on observed gas token PostAddGasTokenGasLimit = 1_500_000 // DefaultRetryCount is the number of retries for broadcasting a tx DefaultRetryCount = 5 // ExtendedRetryCount is an extended number of retries for broadcasting a tx, used in keygen operations ExtendedRetryCount = 15 // DefaultRetryInterval is the interval between retries in seconds DefaultRetryInterval = 5 // PostVoteInboundGasLimit is the gas limit for voting on observed inbound tx. // Supports up to 256 events, but there may be more in practice PostVoteInboundGasLimit = 1_500_000 * 256 // PostVoteOutboundGasLimit is the gas limit for voting on observed outbound tx PostVoteOutboundGasLimit = 1_500_000 // PostVoteOutboundRevertGasLimit is the gas limit for voting on observed outbound tx for revert (when outbound fails) // The value needs to be higher because reverting implies interacting with the EVM to perform swaps for the gas token PostVoteOutboundRevertGasLimit = 1_500_000 // MonitorVoteInboundTxResultInterval is the interval between retries for monitoring tx result in seconds MonitorVoteInboundTxResultInterval = 5 // MonitorVoteInboundTxResultRetryCount is the number of retries to fetch monitoring tx result MonitorVoteInboundTxResultRetryCount = 20 // MonitorVoteOutboundTxResultInterval is the interval between retries for monitoring tx result in seconds MonitorVoteOutboundTxResultInterval = 5 // MonitorVoteOutboundTxResultRetryCount is the number of retries to fetch monitoring tx result MonitorVoteOutboundTxResultRetryCount = 20 )
Variables ¶
This section is empty.
Functions ¶
func GasPriceMultiplier ¶
GasPriceMultiplier returns the gas price multiplier for the given chain
func GetInBoundVoteMessage ¶
func GetInBoundVoteMessage( sender string, senderChain int64, txOrigin string, receiver string, receiverChain int64, inTxHash string, inBlockHeight uint64, gasLimit uint64, signerAddress string, eventIndex uint, pellData types.InboundPellEvent, ) *types.MsgVoteOnObservedInboundTx
GetInBoundVoteMessage returns a new MsgVoteOnObservedInboundTx
func HandleBroadcastError ¶
HandleBroadcastError returns whether to retry in a few seconds, and whether to report via AddTxHashToOutTxTracker returns (bool retry, bool report)
func WrapMessageWithAuthz ¶
Types ¶
type Opt ¶
type Opt func(cfg *constructOpts)
func WithCustomAccountRetriever ¶
func WithCustomAccountRetriever(ac cosmosclient.AccountRetriever) Opt
WithCustomAccountRetriever sets custom tendermint client
type PellCoreBridge ¶
type PellCoreBridge struct {
pellcore_rpc.Clients
// contains filtered or unexported fields
}
PellCoreBridge will be used to send tx to PellCore.
func NewClient ¶
func NewClient( logger zerolog.Logger, keys keyinterfaces.ObserverKeys, chainIP string, signerName string, chainID string, hsmMode bool, pellTxMsgLength uint8, opts ...Opt, ) (*PellCoreBridge, error)
NewClient create a new instance of Client
func (*PellCoreBridge) Broadcast ¶
func (b *PellCoreBridge) Broadcast( ctx context.Context, gaslimit uint64, authzWrappedMsgs []sdktypes.Msg, authzSigner authz.Signer, ) (string, error)
Broadcast Broadcasts tx to metachain. Returns txHash and error
func (*PellCoreBridge) Chain ¶
func (b *PellCoreBridge) Chain() chains.Chain
Chain returns the pellchain object
func (*PellCoreBridge) EnableMockSDKClient ¶
func (b *PellCoreBridge) EnableMockSDKClient(client rpcclient.Client)
func (*PellCoreBridge) GetAccountNumberAndSequenceNumber ¶
GetAccountNumberAndSequenceNumber We do not use multiple KeyType for now , but this can be optionally used in the future to seprate TSS signer from Pellclient GRantee
func (*PellCoreBridge) GetGenesisSupply ¶
GetGenesisSupply returns the genesis supply. NOTE that this method is brittle as it uses STATEFUL connection
func (*PellCoreBridge) GetKeys ¶
func (b *PellCoreBridge) GetKeys() keyinterfaces.ObserverKeys
func (*PellCoreBridge) GetLogger ¶
func (b *PellCoreBridge) GetLogger() *zerolog.Logger
func (*PellCoreBridge) GetPellHotKeyBalance ¶
GetPellHotKeyBalance returns the pell hot key balance
func (*PellCoreBridge) MonitorVoteInboundBlockResult ¶
func (c *PellCoreBridge) MonitorVoteInboundBlockResult( ctx context.Context, pellTxHash string, retryGasLimit uint64, msg *types.MsgVoteInboundBlock, events []*types.MsgVoteOnObservedInboundTx, ) error
MonitorVoteInboundBlockResult monitors the result of a vote inbound tx retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas if retryGasLimit is 0, the tx is not resent
func (*PellCoreBridge) MonitorVoteInboundTxResult ¶
func (c *PellCoreBridge) MonitorVoteInboundTxResult( ctx context.Context, pellTxHash string, retryGasLimit uint64, msg []*types.MsgVoteOnObservedInboundTx, ) error
MonitorVoteInboundResult monitors the result of a vote inbound tx retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas if retryGasLimit is 0, the tx is not resent
func (*PellCoreBridge) MonitorVoteOutboundTxResult ¶
func (c *PellCoreBridge) MonitorVoteOutboundTxResult( ctx context.Context, pellTxHash string, retryGasLimit uint64, msg *types.MsgVoteOnObservedOutboundTx, ) error
MonitorVoteOutboundResult monitors the result of a vote outbound tx retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas if retryGasLimit is 0, the tx is not resent
func (*PellCoreBridge) OnBeforeStop ¶
func (c *PellCoreBridge) OnBeforeStop(callback func())
OnBeforeStop adds a callback to be called before the client stops.
func (*PellCoreBridge) PostAddTxHashToOutTxTracker ¶
func (*PellCoreBridge) PostBlameData ¶
func (b *PellCoreBridge) PostBlameData( ctx context.Context, blame *blame.Blame, chainID int64, index string, ) (string, error)
PostVoteBlameData posts blame data message to pellcore. Returns txHash and error.
func (*PellCoreBridge) PostGasPrice ¶
func (b *PellCoreBridge) PostGasPrice( ctx context.Context, chain chains.Chain, gasPrice uint64, supply string, blockNum uint64, ) (string, error)
PostVoteGasPrice posts a gas price vote. Returns txHash and error.
func (*PellCoreBridge) PostVoteBlockHeader ¶
func (c *PellCoreBridge) PostVoteBlockHeader( ctx context.Context, chainID int64, blockHash []byte, height int64, header proofs.HeaderData, ) (string, error)
PostVoteBlockHeader posts a vote on an observed block header
func (*PellCoreBridge) PostVoteInboundBlock ¶
func (b *PellCoreBridge) PostVoteInboundBlock(ctx context.Context, gasLimit, retryLimit uint64, block *types.MsgVoteInboundBlock, events []*types.MsgVoteOnObservedInboundTx) ([]string, []string, error)
PostVoteInboundBlock posts a vote on an observed inbound block When there are more than 14 events (since one message slot is reserved for the block message, leaving 14 slots out of the MAX_MSG_LENGTH=15), the events are processed in batches: 1. First batch includes the block message and up to 14 events 2. Subsequent batches contain up to 15 events each until all events are processed
func (*PellCoreBridge) PostVoteInboundEvents ¶
func (c *PellCoreBridge) PostVoteInboundEvents( ctx context.Context, gasLimit, retryGasLimit uint64, msg []*types.MsgVoteOnObservedInboundTx, ) (string, string, error)
PostVoteInbound posts a vote on an observed inbound tx retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas it is used when the ballot is finalized and the inbound tx needs to be processed
func (*PellCoreBridge) PostVoteInboundFirstPart ¶
func (b *PellCoreBridge) PostVoteInboundFirstPart(ctx context.Context, gasLimit, retryLimit uint64, block *types.MsgVoteInboundBlock, events []*types.MsgVoteOnObservedInboundTx) (string, string, error)
func (*PellCoreBridge) PostVoteOnGasRecharge ¶
func (b *PellCoreBridge) PostVoteOnGasRecharge(ctx context.Context, chain chains.Chain, voteIndex uint64) (string, error)
PostVoteAddGasToken posts a vote to add gas token to a chain
func (*PellCoreBridge) PostVoteOnPellRecharge ¶
func (b *PellCoreBridge) PostVoteOnPellRecharge(ctx context.Context, chain chains.Chain, voteIndex uint64) (string, error)
PostVoteAddPellToken posts a vote to add pell token to a chain
func (*PellCoreBridge) PostVoteOutbound ¶
func (b *PellCoreBridge) PostVoteOutbound( ctx context.Context, xmsgIndex string, outTxHash string, outBlockHeight uint64, outTxGasUsed uint64, outTxEffectiveGasPrice *big.Int, outTxEffectiveGasLimit uint64, status chains.ReceiveStatus, failedReasonMsg string, chain chains.Chain, nonce uint64, ) (string, string, error)
PostVoteOutbound posts a vote on an observed outbound tx from a MsgVoteOutbound. Returns tx hash, ballotIndex, and error.
func (*PellCoreBridge) PostVoteOutboundFromMsg ¶
func (b *PellCoreBridge) PostVoteOutboundFromMsg( ctx context.Context, gasLimit, retryGasLimit uint64, msg *types.MsgVoteOnObservedOutboundTx, ) (string, string, error)
PostVoteOutboundFromMsg posts a vote on an observed outbound tx from a MsgVoteOnObservedOutboundTx
func (*PellCoreBridge) PostVoteTSS ¶
func (c *PellCoreBridge) PostVoteTSS( ctx context.Context, tssPubKey string, keyGenPellHeight int64, status chains.ReceiveStatus, ) (string, error)
PostVoteTSS sends message to vote TSS. Returns txHash and error.
func (*PellCoreBridge) QueryTxResult ¶
func (b *PellCoreBridge) QueryTxResult(hash string) (*sdktypes.TxResponse, error)
QueryTxResult query the result of a tx
func (*PellCoreBridge) SetAccountNumber ¶
func (b *PellCoreBridge) SetAccountNumber(keyType authz.KeyType) error
SetAccountNumber sets the account number and sequence number for the given keyType todo remove method and make it part of the client constructor.
func (*PellCoreBridge) Stop ¶
func (c *PellCoreBridge) Stop()
Stop stops the client and optionally calls the onBeforeStop callbacks.
func (*PellCoreBridge) UpdateAppContext ¶
func (b *PellCoreBridge) UpdateAppContext(ctx context.Context, appContext *pctx.AppContext, init bool, logger zerolog.Logger) error
UpdatePellCoreContext updates core context pellcore stores core context for all clients
func (*PellCoreBridge) UpdateAppContextWorker ¶
func (b *PellCoreBridge) UpdateAppContextWorker(ctx context.Context)
CoreContextUpdater is a polling goroutine that checks and updates core context at every height
func (*PellCoreBridge) UpdateChainID ¶
func (b *PellCoreBridge) UpdateChainID(chainID string) error
func (*PellCoreBridge) WaitForPellCoreToCreateBlocks ¶
func (b *PellCoreBridge) WaitForPellCoreToCreateBlocks(ctx context.Context) error
WaitForPellcoreToCreateBlocks waits for pellcore to create blocks
func (*PellCoreBridge) WithKeys ¶
func (b *PellCoreBridge) WithKeys(keys keyinterfaces.ObserverKeys)