Skip to content

Commit c54bdf9

Browse files
authored
build(deps): bump go-da to v0.2.0 (#1448)
## Overview This PR updates go-da to v0.2.0 which accepts a context as the first argument to DA interface methods. ## Checklist - [x] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [x] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Enhanced the data access client to support context parameters for improved operation handling. - **Tests** - Updated tests to align with the new context parameter integration in data access methods. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 8b41ffe commit c54bdf9

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

da/da.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type DAClient struct {
7575
func (dac *DAClient) SubmitBlocks(ctx context.Context, blocks []*types.Block) ResultSubmitBlocks {
7676
var blobs [][]byte
7777
var blobSize uint64
78-
maxBlobSize, err := dac.DA.MaxBlobSize()
78+
maxBlobSize, err := dac.DA.MaxBlobSize(ctx)
7979
if err != nil {
8080
return ResultSubmitBlocks{
8181
BaseResult: BaseResult{
@@ -111,7 +111,7 @@ func (dac *DAClient) SubmitBlocks(ctx context.Context, blocks []*types.Block) Re
111111
},
112112
}
113113
}
114-
ids, _, err := dac.DA.Submit(blobs, dac.GasPrice)
114+
ids, _, err := dac.DA.Submit(ctx, blobs, dac.GasPrice)
115115
if err != nil {
116116
return ResultSubmitBlocks{
117117
BaseResult: BaseResult{
@@ -141,7 +141,7 @@ func (dac *DAClient) SubmitBlocks(ctx context.Context, blocks []*types.Block) Re
141141

142142
// RetrieveBlocks retrieves blocks from DA.
143143
func (dac *DAClient) RetrieveBlocks(ctx context.Context, dataLayerHeight uint64) ResultRetrieveBlocks {
144-
ids, err := dac.DA.GetIDs(dataLayerHeight)
144+
ids, err := dac.DA.GetIDs(ctx, dataLayerHeight)
145145
if err != nil {
146146
return ResultRetrieveBlocks{
147147
BaseResult: BaseResult{
@@ -161,7 +161,7 @@ func (dac *DAClient) RetrieveBlocks(ctx context.Context, dataLayerHeight uint64)
161161
}
162162
}
163163

164-
blobs, err := dac.DA.Get(ids)
164+
blobs, err := dac.DA.Get(ctx, ids)
165165
if err != nil {
166166
return ResultRetrieveBlocks{
167167
BaseResult: BaseResult{

da/da_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,32 @@ type MockDA struct {
4545
mock.Mock
4646
}
4747

48-
func (m *MockDA) MaxBlobSize() (uint64, error) {
48+
func (m *MockDA) MaxBlobSize(ctx context.Context) (uint64, error) {
4949
args := m.Called()
5050
return args.Get(0).(uint64), args.Error(1)
5151
}
5252

53-
func (m *MockDA) Get(ids []da.ID) ([]da.Blob, error) {
53+
func (m *MockDA) Get(ctx context.Context, ids []da.ID) ([]da.Blob, error) {
5454
args := m.Called(ids)
5555
return args.Get(0).([]da.Blob), args.Error(1)
5656
}
5757

58-
func (m *MockDA) GetIDs(height uint64) ([]da.ID, error) {
58+
func (m *MockDA) GetIDs(ctx context.Context, height uint64) ([]da.ID, error) {
5959
args := m.Called(height)
6060
return args.Get(0).([]da.ID), args.Error(1)
6161
}
6262

63-
func (m *MockDA) Commit(blobs []da.Blob) ([]da.Commitment, error) {
63+
func (m *MockDA) Commit(ctx context.Context, blobs []da.Blob) ([]da.Commitment, error) {
6464
args := m.Called(blobs)
6565
return args.Get(0).([]da.Commitment), args.Error(1)
6666
}
6767

68-
func (m *MockDA) Submit(blobs []da.Blob, gasPrice float64) ([]da.ID, []da.Proof, error) {
68+
func (m *MockDA) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64) ([]da.ID, []da.Proof, error) {
6969
args := m.Called(blobs, gasPrice)
7070
return args.Get(0).([]da.ID), args.Get(1).([]da.Proof), args.Error(2)
7171
}
7272

73-
func (m *MockDA) Validate(ids []da.ID, proofs []da.Proof) ([]bool, error) {
73+
func (m *MockDA) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof) ([]bool, error) {
7474
args := m.Called(ids, proofs)
7575
return args.Get(0).([]bool), args.Error(1)
7676
}
@@ -218,7 +218,7 @@ func doTestSubmitOversizedBlock(t *testing.T, dalc *DAClient) {
218218
require := require.New(t)
219219
assert := assert.New(t)
220220

221-
limit, err := dalc.DA.MaxBlobSize()
221+
limit, err := dalc.DA.MaxBlobSize(ctx)
222222
require.NoError(err)
223223
oversizedBlock := types.GetRandomBlock(1, int(limit))
224224
resp := dalc.SubmitBlocks(ctx, []*types.Block{oversizedBlock})
@@ -246,7 +246,7 @@ func doTestSubmitLargeBlocksOverflow(t *testing.T, dalc *DAClient) {
246246
require := require.New(t)
247247
assert := assert.New(t)
248248

249-
limit, err := dalc.DA.MaxBlobSize()
249+
limit, err := dalc.DA.MaxBlobSize(ctx)
250250
require.NoError(err)
251251

252252
// two large blocks, over blob limit to force partial submit

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/multiformats/go-multiaddr v0.12.1
2121
github.com/pkg/errors v0.9.1
2222
github.com/prometheus/client_golang v1.18.0
23-
github.com/rollkit/go-da v0.1.0
23+
github.com/rollkit/go-da v0.2.0
2424
github.com/rs/cors v1.10.1
2525
github.com/spf13/cobra v1.8.0
2626
github.com/spf13/viper v1.18.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,8 +1350,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
13501350
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
13511351
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
13521352
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
1353-
github.com/rollkit/go-da v0.1.0 h1:FAEMTNF8mTsPuiUgYt2dQSMzw8iYPjiWq7692CS2mbY=
1354-
github.com/rollkit/go-da v0.1.0/go.mod h1:Kef0XI5ecEKd3TXzI8S+9knAUJnZg0svh2DuXoCsPlM=
1353+
github.com/rollkit/go-da v0.2.0 h1:rNpWBa2inczgZ955ky3wy8FbrMajzVbm0UfbBGzm5UE=
1354+
github.com/rollkit/go-da v0.2.0/go.mod h1:Kef0XI5ecEKd3TXzI8S+9knAUJnZg0svh2DuXoCsPlM=
13551355
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
13561356
github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
13571357
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=

0 commit comments

Comments
 (0)