celestia

package
v0.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultMaxBytes is the maximum blob size accepted by celestia core
	// ADR-13 claims worst case padding approaches 2 rows for a full data square:
	// see: https://github.com/celestiaorg/celestia-app/blob/main/docs/architecture/adr-013-non-interactive-default-rules-for-zero-padding.md
	// square size (64) * two rows = 128 shares
	// 128 shares * 512 bytes per share = 65,536 bytes to account for padding
	// also account for cmproto.Data overhead for each blob tx = 65,536 bytes
	// see: https://github.com/celestiaorg/celestia-core/blob/edd9b9d8c38100ec0731ece4ac5f111e3a17ce32/types/tx.go#L205-L211
	// 1,973,786 - 65,536 - 65,536 = 1,842,714 bytes
	DefaultMaxBytes = 1842714
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CelestiaDA

type CelestiaDA struct {
	// contains filtered or unexported fields
}

CelestiaDA implements the celestia backend for the DA interface

func NewCelestiaDA

func NewCelestiaDA(client *rpc.Client, namespace share.Namespace, gasPrice float64, ctx context.Context) *CelestiaDA

NewCelestiaDA returns an instance of CelestiaDA

func (*CelestiaDA) Commit

func (c *CelestiaDA) Commit(ctx context.Context, daBlobs []da.Blob, ns da.Namespace) ([]da.Commitment, error)

Commit creates a Commitment for each given Blob.

func (*CelestiaDA) Get

func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Blob, error)

Get returns Blob for each given ID, or an error.

func (*CelestiaDA) GetIDs

func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64, ns da.Namespace) ([]da.ID, error)

GetIDs returns IDs of all Blobs located in DA at given height.

func (*CelestiaDA) GetProofs added in v0.13.0

func (c *CelestiaDA) GetProofs(ctx context.Context, daIDs []da.ID, ns da.Namespace) ([]da.Proof, error)

GetProofs returns the inclusion proofs for the given IDs.

func (*CelestiaDA) MaxBlobSize

func (c *CelestiaDA) MaxBlobSize(ctx context.Context) (uint64, error)

MaxBlobSize returns the max blob size

func (*CelestiaDA) Submit

func (c *CelestiaDA) Submit(ctx context.Context, daBlobs []da.Blob, gasPrice float64, ns da.Namespace) ([]da.ID, error)

Submit submits the Blobs to Data Availability layer.

func (*CelestiaDA) Validate

func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Proof, ns da.Namespace) ([]bool, error)

Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs.

type MockBlobAPI

type MockBlobAPI struct {
	// contains filtered or unexported fields
}

MockBlobAPI mocks the blob API

func (*MockBlobAPI) Get

func (m *MockBlobAPI) Get(ctx context.Context, height uint64, ns share.Namespace, _ blob.Commitment) (*blob.Blob, error)

Get mocks the blob.Get method

func (*MockBlobAPI) GetAll

func (m *MockBlobAPI) GetAll(ctx context.Context, height uint64, ns []share.Namespace) ([]*blob.Blob, error)

GetAll mocks the blob.GetAll method

func (*MockBlobAPI) GetProof

GetProof mocks the blob.GetProof method

func (*MockBlobAPI) Included

Included mocks the blob.Included method

func (*MockBlobAPI) Submit

func (m *MockBlobAPI) Submit(ctx context.Context, blobs []*blob.Blob, gasPrice float64) (uint64, error)

Submit mocks the blob.Submit method

type MockService

type MockService struct {
	// contains filtered or unexported fields
}

MockService mocks the node RPC service

func NewMockService

func NewMockService() *MockService

NewMockService returns the mock service

func (*MockService) Close

func (m *MockService) Close()

Close closes the server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL