-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactor into library + server (#3)
* refactor: into library pkgs with a command pkg * fix: celestia dependency mismatch * refactor: availda for external use * feat(daash): Add DA Manager to manage/init clients * fix(daash): map allocation * docs(cmd): Add run instructions - go mod tidy
- Loading branch information
Showing
11 changed files
with
323 additions
and
257 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
.env | ||
/.env | ||
./cmd/blob-server/avail-config.json | ||
|
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
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
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
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
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,48 @@ | ||
package daash | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/cenkalti/backoff" | ||
"github.com/rollkit/go-da" | ||
"github.com/stackrlabs/go-daash/availda" | ||
"github.com/stackrlabs/go-daash/eigenda" | ||
) | ||
|
||
type DAType string | ||
|
||
const ( | ||
Avail DAType = "avail" | ||
Eigen DAType = "eigen" | ||
) | ||
|
||
type DAManager struct { | ||
Clients map[DAType]da.DA | ||
} | ||
|
||
// Initialize all the DA clients | ||
func (d *DAManager) Init(availConfigPath string) error { | ||
d.Clients = make(map[DAType]da.DA) | ||
var err error | ||
// Initialize Avail | ||
var avail da.DA | ||
err = backoff.Retry(func() error { | ||
avail, err = availda.New(availConfigPath) | ||
return err //nolint: wrapcheck | ||
}, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 5)) | ||
if err != nil { | ||
return err | ||
} | ||
d.Clients[Avail] = avail | ||
|
||
// Initialize Eigen | ||
eigen, err := eigenda.New("disperser-goerli.eigenda.xyz:443", time.Second*90, time.Second*5) | ||
if err != nil { | ||
return err | ||
} | ||
d.Clients[Eigen] = eigen | ||
|
||
// TODO: Initialize Celestia | ||
|
||
return nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.