Documentation
¶
Index ¶
- func NewConstructor(squareSize uint64, opts ...nmt.Option) rsmt2d.TreeConstructorFn
- func RandEDS(size int) (*rsmt2d.ExtendedDataSquare, error)
- func RandNamespace() share.Namespace
- func RandShares(total int) ([]share.Share, error)
- type DataAvailabilityLayerClient
- func (m *DataAvailabilityLayerClient) GetHeaderByHeight(height uint64) *core.DataAvailabilityHeader
- func (m *DataAvailabilityLayerClient) GetHeightByHeader(dah *core.DataAvailabilityHeader) uint64
- func (m *DataAvailabilityLayerClient) Init(_ types.NamespaceID, config []byte, dalcKV ds.Datastore, logger log.Logger) error
- func (m *DataAvailabilityLayerClient) RetrieveBlocks(ctx context.Context, daHeight uint64) da.ResultRetrieveBlocks
- func (m *DataAvailabilityLayerClient) Start() error
- func (m *DataAvailabilityLayerClient) Stop() error
- func (m *DataAvailabilityLayerClient) SubmitBlocks(ctx context.Context, blocks []*types.Block) da.ResultSubmitBlocks
- type ErasuredNamespacedMerkleTree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConstructor ¶ added in v0.9.0
func NewConstructor(squareSize uint64, opts ...nmt.Option) rsmt2d.TreeConstructorFn
NewConstructor creates a tree constructor function as required by rsmt2d to calculate the data root. It creates that tree using the wrapper.ErasuredNamespacedMerkleTree.
func RandEDS ¶ added in v0.9.0
func RandEDS(size int) (*rsmt2d.ExtendedDataSquare, error)
RandEDS generates EDS filled with the random data with the given size for original square. It uses require.TestingT to be able to take both a *testing.T and a *testing.B.
func RandNamespace ¶ added in v0.9.0
RandNamespace generates random valid data namespace for testing purposes.
Types ¶
type DataAvailabilityLayerClient ¶
type DataAvailabilityLayerClient struct {
// contains filtered or unexported fields
}
DataAvailabilityLayerClient is intended only for usage in tests. It does actually ensures DA - it stores data in-memory.
func (*DataAvailabilityLayerClient) GetHeaderByHeight ¶ added in v0.9.0
func (m *DataAvailabilityLayerClient) GetHeaderByHeight(height uint64) *core.DataAvailabilityHeader
GetHeaderByHeight returns the header at the given height.
func (*DataAvailabilityLayerClient) GetHeightByHeader ¶ added in v0.9.0
func (m *DataAvailabilityLayerClient) GetHeightByHeader(dah *core.DataAvailabilityHeader) uint64
GetHeightByHeader returns the height for the given header.
func (*DataAvailabilityLayerClient) Init ¶
func (m *DataAvailabilityLayerClient) Init(_ types.NamespaceID, config []byte, dalcKV ds.Datastore, logger log.Logger) error
Init is called once to allow DA client to read configuration and initialize resources.
func (*DataAvailabilityLayerClient) RetrieveBlocks ¶
func (m *DataAvailabilityLayerClient) RetrieveBlocks(ctx context.Context, daHeight uint64) da.ResultRetrieveBlocks
RetrieveBlocks returns block at given height from data availability layer.
func (*DataAvailabilityLayerClient) Start ¶
func (m *DataAvailabilityLayerClient) Start() error
Start implements DataAvailabilityLayerClient interface.
func (*DataAvailabilityLayerClient) Stop ¶
func (m *DataAvailabilityLayerClient) Stop() error
Stop implements DataAvailabilityLayerClient interface.
func (*DataAvailabilityLayerClient) SubmitBlocks ¶ added in v0.10.0
func (m *DataAvailabilityLayerClient) SubmitBlocks(ctx context.Context, blocks []*types.Block) da.ResultSubmitBlocks
SubmitBlocks submits the passed in blocks to the DA layer. This should create a transaction which (potentially) triggers a state transition in the DA layer.
type ErasuredNamespacedMerkleTree ¶ added in v0.9.0
type ErasuredNamespacedMerkleTree struct {
// contains filtered or unexported fields
}
ErasuredNamespacedMerkleTree wraps NamespaceMerkleTree to conform to the rsmt2d.Tree interface while also providing the correct namespaces to the underlying NamespaceMerkleTree. It does this by adding the already included namespace to the first half of the tree, and then uses the parity namespace ID for each share pushed to the second half of the tree. This allows for the namespaces to be included in the erasure data, while also keeping the nmt library sufficiently general
func NewErasuredNamespacedMerkleTree ¶ added in v0.9.0
func NewErasuredNamespacedMerkleTree(squareSize uint64, axisIndex uint, options ...nmt.Option) ErasuredNamespacedMerkleTree
NewErasuredNamespacedMerkleTree creates a new ErasuredNamespacedMerkleTree with an underlying NMT of namespace size `namespace.NamespaceSize` and with `ignoreMaxNamespace=true`. axisIndex is the index of the row or column that this tree is committing to. squareSize must be greater than zero.
func (*ErasuredNamespacedMerkleTree) ProveRange ¶ added in v0.9.0
func (w *ErasuredNamespacedMerkleTree) ProveRange(start, end int) (nmt.Proof, error)
ProveRange returns a Merkle range proof for the leaf range [start, end] where `end` is non-inclusive.
func (*ErasuredNamespacedMerkleTree) Push ¶ added in v0.9.0
func (w *ErasuredNamespacedMerkleTree) Push(data []byte) error
Push adds the provided data to the underlying NamespaceMerkleTree, and automatically uses the first DefaultNamespaceIDLen number of bytes as the namespace unless the data pushed to the second half of the tree. Fulfills the rsmt.Tree interface. NOTE: panics if an error is encountered while pushing or if the tree size is exceeded.
func (*ErasuredNamespacedMerkleTree) Root ¶ added in v0.9.0
func (w *ErasuredNamespacedMerkleTree) Root() ([]byte, error)
Root fulfills the rsmt.Tree interface by generating and returning the underlying NamespaceMerkleTree Root.