Documentation
¶
Index ¶
- Constants
- Variables
- type CelestiaConfig
- type Relayer
- func (r *Relayer) CreateClient(ctx sdk.Context) *celestia.CreateClient
- func (r *Relayer) GetCachedHeaders(proofLimit int, latestProvenHeight int64) []*celestia.Header
- func (r *Relayer) GetCachedProofs(proofLimit int, latestProvenHeight int64) []*celestia.BlobProof
- func (r *Relayer) GetLocalBlockAtHeight(ctx context.Context, rollchainBlockHeight int64) ([]byte, error)
- func (r *Relayer) GetUpdateClient() *celestia.Header
- func (r *Relayer) HasCachedProof(block int64) bool
- func (r *Relayer) NotifyCommitHeight(height int64)
- func (r *Relayer) NotifyProvenHeight(height int64)
- func (r *Relayer) PostBlocks(ctx sdk.Context, blocks []int64)
- func (r *Relayer) ProposePostNextBlocks(ctx sdk.Context) []int64
- func (r *Relayer) SetClientContext(clientCtx client.Context)
- func (r *Relayer) SetUpdateClient(updateClient *celestia.Header)
- func (r *Relayer) Start(ctx context.Context, provenHeight int64, commitHeight int64) error
- func (r *Relayer) ValidateNewClient(ctx sdk.Context, client *celestia.CreateClient) error
Constants ¶
const ( FlagAppRpcURL = "celestia.app-rpc-url" FlagAppRpcTimeout = "celestia.app-rpc-timeout" FlagChainID = "celestia.chain-id" FlagGasPrices = "celestia.gas-prices" FlagGasAdjustment = "celestia.gas-adjustment" FlagNodeRpcURL = "celestia.node-rpc-url" FlagNodeAuthToken = "celestia.node-auth-token" FlagOverrideNamespace = "celestia.override-namespace" FlagQueryInterval = "celestia.proof-query-interval" FlagMaxFlushSize = "celestia.max-flush-size" DefaultConfigTemplate = `` /* 1084-byte string literal not displayed */ )
const ( CelestiaPublishKeyName = "blob" CelestiaFeegrantKeyName = "feegrant" )
const ( DefaultMaxFlushSize = int(20) MaxMaxFlushSize = int(100) )
Variables ¶
var DefaultCelestiaConfig = CelestiaConfig{ AppRpcURL: "https://rpc-mocha.pops.one:443", AppRpcTimeout: 30 * time.Second, ChainID: "celestia-1", GasPrice: "0.01utia", GasAdjustment: 1.0, NodeRpcURL: "http://127.0.0.1:26658", NodeAuthToken: "auth-token", ProofQueryInterval: 12 * time.Second, MaxFlushSize: 32, }
Functions ¶
This section is empty.
Types ¶
type CelestiaConfig ¶
type CelestiaConfig struct { // RPC URL of celestia-app AppRpcURL string `mapstructure:"app-rpc-url"` // RPC Timeout for celestia-app AppRpcTimeout time.Duration `mapstructure:"app-rpc-timeout"` // Celestia chain ID ChainID string `mapstructure:"chain-id"` // Gas price to pay for Celestia transactions GasPrice string `mapstructure:"gas-prices"` // Gas adjustment for Celestia transactions GasAdjustment float64 `mapstructure:"gas-adjustment"` // RPC URL of celestia-node NodeRpcURL string `mapstructure:"node-rpc-url"` // RPC Timeout for celestia-node NodeAuthToken string `mapstructure:"node-auth-token"` // Overrides built-in namespace used OverrideNamespace string `mapstructure:"override-namespace"` // Query Celestia for new block proofs this often ProofQueryInterval time.Duration `mapstructure:"proof-query-interval"` // Only flush at most this many block proofs in an injected tx per block proposal MaxFlushSize int `mapstructure:"max-flush-size"` }
CelestiaConfig defines the configuration for the in-process Celestia relayer.
func CelestiaConfigFromAppOpts ¶
func CelestiaConfigFromAppOpts(appOpts servertypes.AppOptions) CelestiaConfig
type Relayer ¶
type Relayer struct {
// contains filtered or unexported fields
}
Relayer is responsible for posting new blocks to Celestia and relaying block proofs from Celestia via the current proposer
func NewRelayer ¶
func NewRelayer( logger log.Logger, cdc codec.BinaryCodec, appOpts servertypes.AppOptions, celestiaNamespace appns.Namespace, keyDir string, celestiaPublishBlockInterval int, ) (*Relayer, error)
NewRelayer creates a new Relayer instance
func (*Relayer) CreateClient ¶
func (r *Relayer) CreateClient(ctx sdk.Context) *celestia.CreateClient
TODO: do create client async, worst case scenario, it will be created in the same block as the first proofs
func (*Relayer) GetCachedHeaders ¶
GetCachedHeaders queries through the cached block proofs, extracts the celestia height they were published, and pulls in the cached header. If a header does not exist, it may have already been included in an earlier block. Finally, if there are no header/client updates, we check if an update client is needed to keep the client from expiring.
func (*Relayer) GetCachedProofs ¶
GetCachedProofs() returns the next set of proofs to verify on-chain
func (*Relayer) GetLocalBlockAtHeight ¶
func (*Relayer) GetUpdateClient ¶
func (*Relayer) HasCachedProof ¶
func (*Relayer) NotifyCommitHeight ¶
NotifyCommitHeight is called by the app to notify the relayer of the latest commit height
func (*Relayer) NotifyProvenHeight ¶
NotifyProvenHeight is called by the app to notify the relayer of the latest proven height i.e. the height of the highest incremental block that was proven to be posted to Celestia.
func (*Relayer) PostBlocks ¶
PostBlocks is call in the preblocker, the proposer will publish at this point with their block accepted
func (*Relayer) ProposePostNextBlocks ¶
PostNextBlocks is called by the current proposing validator during PrepareProposal. If on the publish boundary, it will return the block heights that will be published It will not publish the block being proposed.
func (*Relayer) SetClientContext ¶
func (*Relayer) SetUpdateClient ¶
A non-nil set is performed when trusting period is 2/3 time from expiration a nil clears it