Documentation
¶
Index ¶
- func MakeID(height uint64, commitment Commitment) []byte
- type Blob
- type BlobAPI
- func (api *BlobAPI) Get(ctx context.Context, height uint64, namespace libshare.Namespace, ...) (*Blob, error)
- func (api *BlobAPI) GetAll(ctx context.Context, height uint64, namespaces []libshare.Namespace) ([]*Blob, error)
- func (api *BlobAPI) GetCommitmentProof(ctx context.Context, height uint64, namespace libshare.Namespace, ...) (*CommitmentProof, error)
- func (api *BlobAPI) GetProof(ctx context.Context, height uint64, namespace libshare.Namespace, ...) (*Proof, error)
- func (api *BlobAPI) Included(ctx context.Context, height uint64, namespace libshare.Namespace, proof *Proof, ...) (bool, error)
- func (api *BlobAPI) Submit(ctx context.Context, blobs []*Blob, opts *SubmitOptions) (uint64, error)
- func (api *BlobAPI) Subscribe(ctx context.Context, namespace libshare.Namespace) (<-chan *SubscriptionResponse, error)
- type BlobModule
- type Client
- type Commit
- type Commitment
- type CommitmentProof
- type DAHeader
- type Header
- type HeaderAPI
- type HeaderModule
- type Proof
- type RawHeader
- type SubmitOptions
- type SubscriptionResponse
- type TxPriority
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeID ¶
func MakeID(height uint64, commitment Commitment) []byte
MakeID constructs a blob ID by prefixing the commitment with the height (little endian).
Types ¶
type Blob ¶
type Blob struct {
*libshare.Blob `json:"blob"`
Commitment Commitment `json:"commitment"`
// contains filtered or unexported fields
}
Blob represents application-specific binary data that can be submitted to Celestia. It is intentionally compatible with celestia-node's blob.Blob JSON shape.
func NewBlob ¶
func NewBlob(shareVersion uint8, namespace libshare.Namespace, data, signer, commitment []byte) (*Blob, error)
NewBlob constructs a new blob from the provided namespace, data, signer, and share version. If commitment is provided, it is used directly; otherwise it is computed. This is a lightly adapted copy of celestia-node/blob.NewBlob.
func (*Blob) EqualCommitment ¶
func (b *Blob) EqualCommitment(com Commitment) bool
EqualCommitment compares the blob's commitment with the provided one.
func (*Blob) MarshalJSON ¶
MarshalJSON matches celestia-node's blob JSON encoding.
func (*Blob) UnmarshalJSON ¶
UnmarshalJSON matches celestia-node's blob JSON decoding.
type BlobAPI ¶
type BlobAPI struct {
Internal struct {
Submit func(
context.Context,
[]*Blob,
*SubmitOptions,
) (uint64, error) `perm:"write"`
Get func(
context.Context,
uint64,
libshare.Namespace,
Commitment,
) (*Blob, error) `perm:"read"`
GetAll func(
context.Context,
uint64,
[]libshare.Namespace,
) ([]*Blob, error) `perm:"read"`
GetProof func(
context.Context,
uint64,
libshare.Namespace,
Commitment,
) (*Proof, error) `perm:"read"`
Included func(
context.Context,
uint64,
libshare.Namespace,
*Proof,
Commitment,
) (bool, error) `perm:"read"`
GetCommitmentProof func(
context.Context,
uint64,
libshare.Namespace,
[]byte,
) (*CommitmentProof, error) `perm:"read"`
Subscribe func(
context.Context,
libshare.Namespace,
) (<-chan *SubscriptionResponse, error) `perm:"read"`
}
}
BlobAPI mirrors celestia-node's blob module (nodebuilder/blob/blob.go). jsonrpc.NewClient wires Internal.* to RPC stubs.
func (*BlobAPI) Get ¶
func (api *BlobAPI) Get(ctx context.Context, height uint64, namespace libshare.Namespace, commitment Commitment) (*Blob, error)
Get retrieves a blob by commitment under the given namespace and height.
func (*BlobAPI) GetAll ¶
func (api *BlobAPI) GetAll(ctx context.Context, height uint64, namespaces []libshare.Namespace) ([]*Blob, error)
GetAll returns all blobs for the given namespaces at the given height.
func (*BlobAPI) GetCommitmentProof ¶
func (api *BlobAPI) GetCommitmentProof(ctx context.Context, height uint64, namespace libshare.Namespace, shareCommitment []byte) (*CommitmentProof, error)
GetCommitmentProof generates a commitment proof for a share commitment.
func (*BlobAPI) GetProof ¶
func (api *BlobAPI) GetProof(ctx context.Context, height uint64, namespace libshare.Namespace, commitment Commitment) (*Proof, error)
GetProof retrieves proofs in the given namespace at the given height by commitment.
func (*BlobAPI) Included ¶
func (api *BlobAPI) Included(ctx context.Context, height uint64, namespace libshare.Namespace, proof *Proof, commitment Commitment) (bool, error)
Included checks whether a blob commitment is included at the given height/namespace.
type BlobModule ¶
type BlobModule interface {
Submit(context.Context, []*Blob, *SubmitOptions) (uint64, error)
Get(context.Context, uint64, libshare.Namespace, Commitment) (*Blob, error)
GetAll(context.Context, uint64, []libshare.Namespace) ([]*Blob, error)
GetProof(context.Context, uint64, libshare.Namespace, Commitment) (*Proof, error)
Included(context.Context, uint64, libshare.Namespace, *Proof, Commitment) (bool, error)
GetCommitmentProof(context.Context, uint64, libshare.Namespace, []byte) (*CommitmentProof, error)
Subscribe(context.Context, libshare.Namespace) (<-chan *SubscriptionResponse, error)
}
BlobModule is the server-side "blob" JSON-RPC interface used by tests/mocks.
type Client ¶
Client dials the celestia-node RPC "blob" and "header" namespaces.
type Commit ¶
type Commit struct {
Height string `json:"height"`
}
Commit contains commit information.
type Commitment ¶
type Commitment []byte
Commitment is the Merkle subtree commitment for a blob.
func SplitID ¶
func SplitID(id []byte) (uint64, Commitment)
SplitID splits a blob ID into height and commitment. If the ID is malformed, it returns height 0 and nil commitment.
type CommitmentProof ¶
type CommitmentProof struct {
SubtreeRoots [][]byte `json:"subtree_roots,omitempty"`
}
CommitmentProof matches celestia-node's blob.CommitmentProof JSON shape. We keep only the fields we need on the client side.
type DAHeader ¶
type DAHeader struct {
RowRoots [][]byte `json:"row_roots"`
ColumnRoots [][]byte `json:"column_roots"`
}
DAHeader contains the Data Availability header.
type Header ¶
type Header struct {
Header RawHeader `json:"header"`
Commit Commit `json:"commit"`
DAH DAHeader `json:"dah"`
Height uint64 `json:"height,string,omitempty"`
LastHash []byte `json:"last_header_hash,omitempty"`
ChainID string `json:"chain_id,omitempty"`
BlockTime time.Time `json:"time,omitempty"`
}
Header contains the fields from celestia-node's header.ExtendedHeader that we need. We only extract the Time field for timestamp determinism.
type HeaderAPI ¶
type HeaderAPI struct {
Internal struct {
GetByHeight func(
context.Context,
uint64,
) (*Header, error) `perm:"read"`
LocalHead func(
context.Context,
) (*Header, error) `perm:"read"`
NetworkHead func(
context.Context,
) (*Header, error) `perm:"read"`
}
}
HeaderAPI mirrors celestia-node's header module. jsonrpc.NewClient wires Internal.* to RPC stubs.
func (*HeaderAPI) GetByHeight ¶
GetByHeight retrieves a header at the specified height.
type HeaderModule ¶
type HeaderModule interface {
GetByHeight(context.Context, uint64) (*Header, error)
LocalHead(context.Context) (*Header, error)
NetworkHead(context.Context) (*Header, error)
}
HeaderModule is the server-side "header" JSON-RPC interface used by tests/mocks.
type Proof ¶
Proof is a set of NMT proofs used to verify a blob inclusion. This mirrors celestia-node's blob.Proof shape.
type RawHeader ¶
type RawHeader struct {
ChainID string `json:"chain_id"`
Height string `json:"height"`
Time time.Time `json:"time"`
}
RawHeader contains the raw tendermint header fields.
type SubmitOptions ¶
type SubmitOptions struct {
GasPrice float64 `json:"gas_price,omitempty"`
IsGasPriceSet bool `json:"is_gas_price_set,omitempty"`
MaxGasPrice float64 `json:"max_gas_price,omitempty"`
Gas uint64 `json:"gas,omitempty"`
TxPriority TxPriority `json:"tx_priority,omitempty"`
KeyName string `json:"key_name,omitempty"`
SignerAddress string `json:"signer_address,omitempty"`
FeeGranterAddress string `json:"fee_granter_address,omitempty"`
}
SubmitOptions is a pared-down copy of celestia-node/state.TxConfig JSON shape. Only exported fields are marshalled to match the RPC expectation of the blob service.
type SubscriptionResponse ¶
SubscriptionResponse mirrors celestia-node's blob.SubscriptionResponse.
type TxPriority ¶
type TxPriority int
TxPriority mirrors celestia-node/state.TxPriority to preserve JSON compatibility.
const ( TxPriorityLow TxPriority = iota + 1 TxPriorityMedium TxPriorityHigh )