Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
vcastellm committed Mar 22, 2024
1 parent 735f25e commit 5f3d0b6
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/0xPolygon/cdk

go 1.19
Empty file added go.sum
Empty file.
9 changes: 9 additions & 0 deletions pkg/dataavailability/config.go
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"
)
28 changes: 25 additions & 3 deletions pkg/dataavailability/dataavailability.go
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)
}
4 changes: 2 additions & 2 deletions pkg/syncer/ethsyncer/ethsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import (
)

type EthSyncer struct {
Storage storage.Storage
DataAvailability dataavailability.DataAvailability
Storage storage.StorageService
DataAvailability dataavailability.DataAvailabilityService
}

0 comments on commit 5f3d0b6

Please sign in to comment.