Skip to content

Commit 5819a12

Browse files
renaynayGanesha Upadhyaya
andauthored
chore(deps): Bumps go-header and openrpc (#1256)
Co-authored-by: Ganesha Upadhyaya <gupadhyaya@Ganeshas-MacBook-Pro-2.local>
1 parent c984734 commit 5819a12

6 files changed

Lines changed: 47 additions & 18 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ proto/tendermint
44
types/pb/tendermint
55
.vscode/launch.json
66
*/**.html
7+
*.idea

block/block-manager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ See [tutorial] for running a multi-node network with both sequencer and non-sequ
174174
[defaultDABlockTime]: https://github.com/rollkit/rollkit/blob/main/block/manager.go#L32
175175
[initialBackoff]: https://github.com/rollkit/rollkit/blob/main/block/manager.go#L48
176176
[go-header]: https://github.com/celestiaorg/go-header
177-
[block-sync]: https://github.com/rollkit/rollkit/blob/main/node/block_sync.go
177+
[block-sync]: https://github.com/rollkit/rollkit/blob/main/block/block_sync.go
178178
[full-node]: https://github.com/rollkit/rollkit/blob/main/node/full.go
179179
[block-manager]: https://github.com/rollkit/rollkit/blob/main/block/manager.go
180180
[tutorial]: https://rollkit.dev/tutorials/full-and-sequencer-node#getting-started

block/block_sync.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,22 @@ func (bSyncService *BlockSyncService) isInitialized() bool {
115115
return bSyncService.blockStore.Height() > 0
116116
}
117117

118-
// OnStart is a part of Service interface.
118+
// Start is a part of Service interface.
119119
func (bSyncService *BlockSyncService) Start() error {
120120
// have to do the initializations here to utilize the p2p node which is created on start
121121
ps := bSyncService.p2p.PubSub()
122122
chainIDBlock := bSyncService.genesis.ChainID + "-block"
123-
bSyncService.sub = goheaderp2p.NewSubscriber[*types.Block](ps, pubsub.DefaultMsgIdFn, chainIDBlock)
123+
124+
var err error
125+
bSyncService.sub, err = goheaderp2p.NewSubscriber[*types.Block](
126+
ps,
127+
pubsub.DefaultMsgIdFn,
128+
goheaderp2p.WithSubscriberNetworkID(chainIDBlock),
129+
)
130+
if err != nil {
131+
return err
132+
}
133+
124134
if err := bSyncService.sub.Start(bSyncService.ctx); err != nil {
125135
return fmt.Errorf("error while starting subscriber: %w", err)
126136
}
@@ -132,7 +142,6 @@ func (bSyncService *BlockSyncService) Start() error {
132142
return fmt.Errorf("error while starting block store: %w", err)
133143
}
134144

135-
var err error
136145
_, _, network, err := bSyncService.p2p.Info()
137146
if err != nil {
138147
return fmt.Errorf("error while fetching the network: %w", err)
@@ -154,7 +163,12 @@ func (bSyncService *BlockSyncService) Start() error {
154163
return fmt.Errorf("error while starting exchange: %w", err)
155164
}
156165

157-
if bSyncService.syncer, err = newBlockSyncer(bSyncService.ex, bSyncService.blockStore, bSyncService.sub, goheadersync.WithBlockTime(bSyncService.conf.BlockTime)); err != nil {
166+
if bSyncService.syncer, err = newBlockSyncer(
167+
bSyncService.ex,
168+
bSyncService.blockStore,
169+
bSyncService.sub,
170+
[]goheadersync.Option{goheadersync.WithBlockTime(bSyncService.conf.BlockTime)},
171+
); err != nil {
158172
return fmt.Errorf("error while creating syncer: %w", err)
159173
}
160174

@@ -235,9 +249,9 @@ func newBlockSyncer(
235249
ex header.Exchange[*types.Block],
236250
store header.Store[*types.Block],
237251
sub header.Subscriber[*types.Block],
238-
opt goheadersync.Options,
252+
opts []goheadersync.Option,
239253
) (*goheadersync.Syncer[*types.Block], error) {
240-
return goheadersync.NewSyncer[*types.Block](ex, store, sub, opt)
254+
return goheadersync.NewSyncer[*types.Block](ex, store, sub, opts...)
241255
}
242256

243257
func (bSyncService *BlockSyncService) StartSyncer() error {

block/header_sync.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,17 @@ func (hSyncService *HeaderSynceService) isInitialized() bool {
119119
func (hSyncService *HeaderSynceService) Start() error {
120120
// have to do the initializations here to utilize the p2p node which is created on start
121121
ps := hSyncService.p2p.PubSub()
122-
hSyncService.sub = goheaderp2p.NewSubscriber[*types.SignedHeader](ps, pubsub.DefaultMsgIdFn, hSyncService.genesis.ChainID)
122+
123+
var err error
124+
hSyncService.sub, err = goheaderp2p.NewSubscriber[*types.SignedHeader](
125+
ps,
126+
pubsub.DefaultMsgIdFn,
127+
goheaderp2p.WithSubscriberNetworkID(hSyncService.genesis.ChainID),
128+
)
129+
if err != nil {
130+
return err
131+
}
132+
123133
if err := hSyncService.sub.Start(hSyncService.ctx); err != nil {
124134
return fmt.Errorf("error while starting subscriber: %w", err)
125135
}
@@ -131,7 +141,6 @@ func (hSyncService *HeaderSynceService) Start() error {
131141
return fmt.Errorf("error while starting header store: %w", err)
132142
}
133143

134-
var err error
135144
_, _, network, err := hSyncService.p2p.Info()
136145
if err != nil {
137146
return fmt.Errorf("error while fetching the network: %w", err)
@@ -151,7 +160,12 @@ func (hSyncService *HeaderSynceService) Start() error {
151160
return fmt.Errorf("error while starting exchange: %w", err)
152161
}
153162

154-
if hSyncService.syncer, err = newSyncer(hSyncService.ex, hSyncService.headerStore, hSyncService.sub, goheadersync.WithBlockTime(hSyncService.conf.BlockTime)); err != nil {
163+
if hSyncService.syncer, err = newSyncer(
164+
hSyncService.ex,
165+
hSyncService.headerStore,
166+
hSyncService.sub,
167+
[]goheadersync.Option{goheadersync.WithBlockTime(hSyncService.conf.BlockTime)},
168+
); err != nil {
155169
return fmt.Errorf("error while creating syncer: %w", err)
156170
}
157171

@@ -234,9 +248,9 @@ func newSyncer(
234248
ex header.Exchange[*types.SignedHeader],
235249
store header.Store[*types.SignedHeader],
236250
sub header.Subscriber[*types.SignedHeader],
237-
opt goheadersync.Options,
251+
opts []goheadersync.Option,
238252
) (*goheadersync.Syncer[*types.SignedHeader], error) {
239-
return goheadersync.NewSyncer[*types.SignedHeader](ex, store, sub, opt)
253+
return goheadersync.NewSyncer[*types.SignedHeader](ex, store, sub, opts...)
240254
}
241255

242256
func (hSyncService *HeaderSynceService) StartSyncer() error {

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/rollkit/rollkit
33
go 1.20
44

55
require (
6-
github.com/celestiaorg/go-header v0.3.3
6+
github.com/celestiaorg/go-header v0.4.0
77
github.com/celestiaorg/nmt v0.20.0
88
github.com/celestiaorg/rsmt2d v0.11.0
99
github.com/celestiaorg/utils v0.1.0
@@ -23,7 +23,7 @@ require (
2323
github.com/libp2p/go-libp2p-pubsub v0.9.3
2424
github.com/multiformats/go-multiaddr v0.11.0
2525
github.com/prometheus/client_golang v1.17.0
26-
github.com/rollkit/celestia-openrpc v0.2.0
26+
github.com/rollkit/celestia-openrpc v0.3.0
2727
github.com/rs/cors v1.10.1
2828
github.com/spf13/cobra v1.7.0
2929
github.com/spf13/viper v1.17.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n
192192
github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg=
193193
github.com/celestiaorg/go-fraud v0.2.0 h1:aaq2JiW0gTnhEdac3l51UCqSyJ4+VjFGTTpN83V4q7I=
194194
github.com/celestiaorg/go-fraud v0.2.0/go.mod h1:lNY1i4K6kUeeE60Z2VK8WXd+qXb8KRzfBhvwPkK6aUc=
195-
github.com/celestiaorg/go-header v0.3.3 h1:Y04hdJIJfD5hapyqK0ZQMgMTH5PQGV9YpcIf56LGc4E=
196-
github.com/celestiaorg/go-header v0.3.3/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c=
195+
github.com/celestiaorg/go-header v0.4.0 h1:Ine/xpvFx8o9p6fXW+h2RSPp68rn7VUxTkW1okJxcEY=
196+
github.com/celestiaorg/go-header v0.4.0/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c=
197197
github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao=
198198
github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo=
199199
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc=
@@ -1351,8 +1351,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
13511351
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
13521352
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
13531353
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
1354-
github.com/rollkit/celestia-openrpc v0.2.0 h1:miSxBgiKtDBZk0dUgreAMubIPXU/Qtf9Q36+E7yZdeE=
1355-
github.com/rollkit/celestia-openrpc v0.2.0/go.mod h1:0fNIcIMbG0ZceCoh4tINNhuzhmebUMDV0cJqZboe/wg=
1354+
github.com/rollkit/celestia-openrpc v0.3.0 h1:jMLsdLNQ7T20yiNDlisBhlyurFOpN1gZ6vC068FPrQA=
1355+
github.com/rollkit/celestia-openrpc v0.3.0/go.mod h1:2ZhU01YF2hsHIROWzxfMZOYM09Kgyy4roH5JWoNJzp0=
13561356
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
13571357
github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
13581358
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=

0 commit comments

Comments
 (0)