Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/consensus/cometbft/light: Only fetch from light store for now #5481

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changelog/5481.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go/consensus/cometbft/light: Only fetch from light store for now

In practice the previously introduced fetch from light client caused
the light client to fall back to slow backwards verification due to
target blocks being in the past, below the pruning window.
14 changes: 5 additions & 9 deletions go/consensus/cometbft/light/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,21 +289,17 @@ func (c *client) GetLightBlock(ctx context.Context, height int64) (*consensus.Li
return lb, rpc.NewNopPeerFeedback(), nil
}

// Light client.
lightClientSource := func() (*consensus.LightBlock, rpc.PeerFeedback, error) {
clb, err := c.lc.GetVerifiedLightBlock(ctx, height)
// Light client store.
lightClientStoreSource := func() (*consensus.LightBlock, rpc.PeerFeedback, error) {
lb, err := c.GetStoredLightBlock(height)
if err != nil {
c.logger.Debug("failed to fetch light block from light client",
c.logger.Debug("failed to fetch light block from light client store",
"err", err,
"height", height,
)
return nil, nil, err
}

lb, err := api.NewLightBlock(clb)
if err != nil {
return nil, nil, err
}
return lb, rpc.NewNopPeerFeedback(), nil
}

Expand All @@ -316,7 +312,7 @@ func (c *client) GetLightBlock(ctx context.Context, height int64) (*consensus.Li
var mergedErr error
for _, src := range []func() (*consensus.LightBlock, rpc.PeerFeedback, error){
localBackendSource,
lightClientSource,
lightClientStoreSource,
directPeerQuerySource,
} {
lb, pf, err := src()
Expand Down
Loading