Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ test: vet
## test-e2e: Running e2e tests
test-e2e: build
@echo "--> Running e2e tests"
@go test -mod=readonly -failfast -timeout=15m -tags='e2e' ./test/e2e/... --binary=$(CURDIR)/build/rollkit
@go test -mod=readonly -failfast -timeout=15m -tags='e2e' ./test/e2e/... --binary=$(CURDIR)/build/testapp
.PHONY: test-e2e

## proto-gen: Generate protobuf files. Requires docker.
Expand Down
14 changes: 9 additions & 5 deletions block/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"cosmossdk.io/log"
goheaderstore "github.com/celestiaorg/go-header/store"
ds "github.com/ipfs/go-datastore"
"github.com/libp2p/go-libp2p/core/crypto"
"google.golang.org/protobuf/proto"

"github.com/rollkit/go-sequencing"
Expand All @@ -26,6 +25,7 @@ import (
"github.com/rollkit/rollkit/pkg/config"
"github.com/rollkit/rollkit/pkg/genesis"
"github.com/rollkit/rollkit/pkg/queue"
"github.com/rollkit/rollkit/pkg/signer"
"github.com/rollkit/rollkit/pkg/store"
"github.com/rollkit/rollkit/types"
pb "github.com/rollkit/rollkit/types/pb/rollkit/v1"
Expand Down Expand Up @@ -107,7 +107,7 @@ type Manager struct {
config config.Config
genesis genesis.Genesis

proposerKey crypto.PrivKey
proposerKey signer.Signer

// daHeight is the height of the latest processed DA block
daHeight uint64
Expand Down Expand Up @@ -221,7 +221,7 @@ func getInitialState(ctx context.Context, genesis genesis.Genesis, store store.S
// NewManager creates new block Manager.
func NewManager(
ctx context.Context,
proposerKey crypto.PrivKey,
proposerKey signer.Signer,
config config.Config,
genesis genesis.Genesis,
store store.Store,
Expand Down Expand Up @@ -395,7 +395,7 @@ func (m *Manager) SetDALC(dalc coreda.Client) {
}

// isProposer returns whether or not the manager is a proposer
func isProposer(_ crypto.PrivKey, _ types.State) (bool, error) {
func isProposer(_ signer.Signer, _ types.State) (bool, error) {
return true, nil
}

Expand Down Expand Up @@ -1464,6 +1464,10 @@ func (m *Manager) execCommit(ctx context.Context, newState types.State, h *types
func (m *Manager) execCreateBlock(_ context.Context, height uint64, lastSignature *types.Signature, lastHeaderHash types.Hash, lastState types.State, batchData *BatchData) (*types.SignedHeader, *types.Data, error) {
data := batchData.Data
batchdata := convertBatchDataToBytes(data)
key, err := m.proposerKey.GetPublic()
if err != nil {
return nil, nil, err
}
header := &types.SignedHeader{
Header: types.Header{
Version: types.Version{
Expand All @@ -1483,7 +1487,7 @@ func (m *Manager) execCreateBlock(_ context.Context, height uint64, lastSignatur
},
Signature: *lastSignature,
Signer: types.Signer{
PubKey: m.proposerKey.GetPublic(),
PubKey: key,
Address: m.genesis.ProposerAddress(),
},
}
Expand Down
25 changes: 16 additions & 9 deletions block/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"github.com/rollkit/rollkit/pkg/config"
genesispkg "github.com/rollkit/rollkit/pkg/genesis"
"github.com/rollkit/rollkit/pkg/queue"
"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"
"github.com/rollkit/rollkit/types"
Expand Down Expand Up @@ -173,21 +175,24 @@ func TestSignVerifySignature(t *testing.T) {
require := require.New(t)
m := getManager(t, coreda.NewDummyDA(100_000, 0, 0), -1, -1)
payload := []byte("test")
privKey, pubKey, err := crypto.GenerateKeyPair(crypto.Ed25519, 256)
privKey, _, err := crypto.GenerateKeyPair(crypto.Ed25519, 256)
require.NoError(err)
noopSigner, err := noopsigner.NewNoopSigner(privKey)
require.NoError(err)
cases := []struct {
name string
privKey crypto.PrivKey
pubKey crypto.PubKey
name string
signer signer.Signer
}{
{"ed25519", privKey, pubKey},
{"ed25519", noopSigner},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
m.proposerKey = c.privKey
m.proposerKey = c.signer
signature, err := m.proposerKey.Sign(payload)
require.NoError(err)
ok, err := c.pubKey.Verify(payload, signature)
pubKey, err := c.signer.GetPublic()
require.NoError(err)
ok, err := pubKey.Verify(payload, signature)
require.NoError(err)
require.True(ok)
})
Expand Down Expand Up @@ -358,7 +363,7 @@ func Test_isProposer(t *testing.T) {

type args struct {
state types.State
signerPrivKey crypto.PrivKey
signerPrivKey signer.Signer
}
tests := []struct {
name string
Expand All @@ -372,9 +377,11 @@ func Test_isProposer(t *testing.T) {
genesisData, privKey, _ := types.GetGenesisWithPrivkey("Test_isProposer")
s, err := types.NewFromGenesisDoc(genesisData)
require.NoError(err)
signer, err := noopsigner.NewNoopSigner(privKey)
require.NoError(err)
return args{
s,
privKey,
signer,
}
}(),
isProposer: true,
Expand Down
8 changes: 3 additions & 5 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: v2

# The plugins to run.

plugins:
# The name of the plugin.
- remote: buf.build/protocolbuffers/go
# The relative output directory.
out: types/pb
# Any options to provide to the plugin.
opt: paths=source_relative

- remote: buf.build/connectrpc/go
out: types/pb
opt: paths=source_relative
inputs:
- directory: proto
8 changes: 3 additions & 5 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
version: v1beta1
version: v2

build:
roots:
- proto
- third_party/proto
modules:
- path: proto
lint:
use:
- COMMENTS
Expand Down
38 changes: 5 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ require (
cosmossdk.io/log v1.5.0
github.com/celestiaorg/go-header v0.6.4
github.com/celestiaorg/utils v0.1.0
github.com/cometbft/cometbft v0.38.15
github.com/cosmos/gogoproto v1.7.0
github.com/go-kit/kit v0.13.0
github.com/goccy/go-yaml v1.16.0
github.com/gogo/protobuf v1.3.2
github.com/ipfs/go-datastore v0.7.0
github.com/ipfs/go-ds-badger4 v0.1.5
github.com/libp2p/go-libp2p v0.40.0
Expand All @@ -34,13 +33,13 @@ require (
github.com/spf13/pflag v1.0.6
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
golang.org/x/crypto v0.33.0
golang.org/x/net v0.35.0
google.golang.org/grpc v1.70.0
google.golang.org/protobuf v1.36.5
)

require (
github.com/DataDog/zstd v1.4.5 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.12.3 // indirect
Expand All @@ -49,41 +48,26 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.1 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.14.1 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cosmos/gogoproto v1.7.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.6 // 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/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dgraph-io/badger/v4 v4.5.1 // indirect
github.com/dgraph-io/ristretto/v2 v2.1.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // 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/getsentry/sentry-go v0.27.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.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/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang/glog v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v24.12.23+incompatible // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gopacket v1.1.19 // indirect
Expand All @@ -106,12 +90,9 @@ require (
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/koron/go-ssdp v0.0.5 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // 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
Expand All @@ -124,7 +105,6 @@ require (
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/linxGnu/grocksdb v1.8.14 // 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.13 // indirect
Expand All @@ -144,13 +124,11 @@ require (
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/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae // indirect
github.com/onsi/ginkgo/v2 v2.22.2 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // 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/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // 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.4 // indirect
Expand Down Expand Up @@ -180,23 +158,18 @@ require (
github.com/quic-go/quic-go v0.50.0 // 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/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // 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/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // 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.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
Expand All @@ -208,7 +181,6 @@ require (
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/crypto v0.33.0 // indirect
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
Expand Down
Loading
Loading