Skip to content

Commit e3d1c47

Browse files
author
tac0turtle
committed
update
1 parent 371672d commit e3d1c47

16 files changed

Lines changed: 146 additions & 100 deletions

File tree

apps/evm/single/cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var RunCmd = &cobra.Command{
4040

4141
logger := rollcmd.SetupLogger(nodeConfig.Log)
4242

43-
daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.Namespace)
43+
daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken)
4444
if err != nil {
4545
return err
4646
}

apps/evm/single/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ require (
5454
github.com/buger/goterm v1.0.4 // indirect
5555
github.com/celestiaorg/go-header v0.6.6 // indirect
5656
github.com/celestiaorg/go-libp2p-messenger v0.2.2 // indirect
57-
github.com/celestiaorg/go-square/v2 v2.2.0 // indirect
5857
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
5958
github.com/cespare/xxhash/v2 v2.3.0 // indirect
6059
github.com/compose-spec/compose-go/v2 v2.6.0 // indirect

apps/evm/single/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ github.com/celestiaorg/go-header v0.6.6 h1:17GvSXU/w8L1YWHZP4pYm9/4YHA8iy5Ku2wTE
107107
github.com/celestiaorg/go-header v0.6.6/go.mod h1:RdnlTmsyuNerztNiJiQE5G/EGEH+cErhQ83xNjuGcaQ=
108108
github.com/celestiaorg/go-libp2p-messenger v0.2.2 h1:osoUfqjss7vWTIZrrDSy953RjQz+ps/vBFE7bychLEc=
109109
github.com/celestiaorg/go-libp2p-messenger v0.2.2/go.mod h1:oTCRV5TfdO7V/k6nkx7QjQzGrWuJbupv+0o1cgnY2i4=
110-
github.com/celestiaorg/go-square/v2 v2.2.0 h1:zJnUxCYc65S8FgUfVpyG/osDcsnjzo/JSXw/Uwn8zp4=
111-
github.com/celestiaorg/go-square/v2 v2.2.0/go.mod h1:j8kQUqJLYtcvCQMQV6QjEhUdaF7rBTXF74g8LbkR0Co=
112110
github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo=
113111
github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU=
114112
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=

apps/grpc/single/cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The execution client must implement the Evolve execution gRPC interface.`,
4646
logger := rollcmd.SetupLogger(nodeConfig.Log)
4747

4848
// Create DA client
49-
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.Namespace)
49+
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken)
5050
if err != nil {
5151
return err
5252
}

apps/grpc/single/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ require (
2020
github.com/beorn7/perks v1.0.1 // indirect
2121
github.com/celestiaorg/go-header v0.6.6 // indirect
2222
github.com/celestiaorg/go-libp2p-messenger v0.2.2 // indirect
23-
github.com/celestiaorg/go-square/v2 v2.2.0 // indirect
2423
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2524
github.com/containerd/cgroups v1.1.0 // indirect
2625
github.com/coreos/go-systemd/v22 v22.5.0 // indirect

apps/grpc/single/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ github.com/celestiaorg/go-header v0.6.6 h1:17GvSXU/w8L1YWHZP4pYm9/4YHA8iy5Ku2wTE
2727
github.com/celestiaorg/go-header v0.6.6/go.mod h1:RdnlTmsyuNerztNiJiQE5G/EGEH+cErhQ83xNjuGcaQ=
2828
github.com/celestiaorg/go-libp2p-messenger v0.2.2 h1:osoUfqjss7vWTIZrrDSy953RjQz+ps/vBFE7bychLEc=
2929
github.com/celestiaorg/go-libp2p-messenger v0.2.2/go.mod h1:oTCRV5TfdO7V/k6nkx7QjQzGrWuJbupv+0o1cgnY2i4=
30-
github.com/celestiaorg/go-square/v2 v2.2.0 h1:zJnUxCYc65S8FgUfVpyG/osDcsnjzo/JSXw/Uwn8zp4=
31-
github.com/celestiaorg/go-square/v2 v2.2.0/go.mod h1:j8kQUqJLYtcvCQMQV6QjEhUdaF7rBTXF74g8LbkR0Co=
3230
github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo=
3331
github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU=
3432
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

apps/testapp/cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var RunCmd = &cobra.Command{
4545
ctx, cancel := context.WithCancel(context.Background())
4646
defer cancel()
4747

48-
daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.Namespace)
48+
daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken)
4949
if err != nil {
5050
return err
5151
}

apps/testapp/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ require (
2525
github.com/beorn7/perks v1.0.1 // indirect
2626
github.com/celestiaorg/go-header v0.6.6 // indirect
2727
github.com/celestiaorg/go-libp2p-messenger v0.2.2 // indirect
28-
github.com/celestiaorg/go-square/v2 v2.2.0 // indirect
2928
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3029
github.com/containerd/cgroups v1.1.0 // indirect
3130
github.com/coreos/go-systemd/v22 v22.5.0 // indirect

apps/testapp/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ github.com/celestiaorg/go-header v0.6.6 h1:17GvSXU/w8L1YWHZP4pYm9/4YHA8iy5Ku2wTE
2727
github.com/celestiaorg/go-header v0.6.6/go.mod h1:RdnlTmsyuNerztNiJiQE5G/EGEH+cErhQ83xNjuGcaQ=
2828
github.com/celestiaorg/go-libp2p-messenger v0.2.2 h1:osoUfqjss7vWTIZrrDSy953RjQz+ps/vBFE7bychLEc=
2929
github.com/celestiaorg/go-libp2p-messenger v0.2.2/go.mod h1:oTCRV5TfdO7V/k6nkx7QjQzGrWuJbupv+0o1cgnY2i4=
30-
github.com/celestiaorg/go-square/v2 v2.2.0 h1:zJnUxCYc65S8FgUfVpyG/osDcsnjzo/JSXw/Uwn8zp4=
31-
github.com/celestiaorg/go-square/v2 v2.2.0/go.mod h1:j8kQUqJLYtcvCQMQV6QjEhUdaF7rBTXF74g8LbkR0Co=
3230
github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo=
3331
github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU=
3432
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

da/cmd/local-da/local.go

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ func NewLocalDA(logger zerolog.Logger, opts ...func(*LocalDA) *LocalDA) *LocalDA
5858

5959
var _ coreda.DA = &LocalDA{}
6060

61+
// validateNamespace checks that namespace is exactly 29 bytes
62+
func validateNamespace(ns []byte) error {
63+
if len(ns) != 29 {
64+
return fmt.Errorf("namespace must be exactly 29 bytes, got %d", len(ns))
65+
}
66+
return nil
67+
}
68+
6169
// MaxBlobSize returns the max blob size in bytes.
6270
func (d *LocalDA) MaxBlobSize(ctx context.Context) (uint64, error) {
6371
d.logger.Debug().Uint64("maxBlobSize", d.maxBlobSize).Msg("MaxBlobSize called")
@@ -77,7 +85,11 @@ func (d *LocalDA) GasPrice(ctx context.Context) (float64, error) {
7785
}
7886

7987
// Get returns Blobs for given IDs.
80-
func (d *LocalDA) Get(ctx context.Context, ids []coreda.ID, _ []byte) ([]coreda.Blob, error) {
88+
func (d *LocalDA) Get(ctx context.Context, ids []coreda.ID, ns []byte) ([]coreda.Blob, error) {
89+
if err := validateNamespace(ns); err != nil {
90+
d.logger.Error().Err(err).Msg("Get: invalid namespace")
91+
return nil, err
92+
}
8193
d.logger.Debug().Interface("ids", ids).Msg("Get called")
8294
d.mu.Lock()
8395
defer d.mu.Unlock()
@@ -105,7 +117,11 @@ func (d *LocalDA) Get(ctx context.Context, ids []coreda.ID, _ []byte) ([]coreda.
105117
}
106118

107119
// GetIDs returns IDs of Blobs at given DA height.
108-
func (d *LocalDA) GetIDs(ctx context.Context, height uint64, _ []byte) (*coreda.GetIDsResult, error) {
120+
func (d *LocalDA) GetIDs(ctx context.Context, height uint64, ns []byte) (*coreda.GetIDsResult, error) {
121+
if err := validateNamespace(ns); err != nil {
122+
d.logger.Error().Err(err).Msg("GetIDs: invalid namespace")
123+
return nil, err
124+
}
109125
d.logger.Debug().Uint64("height", height).Msg("GetIDs called")
110126
d.mu.Lock()
111127
defer d.mu.Unlock()
@@ -130,9 +146,13 @@ func (d *LocalDA) GetIDs(ctx context.Context, height uint64, _ []byte) (*coreda.
130146
}
131147

132148
// GetProofs returns inclusion Proofs for all Blobs located in DA at given height.
133-
func (d *LocalDA) GetProofs(ctx context.Context, ids []coreda.ID, _ []byte) ([]coreda.Proof, error) {
149+
func (d *LocalDA) GetProofs(ctx context.Context, ids []coreda.ID, ns []byte) ([]coreda.Proof, error) {
150+
if err := validateNamespace(ns); err != nil {
151+
d.logger.Error().Err(err).Msg("GetProofs: invalid namespace")
152+
return nil, err
153+
}
134154
d.logger.Debug().Interface("ids", ids).Msg("GetProofs called")
135-
blobs, err := d.Get(ctx, ids, nil)
155+
blobs, err := d.Get(ctx, ids, ns)
136156
if err != nil {
137157
d.logger.Error().Err(err).Msg("GetProofs: failed to get blobs")
138158
return nil, err
@@ -149,7 +169,11 @@ func (d *LocalDA) GetProofs(ctx context.Context, ids []coreda.ID, _ []byte) ([]c
149169
}
150170

151171
// Commit returns cryptographic Commitments for given blobs.
152-
func (d *LocalDA) Commit(ctx context.Context, blobs []coreda.Blob, _ []byte) ([]coreda.Commitment, error) {
172+
func (d *LocalDA) Commit(ctx context.Context, blobs []coreda.Blob, ns []byte) ([]coreda.Commitment, error) {
173+
if err := validateNamespace(ns); err != nil {
174+
d.logger.Error().Err(err).Msg("Commit: invalid namespace")
175+
return nil, err
176+
}
153177
d.logger.Debug().Int("numBlobs", len(blobs)).Msg("Commit called")
154178
commits := make([]coreda.Commitment, len(blobs))
155179
for i, blob := range blobs {
@@ -160,8 +184,12 @@ func (d *LocalDA) Commit(ctx context.Context, blobs []coreda.Blob, _ []byte) ([]
160184
}
161185

162186
// SubmitWithOptions stores blobs in DA layer (options are ignored).
163-
func (d *LocalDA) SubmitWithOptions(ctx context.Context, blobs []coreda.Blob, gasPrice float64, _ []byte, _ []byte) ([]coreda.ID, error) {
164-
d.logger.Info().Int("numBlobs", len(blobs)).Float64("gasPrice", gasPrice).Msg("SubmitWithOptions called")
187+
func (d *LocalDA) SubmitWithOptions(ctx context.Context, blobs []coreda.Blob, gasPrice float64, ns []byte, _ []byte) ([]coreda.ID, error) {
188+
if err := validateNamespace(ns); err != nil {
189+
d.logger.Error().Err(err).Msg("SubmitWithOptions: invalid namespace")
190+
return nil, err
191+
}
192+
d.logger.Info().Int("numBlobs", len(blobs)).Float64("gasPrice", gasPrice).Str("namespace", string(ns)).Msg("SubmitWithOptions called")
165193

166194
// Validate blob sizes before processing
167195
for i, blob := range blobs {
@@ -186,8 +214,12 @@ func (d *LocalDA) SubmitWithOptions(ctx context.Context, blobs []coreda.Blob, ga
186214
}
187215

188216
// Submit stores blobs in DA layer (options are ignored).
189-
func (d *LocalDA) Submit(ctx context.Context, blobs []coreda.Blob, gasPrice float64, _ []byte) ([]coreda.ID, error) {
190-
d.logger.Info().Int("numBlobs", len(blobs)).Float64("gasPrice", gasPrice).Msg("Submit called")
217+
func (d *LocalDA) Submit(ctx context.Context, blobs []coreda.Blob, gasPrice float64, ns []byte) ([]coreda.ID, error) {
218+
if err := validateNamespace(ns); err != nil {
219+
d.logger.Error().Err(err).Msg("Submit: invalid namespace")
220+
return nil, err
221+
}
222+
d.logger.Info().Int("numBlobs", len(blobs)).Float64("gasPrice", gasPrice).Str("namespace", string(ns)).Msg("Submit called")
191223

192224
// Validate blob sizes before processing
193225
for i, blob := range blobs {
@@ -212,7 +244,11 @@ func (d *LocalDA) Submit(ctx context.Context, blobs []coreda.Blob, gasPrice floa
212244
}
213245

214246
// Validate checks the Proofs for given IDs.
215-
func (d *LocalDA) Validate(ctx context.Context, ids []coreda.ID, proofs []coreda.Proof, _ []byte) ([]bool, error) {
247+
func (d *LocalDA) Validate(ctx context.Context, ids []coreda.ID, proofs []coreda.Proof, ns []byte) ([]bool, error) {
248+
if err := validateNamespace(ns); err != nil {
249+
d.logger.Error().Err(err).Msg("Validate: invalid namespace")
250+
return nil, err
251+
}
216252
d.logger.Debug().Int("numIDs", len(ids)).Int("numProofs", len(proofs)).Msg("Validate called")
217253
if len(ids) != len(proofs) {
218254
d.logger.Error().Int("ids", len(ids)).Int("proofs", len(proofs)).Msg("Validate: id/proof count mismatch")

0 commit comments

Comments
 (0)