Skip to content

Commit a0b5bd6

Browse files
authored
fix(nodebuilder/share): Revert providing shrex.Getter and its associated components to light node (#1770)
This PR reverts providing shrex-getter and its associated components to light nodes as they are both unnecessary for now and are buggy, causing the following error to occur: light node tries to sample a recent header and fails on the first try with ``` "PT2agmOhBwBuDZu++Vq+LGcATmrI9UZbJKEsvlHKlls=", "err": "getter/shrex: GetShare is not supported; getter/ipld: failed to retrieve share: promise channel was closed", "errCauses": [{"error": "getter/shrex: GetShare is not supported"}, {"error": "getter/ipld: failed to retrieve share: **promise channel was closed**"}]} ``` but succeeds on a second try when the `catchUp` routine inside the DASer samples once again over that height. For now, we will remove this feature (which will only impact the "speed" of the RPC call for requesting data by namespace) and debug it at a later date.
1 parent dd44463 commit a0b5bd6

File tree

2 files changed

+33
-46
lines changed

2 files changed

+33
-46
lines changed

nodebuilder/share/constructors.go

+1-15
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"go.uber.org/fx"
1414

1515
"github.com/celestiaorg/celestia-app/pkg/da"
16+
1617
"github.com/celestiaorg/celestia-node/share"
1718
"github.com/celestiaorg/celestia-node/share/availability/cache"
1819
disc "github.com/celestiaorg/celestia-node/share/availability/discovery"
@@ -60,21 +61,6 @@ func ensureEmptyCARExists(ctx context.Context, store *eds.Store) error {
6061
return err
6162
}
6263

63-
func lightGetter(
64-
shrexGetter *getters.ShrexGetter,
65-
ipldGetter *getters.IPLDGetter,
66-
) share.Getter {
67-
return getters.NewCascadeGetter(
68-
[]share.Getter{
69-
shrexGetter,
70-
ipldGetter,
71-
},
72-
// based on the default value of das.SampleTimeout.
73-
// will no longer be needed when async cascadegetter is merged
74-
time.Minute,
75-
)
76-
}
77-
7864
func fullGetter(
7965
store *eds.Store,
8066
shrexGetter *getters.ShrexGetter,

nodebuilder/share/module.go

+32-31
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/libp2p/go-libp2p/core/host"
88
"go.uber.org/fx"
99

10+
"github.com/celestiaorg/celestia-node/libs/fxutil"
1011
"github.com/celestiaorg/celestia-node/nodebuilder/node"
1112
modp2p "github.com/celestiaorg/celestia-node/nodebuilder/p2p"
1213
"github.com/celestiaorg/celestia-node/share"
@@ -30,36 +31,6 @@ func ConstructModule(tp node.Type, cfg *Config, options ...fx.Option) fx.Option
3031
fx.Options(options...),
3132
fx.Provide(discovery(*cfg)),
3233
fx.Provide(newModule),
33-
fx.Provide(getters.NewIPLDGetter),
34-
fx.Provide(peers.NewManager),
35-
fx.Provide(
36-
func(ctx context.Context, h host.Host, network modp2p.Network) (*shrexsub.PubSub, error) {
37-
return shrexsub.NewPubSub(
38-
ctx,
39-
h,
40-
string(network),
41-
)
42-
},
43-
),
44-
fx.Provide(
45-
func(host host.Host, network modp2p.Network) (*shrexnd.Client, error) {
46-
return shrexnd.NewClient(host, shrexnd.WithProtocolSuffix(string(network)))
47-
},
48-
),
49-
fx.Provide(
50-
func(host host.Host, network modp2p.Network) (*shrexeds.Client, error) {
51-
return shrexeds.NewClient(host, shrexeds.WithProtocolSuffix(string(network)))
52-
},
53-
),
54-
fx.Provide(fx.Annotate(
55-
getters.NewShrexGetter,
56-
fx.OnStart(func(ctx context.Context, getter *getters.ShrexGetter) error {
57-
return getter.Start(ctx)
58-
}),
59-
fx.OnStop(func(ctx context.Context, getter *getters.ShrexGetter) error {
60-
return getter.Stop(ctx)
61-
}),
62-
)),
6334
)
6435

6536
switch tp {
@@ -68,7 +39,7 @@ func ConstructModule(tp node.Type, cfg *Config, options ...fx.Option) fx.Option
6839
"share",
6940
baseComponents,
7041
fx.Invoke(share.EnsureEmptySquareExists),
71-
fx.Provide(lightGetter),
42+
fxutil.ProvideAs(getters.NewIPLDGetter, new(share.Getter)),
7243
// shrexsub broadcaster stub for daser
7344
fx.Provide(func() shrexsub.BroadcastFn {
7445
return func(context.Context, share.DataHash) error {
@@ -144,6 +115,36 @@ func ConstructModule(tp node.Type, cfg *Config, options ...fx.Option) fx.Option
144115
return shrexSub.Broadcast
145116
}),
146117
fx.Provide(fullGetter),
118+
fx.Provide(
119+
func(host host.Host, network modp2p.Network) (*shrexnd.Client, error) {
120+
return shrexnd.NewClient(host, shrexnd.WithProtocolSuffix(string(network)))
121+
},
122+
),
123+
fx.Provide(
124+
func(host host.Host, network modp2p.Network) (*shrexeds.Client, error) {
125+
return shrexeds.NewClient(host, shrexeds.WithProtocolSuffix(string(network)))
126+
},
127+
),
128+
fx.Provide(fx.Annotate(
129+
getters.NewShrexGetter,
130+
fx.OnStart(func(ctx context.Context, getter *getters.ShrexGetter) error {
131+
return getter.Start(ctx)
132+
}),
133+
fx.OnStop(func(ctx context.Context, getter *getters.ShrexGetter) error {
134+
return getter.Stop(ctx)
135+
}),
136+
)),
137+
fx.Provide(
138+
func(ctx context.Context, h host.Host, network modp2p.Network) (*shrexsub.PubSub, error) {
139+
return shrexsub.NewPubSub(
140+
ctx,
141+
h,
142+
string(network),
143+
)
144+
},
145+
),
146+
fx.Provide(peers.NewManager),
147+
fx.Provide(getters.NewIPLDGetter),
147148
)
148149
default:
149150
panic("invalid node type")

0 commit comments

Comments
 (0)