-
Notifications
You must be signed in to change notification settings - Fork 972
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rpc): implementing go-da interface (#3146)
Integrates go-da directly to eliminate the need for [celestia-da](https://github.com/rollkit/celestia-da).
- Loading branch information
1 parent
c32ccf5
commit 625cdf3
Showing
16 changed files
with
592 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
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
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,54 @@ | ||
package da | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/rollkit/go-da" | ||
) | ||
|
||
//go:generate mockgen -destination=mocks/api.go -package=mocks . Module | ||
type Module interface { | ||
da.DA | ||
} | ||
|
||
// API is a wrapper around Module for the RPC. | ||
// TODO(@distractedm1nd): These structs need to be autogenerated. | ||
type API struct { | ||
Internal struct { | ||
MaxBlobSize func(ctx context.Context) (uint64, error) `perm:"read"` | ||
Get func(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Blob, error) `perm:"read"` | ||
GetIDs func(ctx context.Context, height uint64, ns da.Namespace) ([]da.ID, error) `perm:"read"` | ||
GetProofs func(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Proof, error) `perm:"read"` | ||
Commit func(ctx context.Context, blobs []da.Blob, ns da.Namespace) ([]da.Commitment, error) `perm:"read"` | ||
Validate func(context.Context, []da.ID, []da.Proof, da.Namespace) ([]bool, error) `perm:"read"` | ||
Submit func(context.Context, []da.Blob, float64, da.Namespace) ([]da.ID, error) `perm:"write"` | ||
} | ||
} | ||
|
||
func (api *API) MaxBlobSize(ctx context.Context) (uint64, error) { | ||
return api.Internal.MaxBlobSize(ctx) | ||
} | ||
|
||
func (api *API) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Blob, error) { | ||
return api.Internal.Get(ctx, ids, ns) | ||
} | ||
|
||
func (api *API) GetIDs(ctx context.Context, height uint64, ns da.Namespace) ([]da.ID, error) { | ||
return api.Internal.GetIDs(ctx, height, ns) | ||
} | ||
|
||
func (api *API) GetProofs(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Proof, error) { | ||
return api.Internal.GetProofs(ctx, ids, ns) | ||
} | ||
|
||
func (api *API) Commit(ctx context.Context, blobs []da.Blob, ns da.Namespace) ([]da.Commitment, error) { | ||
return api.Internal.Commit(ctx, blobs, ns) | ||
} | ||
|
||
func (api *API) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof, ns da.Namespace) ([]bool, error) { | ||
return api.Internal.Validate(ctx, ids, proofs, ns) | ||
} | ||
|
||
func (api *API) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, ns da.Namespace) ([]da.ID, error) { | ||
return api.Internal.Submit(ctx, blobs, gasPrice, ns) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
package da | ||
|
||
import ( | ||
"go.uber.org/fx" | ||
) | ||
|
||
func ConstructModule() fx.Option { | ||
return fx.Module("da", | ||
fx.Provide(NewService), | ||
fx.Provide(func(serv *Service) Module { | ||
return serv | ||
}), | ||
) | ||
} |
Oops, something went wrong.