Skip to content

Commit 0e137ca

Browse files
auricomclaude
andcommitted
fix(pkg/p2p): replace persistent gater with no-op gater
Stale blocklist entries in the Badger datastore were causing the edennet-2 incident (#3267): fullnodes rejected every binary builder peer, header sync never initialized, and nodes fell back to DA-only sync. Replace the persistent BasicConnectionGater with a no-op variant: - Nil datastore → purely in-memory, nothing survives restart - Removed from libp2p host → no connection-level filtering - Removed setupBlockedPeers / setupAllowedPeers → nothing ever blocks - Instance kept only to satisfy go-header's Exchange API requirement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3421230 commit 0e137ca

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

pkg/p2p/client.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ func NewClient(
8282
metrics *Metrics,
8383
) (*Client, error) {
8484

85-
gater, err := conngater.NewBasicConnectionGater(ds)
85+
// No-op gater: never persists or blocks any peer. The gater instance is kept
86+
// only because go-header's Exchange requires a *conngater.BasicConnectionGater
87+
// parameter. libp2p itself is not given this gater, so no connection is ever
88+
// filtered at the host level either.
89+
gater, err := conngater.NewBasicConnectionGater(nil)
8690
if err != nil {
8791
return nil, fmt.Errorf("failed to create connection gater: %w", err)
8892
}
@@ -156,16 +160,6 @@ func (c *Client) startWithHost(ctx context.Context, h host.Host) error {
156160
c.logger.Info().Str("address", fmt.Sprintf("%s/p2p/%s", a, c.host.ID())).Msg("listening on address")
157161
}
158162

159-
c.logger.Debug().Str("blacklist", c.conf.BlockedPeers).Msg("blocking blacklisted peers")
160-
if err := c.setupBlockedPeers(c.parseAddrInfoList(c.conf.BlockedPeers)); err != nil {
161-
return err
162-
}
163-
164-
c.logger.Debug().Str("whitelist", c.conf.AllowedPeers).Msg("allowing whitelisted peers")
165-
if err := c.setupAllowedPeers(c.parseAddrInfoList(c.conf.AllowedPeers)); err != nil {
166-
return err
167-
}
168-
169163
c.logger.Debug().Msg("setting up gossiping")
170164
if err := c.setupGossiping(ctx); err != nil {
171165
return err
@@ -340,7 +334,7 @@ func (c *Client) listen() (host.Host, error) {
340334
return nil, err
341335
}
342336

343-
return libp2p.New(libp2p.ListenAddrs(maddr), libp2p.Identity(c.privKey), libp2p.ConnectionGater(c.gater))
337+
return libp2p.New(libp2p.ListenAddrs(maddr), libp2p.Identity(c.privKey))
344338
}
345339

346340
func (c *Client) setupDHT(ctx context.Context) error {

0 commit comments

Comments
 (0)