Skip to content

Commit f95df8e

Browse files
committed
pass the p2pclient instead of the key
1 parent d5e2a50 commit f95df8e

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

go.mod

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ module github.com/rollkit/go-execution-abci
22

33
go 1.23.3
44

5+
toolchain go1.24.1
6+
57
require (
68
github.com/celestiaorg/go-header v0.6.4
79
github.com/cosmos/cosmos-sdk v0.50.12
810
github.com/gorilla/rpc v1.2.1
9-
github.com/ipfs/go-datastore v0.7.0
10-
github.com/rollkit/go-execution v0.2.3
1111
github.com/rollkit/go-sequencing v0.4.1
1212
github.com/rollkit/rollkit/core v0.0.0-00010101000000-000000000000
1313
)
@@ -51,6 +51,7 @@ require (
5151
github.com/huandu/skiplist v1.2.0 // indirect
5252
github.com/huin/goupnp v1.3.0 // indirect
5353
github.com/ipfs/boxo v0.27.4 // indirect
54+
github.com/ipfs/go-datastore v0.7.0 // indirect
5455
github.com/ipfs/go-ds-badger4 v0.1.5 // indirect
5556
github.com/ipfs/go-log v1.0.5 // indirect
5657
github.com/ipld/go-ipld-prime v0.21.0 // indirect
@@ -107,6 +108,7 @@ require (
107108
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 // indirect
108109
github.com/raulk/go-watchdog v1.3.0 // indirect
109110
github.com/rollkit/go-da v0.9.0 // indirect
111+
github.com/rollkit/go-execution v0.2.3 // indirect
110112
github.com/stretchr/objx v0.5.2 // indirect
111113
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
112114
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
@@ -285,5 +287,6 @@ require (
285287
replace (
286288
github.com/rollkit/rollkit => ../rollkit
287289
github.com/rollkit/rollkit/core => ../rollkit/core
290+
github.com/rollkit/rollkit/da => ../rollkit/da
288291
github.com/rollkit/rollkit/p2p => ../rollkit/p2p
289292
)

server/start.go

+16-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88

99
cmtcfg "github.com/cometbft/cometbft/config"
10-
"github.com/cometbft/cometbft/p2p"
10+
cmtp2p "github.com/cometbft/cometbft/p2p"
1111
pvm "github.com/cometbft/cometbft/privval"
1212
"github.com/cosmos/cosmos-sdk/client"
1313
"github.com/cosmos/cosmos-sdk/codec"
@@ -20,6 +20,7 @@ import (
2020
"github.com/cosmos/cosmos-sdk/version"
2121
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
2222
"github.com/hashicorp/go-metrics"
23+
"github.com/rollkit/rollkit/p2p"
2324
"golang.org/x/sync/errgroup"
2425
"google.golang.org/grpc"
2526
"google.golang.org/grpc/credentials/insecure"
@@ -242,7 +243,7 @@ func startNode(
242243
app sdktypes.Application,
243244
svrCtx *server.Context,
244245
) (rolllkitNode node.Node, cleanupFn func(), err error) {
245-
nodeKey, err := p2p.LoadOrGenNodeKey(cfg.NodeKeyFile())
246+
nodeKey, err := cmtp2p.LoadOrGenNodeKey(cfg.NodeKeyFile())
246247
if err != nil {
247248
return nil, cleanupFn, err
248249
}
@@ -257,7 +258,7 @@ func startNode(
257258
return nil, cleanupFn, err
258259
}
259260

260-
signingKey, err := types.GetNodeKey(&p2p.NodeKey{PrivKey: pval.Key.PrivKey})
261+
signingKey, err := types.GetNodeKey(&cmtp2p.NodeKey{PrivKey: pval.Key.PrivKey})
261262
if err != nil {
262263
return nil, cleanupFn, err
263264
}
@@ -294,27 +295,34 @@ func startNode(
294295
return nil, cleanupFn, err
295296
}
296297

298+
metrics := node.DefaultMetricsProvider(cmtcfg.DefaultInstrumentationConfig())
299+
300+
_, p2pMetrics := metrics(cmtGenDoc.ChainID)
301+
p2pClient, err := p2p.NewClient(nodeConfig.P2P, p2pKey, cmtGenDoc.ChainID, database, svrCtx.Logger.With("module", "p2p"), p2pMetrics)
302+
if err != nil {
303+
return nil, cleanupFn, err
304+
}
305+
297306
executor := adapter.NewABCIExecutor(
298307
app,
299308
store.New(database),
300-
nil,
309+
p2pClient,
301310
svrCtx.Logger,
302311
cfg,
303-
appGenesis, // pass AppGenesis to the executor
312+
appGenesis,
304313
)
314+
305315
ctxWithCancel, cancelFn := context.WithCancel(ctx)
306316
cleanupFn = func() {
307317
cancelFn()
308318
}
309319

310-
metrics := node.DefaultMetricsProvider(cmtcfg.DefaultInstrumentationConfig())
311-
312320
rolllkitNode, err = node.NewNode(
313321
ctxWithCancel,
314322
nodeConfig,
315323
executor,
316324
node.NewDummySequencer(),
317-
p2pKey,
325+
p2pClient,
318326
signingKey,
319327
cmtGenDoc,
320328
database,

0 commit comments

Comments
 (0)