Documentation ¶
Index ¶
- Constants
- Variables
- func QueryForEvent(eventType string) tmpubsub.Query
- type BaseResult
- type Batch
- type BatchMetaData
- type Config
- type DAMetaData
- type DymensionLayerClient
- func (d *DymensionLayerClient) Init(config []byte, pubsub *pubsub.Server, logger log.Logger) error
- func (d *DymensionLayerClient) RetrieveBatch(stateIndex ...uint64) (*ResultRetrieveBatch, error)
- func (d *DymensionLayerClient) Start() error
- func (d *DymensionLayerClient) Stop() error
- func (d *DymensionLayerClient) SubmitBatch(batch *types.Batch, daResult *da.ResultSubmitBatch) *ResultSubmitBatch
- type EventDataNewSettlementBatchAccepted
- type LayerClient
- type ResultRetrieveBatch
- type ResultSubmitBatch
- type StatusCode
Constants ¶
const (
EventNewSettlementBatchAccepted = "NewSettlementBatchAccepted"
)
Define the event types
const (
// EventTypeKey is a reserved composite key for event name.
EventTypeKey = "settlement.event"
)
Define the event type keys
Variables ¶
var ( // ErrBatchNotFound is returned when a batch is not found in the kvstore. ErrBatchNotFound = errors.New("batch not found") )
var (
EventQueryNewSettlementBatchAccepted = QueryForEvent(EventNewSettlementBatchAccepted)
)
Define queries
Functions ¶
func QueryForEvent ¶
QueryForEvent returns a query for the given event.
Types ¶
type BaseResult ¶
type BaseResult struct { // Code is to determine if the action succeeded. Code StatusCode // Message may contain settlement layer specific information (like detailed error message, etc) Message string // StateIndex is the rollapp-specific index the batch was saved in the SL StateIndex uint64 }
BaseResult contains basic information returned by the settlement layer.
type Batch ¶
type Batch struct { StartHeight uint64 EndHeight uint64 AppHashes [][32]byte // MetaData about the batch in the DA layer MetaData *BatchMetaData }
Batch defines a batch structure for the settlement layer
type BatchMetaData ¶
type BatchMetaData struct {
DA *DAMetaData
}
BatchMetaData aggregates all the batch metadata.
type Config ¶
type Config struct { BatchSize uint64 `json:"batch_size"` KeyringBackend cosmosaccount.KeyringBackend `json:"keyring_backend"` NodeAddress string `json:"node_address"` KeyRingHomeDir string `json:"keyring_home_dir"` DymAccountName string `json:"dym_account_name"` RollappID string `json:"rollapp_id"` }
Config for the DymensionLayerClient
type DAMetaData ¶
type DAMetaData struct { // Height is the height of the block in the da layer Height uint64 // Client is the client to use to fetch data from the da layer Client da.Client }
DAMetaData contains meta data about a batch on the Data Availability Layer.
type DymensionLayerClient ¶
type DymensionLayerClient struct {
// contains filtered or unexported fields
}
DymensionLayerClient is intended only for usage in tests.
func (*DymensionLayerClient) RetrieveBatch ¶
func (d *DymensionLayerClient) RetrieveBatch(stateIndex ...uint64) (*ResultRetrieveBatch, error)
RetrieveBatch Gets the batch which contains the given slHeight . Empty slHeight returns the latest batch.
func (*DymensionLayerClient) Start ¶
func (d *DymensionLayerClient) Start() error
Start is called once, after init. It initializes the query client.
func (*DymensionLayerClient) Stop ¶
func (d *DymensionLayerClient) Stop() error
Stop is called once, after Start.
func (*DymensionLayerClient) SubmitBatch ¶
func (d *DymensionLayerClient) SubmitBatch(batch *types.Batch, daResult *da.ResultSubmitBatch) *ResultSubmitBatch
SubmitBatch submits the batch to the settlement layer. This should create a transaction which (potentially) triggers a state transition in the settlement layer.
type EventDataNewSettlementBatchAccepted ¶
type EventDataNewSettlementBatchAccepted struct { // EndHeight is the height of the last accepted batch EndHeight uint64 // StateIndex is the rollapp-specific index the batch was saved in the SL StateIndex uint64 }
EventDataNewSettlementBatchAccepted defines the structure of the event data for the EventNewSettlementBatchAccepted
type LayerClient ¶
type LayerClient interface { // Init is called once for the client initialization Init(config []byte, pubsub *pubsub.Server, logger log.Logger) error // Start is called once, after Init. It's implementation should start the client service. Start() error // Stop is called once, after Start. It should stop the client service. Stop() error // SubmitBatch submits the batch to the settlement layer. This should create a transaction which (potentially) // triggers a state transition in the settlement layer. SubmitBatch(batch *types.Batch, daResult *da.ResultSubmitBatch) *ResultSubmitBatch // RetrieveBatch Gets the batch which contains the given height. Empty height returns the latest batch. RetrieveBatch(stateIndex ...uint64) (*ResultRetrieveBatch, error) }
LayerClient defines generic interface for Settlement layer interaction.
type ResultRetrieveBatch ¶
type ResultRetrieveBatch struct { BaseResult *Batch }
ResultRetrieveBatch contains information returned from settlement layer after batch retrieval.
type ResultSubmitBatch ¶
type ResultSubmitBatch struct {
BaseResult
}
ResultSubmitBatch contains information returned from settlement layer after batch submission.
type StatusCode ¶
type StatusCode uint64
StatusCode is a type for settlement layer return status.
const ( StatusUnknown StatusCode = iota StatusSuccess StatusTimeout StatusError )
settlement layer return codes.