Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions block/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (
coreda "github.com/rollkit/rollkit/core/da"
coreexecutor "github.com/rollkit/rollkit/core/execution"
coresequencer "github.com/rollkit/rollkit/core/sequencer"
"github.com/rollkit/rollkit/da"
damocks "github.com/rollkit/rollkit/da/mocks"

"github.com/rollkit/rollkit/pkg/cache"
"github.com/rollkit/rollkit/pkg/config"
genesispkg "github.com/rollkit/rollkit/pkg/genesis"
"github.com/rollkit/rollkit/pkg/signer"
noopsigner "github.com/rollkit/rollkit/pkg/signer/noop"
"github.com/rollkit/rollkit/pkg/store"
"github.com/rollkit/rollkit/test/mocks"
damocks "github.com/rollkit/rollkit/test/mocks"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
"github.com/rollkit/rollkit/types"
)

Expand Down Expand Up @@ -77,7 +77,7 @@ func WithinDuration(t *testing.T, expected, actual, tolerance time.Duration) boo
func getManager(t *testing.T, backend coreda.DA, gasPrice float64, gasMultiplier float64) *Manager {
logger := log.NewTestLogger(t)
return &Manager{
dalc: da.NewDAClient(backend, gasPrice, gasMultiplier, nil, nil, logger),
dalc: coreda.NewDummyClient(backend, []byte("test")),
headerCache: cache.NewCache[types.SignedHeader](),
logger: logger,
gasPrice: gasPrice,
Expand Down Expand Up @@ -298,10 +298,10 @@ func TestSubmitBlocksToMockDA(t *testing.T) {
mockDA.On("MaxBlobSize", mock.Anything).Return(uint64(12345), nil)
mockDA.
On("SubmitWithOptions", mock.Anything, blobs, tc.expectedGasPrices[0], []byte(nil), []byte(nil)).
Return([][]byte{}, da.ErrTxTimedOut).Once()
Return([][]byte{}, coreda.ErrTxTimedOut).Once()
mockDA.
On("SubmitWithOptions", mock.Anything, blobs, tc.expectedGasPrices[1], []byte(nil), []byte(nil)).
Return([][]byte{}, da.ErrTxTimedOut).Once()
Return([][]byte{}, coreda.ErrTxTimedOut).Once()
mockDA.
On("SubmitWithOptions", mock.Anything, blobs, tc.expectedGasPrices[2], []byte(nil), []byte(nil)).
Return([][]byte{bytes.Repeat([]byte{0x00}, 8)}, nil)
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions da/cmd/local-da/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"cosmossdk.io/log"
coreda "github.com/rollkit/rollkit/core/da"
"github.com/rollkit/rollkit/da"
)

// DefaultMaxBlobSize is the default max blob size
Expand Down Expand Up @@ -98,7 +97,7 @@ func (d *LocalDA) Get(ctx context.Context, ids []coreda.ID, _ []byte) ([]coreda.
}
if !found {
d.logger.Warn("Get: blob not found", "id", id, "height", height)
return nil, da.ErrBlobNotFound
return nil, coreda.ErrBlobNotFound
}
}
d.logger.Debug("Get successful", "count", len(blobs))
Expand All @@ -113,7 +112,7 @@ func (d *LocalDA) GetIDs(ctx context.Context, height uint64, _ []byte) (*coreda.

if height > d.height {
d.logger.Error("GetIDs: height in future", "requested", height, "current", d.height)
return nil, fmt.Errorf("height %d is in the future: %w", height, da.ErrFutureHeight)
return nil, fmt.Errorf("height %d is in the future: %w", height, coreda.ErrFutureHeight)
}

kvps, ok := d.data[height]
Expand Down
14 changes: 7 additions & 7 deletions da/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (dac *DAClient) Submit(ctx context.Context, data [][]byte, maxBlobSize uint
for i := range data {
blob := data[i]
if blobSize+uint64(len(blob)) > maxBlobSize {
message = fmt.Sprint(ErrBlobSizeOverLimit.Error(), "blob size limit reached", "maxBlobSize", maxBlobSize, "index", i, "blobSize", blobSize, "len(blob)", len(blob))
message = fmt.Sprint(coreda.ErrBlobSizeOverLimit.Error(), "blob size limit reached", "maxBlobSize", maxBlobSize, "index", i, "blobSize", blobSize, "len(blob)", len(blob))
dac.Logger.Info(message)
break
}
Expand All @@ -82,15 +82,15 @@ func (dac *DAClient) Submit(ctx context.Context, data [][]byte, maxBlobSize uint
if err != nil {
status := coreda.StatusError
switch {
case errors.Is(err, ErrTxTimedOut):
case errors.Is(err, coreda.ErrTxTimedOut):
status = coreda.StatusNotIncludedInBlock
case errors.Is(err, ErrTxAlreadyInMempool):
case errors.Is(err, coreda.ErrTxAlreadyInMempool):
status = coreda.StatusAlreadyInMempool
case errors.Is(err, ErrTxIncorrectAccountSequence):
case errors.Is(err, coreda.ErrTxIncorrectAccountSequence):
status = coreda.StatusAlreadyInMempool
case errors.Is(err, ErrTxTooLarge):
case errors.Is(err, coreda.ErrTxTooLarge):
status = coreda.StatusTooBig
case errors.Is(err, ErrContextDeadline):
case errors.Is(err, coreda.ErrContextDeadline):
status = coreda.StatusContextDeadline
}
return coreda.ResultSubmit{
Expand Down Expand Up @@ -138,7 +138,7 @@ func (dac *DAClient) Retrieve(ctx context.Context, dataLayerHeight uint64) cored
return coreda.ResultRetrieve{
BaseResult: coreda.BaseResult{
Code: coreda.StatusNotFound,
Message: ErrBlobNotFound.Error(),
Message: coreda.ErrBlobNotFound.Error(),
Height: dataLayerHeight,
},
}
Expand Down
12 changes: 6 additions & 6 deletions da/da_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/mock"

coreda "github.com/rollkit/rollkit/core/da"
"github.com/rollkit/rollkit/da/mocks"
"github.com/rollkit/rollkit/test/mocks"
)

const (
Expand Down Expand Up @@ -43,7 +43,7 @@ func TestMockDAErrors(t *testing.T) {
On("SubmitWithOptions", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
// On("SubmitWithOptions", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
After(submitTimeout).
Return(nil, ErrContextDeadline)
Return(nil, coreda.ErrContextDeadline)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

Expand All @@ -55,7 +55,7 @@ func TestMockDAErrors(t *testing.T) {
defer cancel()

resp := dalc.Submit(ctx, blobs, maxBlobSize, -1)
assert.Contains(resp.Message, ErrContextDeadline.Error(), "should return context timeout error")
assert.Contains(resp.Message, coreda.ErrContextDeadline.Error(), "should return context timeout error")
})
t.Run("max_blob_size_error", func(t *testing.T) {
mockDA := &mocks.DA{}
Expand All @@ -78,7 +78,7 @@ func TestMockDAErrors(t *testing.T) {
mockDA.On("MaxBlobSize", mock.Anything).Return(uint64(1234), nil)
mockDA.
On("SubmitWithOptions", mock.Anything, blobs, float64(-1), []byte(nil), []byte(nil)).
Return([]coreda.ID{}, ErrTxTooLarge)
Return([]coreda.ID{}, coreda.ErrTxTooLarge)

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
Expand All @@ -88,7 +88,7 @@ func TestMockDAErrors(t *testing.T) {
assert.NoError(err)

resp := dalc.Submit(ctx, blobs, maxBlobSize, -1)
assert.Contains(resp.Message, ErrTxTooLarge.Error(), "should return tx too large error")
assert.Contains(resp.Message, coreda.ErrTxTooLarge.Error(), "should return tx too large error")
assert.Equal(resp.Code, coreda.StatusTooBig)
})
}
Expand Down Expand Up @@ -253,7 +253,7 @@ func doTestRetrieveNoBlocksFound(t *testing.T, dalc coreda.Client) {
// Namespaces don't work on dummy da right now (https://github.com/rollkit/go-da/issues/94),
// when namespaces are implemented, this should be uncommented
assert.Equal(coreda.StatusNotFound, result.Code)
assert.Contains(result.Message, ErrBlobNotFound.Error())
assert.Contains(result.Message, coreda.ErrBlobNotFound.Error())
assert.Equal(coreda.StatusNotFound, result.Code)
}

Expand Down
159 changes: 145 additions & 14 deletions da/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,169 @@ replace github.com/rollkit/rollkit/core => ../core
replace github.com/rollkit/rollkit => ../

require (
cosmossdk.io/log v1.5.0
cosmossdk.io/log v1.5.1
github.com/filecoin-project/go-jsonrpc v0.7.1
github.com/rollkit/rollkit/core v0.0.0-00010101000000-000000000000
github.com/rollkit/rollkit v0.0.0-00010101000000-000000000000

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the addition of the rollkit dependency in da expected?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks like a potential source of problems.
Mocks are could be in core or need separate go.mod 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can generate a go.mod for it. was thinking of doing the same. At least here we get top down, release core, then rollkit then da and others instead of inverse. for rollkit and da.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rollkit will still be a indirect dep even by making mocks a go.mod. Ill try something else

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created an internal mocks directory for da to avoid the import as even the mocks depend on main rollkit

github.com/rollkit/rollkit/core v0.0.0-20250312114929-104787ba1a4c
github.com/stretchr/testify v1.10.0
)

require (
github.com/bytedance/sonic v1.12.3 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.13.2 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/celestiaorg/go-header v0.6.5 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/goccy/go-yaml v1.16.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/ipfs/go-log/v2 v2.0.8 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/boxo v0.27.4 // indirect
github.com/ipfs/go-cid v0.5.0 // indirect
github.com/ipfs/go-datastore v0.8.2 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipld/go-ipld-prime v0.21.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/koron/go-ssdp v0.0.5 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.2.0 // indirect
github.com/libp2p/go-libp2p v0.41.1 // indirect
github.com/libp2p/go-libp2p-asn-util v0.4.1 // indirect
github.com/libp2p/go-libp2p-kad-dht v0.29.1 // indirect
github.com/libp2p/go-libp2p-kbucket v0.6.5 // indirect
github.com/libp2p/go-libp2p-pubsub v0.13.1 // indirect
github.com/libp2p/go-libp2p-record v0.3.1 // indirect
github.com/libp2p/go-libp2p-routing-helpers v0.7.4 // indirect
github.com/libp2p/go-msgio v0.3.0 // indirect
github.com/libp2p/go-netroute v0.2.2 // indirect
github.com/libp2p/go-reuseport v0.4.0 // indirect
github.com/libp2p/go-yamux/v5 v5.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/miekg/dns v1.1.64 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.15.0 // indirect
github.com/multiformats/go-multiaddr-dns v0.4.1 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.6.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo/v2 v2.23.3 // indirect
github.com/opencontainers/runtime-spec v1.2.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pion/datachannel v1.5.10 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/dtls/v3 v3.0.5 // indirect
github.com/pion/ice/v4 v4.0.8 // indirect
github.com/pion/interceptor v0.1.37 // indirect
github.com/pion/logging v0.2.3 // indirect
github.com/pion/mdns/v2 v2.0.7 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.15 // indirect
github.com/pion/rtp v1.8.13 // indirect
github.com/pion/sctp v1.8.37 // indirect
github.com/pion/sdp/v3 v3.0.11 // indirect
github.com/pion/srtp/v3 v3.0.4 // indirect
github.com/pion/stun v0.6.1 // indirect
github.com/pion/stun/v3 v3.0.0 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/transport/v3 v3.0.7 // indirect
github.com/pion/turn/v4 v4.0.0 // indirect
github.com/pion/webrtc/v4 v4.0.14 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/client_golang v1.21.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.16.0 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.50.1 // indirect
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rs/zerolog v1.34.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.9.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.uber.org/dig v1.18.1 // indirect
go.uber.org/fx v1.23.0 // indirect
go.uber.org/mock v0.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/arch v0.15.0 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/mod v0.24.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/sync v0.12.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/tools v0.31.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.4.0 // indirect
)
Loading