da

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 1 Imported by: 23

README

go-da

go-da defines a generic Data Availability interface for modular blockchains.

build-and-test golangci-lint Go Report Card codecov GoDoc

DA Interface

Method Params Return
MaxBlobSize uint64
Get ids []ID []Blobs
GetIDs height uint64 []ID
Commit blobs []Blob []Commitment
Validate ids []Blob, proofs []Proof []bool

Implementations

The following implementations are available:

In addition the following helper implementations are available:

  • DummyDA implements a Mock DA useful for testing.
  • Proxy implements a proxy server that forwards requests to a gRPC server. The proxy client can be used directly to interact with the DA service.

Helpful commands

# Generate protobuf files. Requires docker.
make proto-gen

# Lint protobuf files. Requires docker.
make proto-lint

# Run tests.
make test

# Run linters (requires golangci-lint, markdownlint, hadolint, and yamllint)
make lint

Contributing

We welcome your contributions! Everyone is welcome to contribute, whether it's in the form of code, documentation, bug reports, feature requests, or anything else.

If you're looking for issues to work on, try looking at the good first issue list. Issues with this tag are suitable for a new external contributor and is a great way to find something you can help with!

Please join our Community Discord to ask questions, discuss your ideas, and connect with other contributors.

Code of Conduct

See our Code of Conduct here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

type Blob = []byte

Blob is the data submitted/received from DA interface.

type Commitment

type Commitment = []byte

Commitment should contain serialized cryptographic commitment to Blob value.

type DA

type DA interface {
	// MaxBlobSize returns the max blob size
	MaxBlobSize(ctx context.Context) (uint64, error)

	// Get returns Blob for each given ID, or an error.
	//
	// Error should be returned if ID is not formatted properly, there is no Blob for given ID or any other client-level
	// error occurred (dropped connection, timeout, etc).
	Get(ctx context.Context, ids []ID) ([]Blob, error)

	// GetIDs returns IDs of all Blobs located in DA at given height.
	GetIDs(ctx context.Context, height uint64) ([]ID, error)

	// Commit creates a Commitment for each given Blob.
	Commit(ctx context.Context, blobs []Blob) ([]Commitment, error)

	// Submit submits the Blobs to Data Availability layer.
	//
	// This method is synchronous. Upon successful submission to Data Availability layer, it returns ID identifying blob
	// in DA and Proof of inclusion.
	// If options is nil, default options are used.
	Submit(ctx context.Context, blobs []Blob, opts *SubmitOptions) ([]ID, []Proof, error)

	// Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs.
	Validate(ctx context.Context, ids []ID, proofs []Proof) ([]bool, error)
}

DA defines very generic interface for interaction with Data Availability layers.

type ID

type ID = []byte

ID should contain serialized data required by the implementation to find blob in Data Availability layer.

type Namespace added in v0.3.0

type Namespace = []byte

Namespace is an optional parameter used to set the location a blob should be posted to, for DA layers supporting the functionality.

type Proof

type Proof = []byte

Proof should contain serialized proof of inclusion (publication) of Blob in Data Availability layer.

type SubmitOptions

type SubmitOptions struct {
	GasPrice  float64
	Namespace Namespace
}

SubmitOptions are the parameters used for blob submission.

Directories

Path Synopsis
types

Jump to

Keyboard shortcuts

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