-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/0xPolygon/cdk | ||
|
||
go 1.19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dataavailability | ||
|
||
// DABackendType is the data availability protocol for the CDK | ||
type DABackendType string | ||
|
||
const ( | ||
// DataAvailabilityCommittee is the DAC protocol backend | ||
DataAvailabilityCommittee DABackendType = "DataAvailabilityCommittee" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
package dataavailability | ||
|
||
type DataAvailability interface { | ||
GetData() []byte | ||
PostDara(data []byte) error | ||
import ( | ||
"context" | ||
|
||
"github.com/umbracle/ethgo" | ||
) | ||
|
||
// DABackender is an interface for components that store and retrieve batch data | ||
type DABackender interface { | ||
SequenceRetriever | ||
SequenceSender | ||
// Init initializes the DABackend | ||
Init() error | ||
} | ||
|
||
// SequenceSender is used to send provided sequence of batches | ||
type SequenceSender interface { | ||
// PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage | ||
// as expected by the contract | ||
PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) | ||
} | ||
|
||
// SequenceRetriever is used to retrieve batch data | ||
type SequenceRetriever interface { | ||
// GetSequence retrieves the sequence data from the data availability backend | ||
GetSequence(ctx context.Context, batchHashes []ethgo.Hash, dataAvailabilityMessage []byte) ([][]byte, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters