Skip to content

Backport giga-1: Add Giga fetch/serve and BlockDB prune metrics (CON-438) - #4331

Merged
masih merged 1 commit into
giga-1from
backport-4329-to-giga-1
Sep 25, 2026
Merged

masih merged 1 commit into
giga-1from
backport-4329-to-giga-1

Conversation

@seidroid

@seidroid seidroid Bot commented Sep 24, 2026

Copy link
Copy Markdown

Backport of #4329 to giga-1.

## Summary
- Add `tendermint_autobahn_blockstore_prune_watermark` at the BlockDB
prune choke point (actual floor after clamp, seeded on open).
- Add `tendermint_p2p_giga_fetch{resource,reason}` for GetBlock,
FullCommitQC, AppQC, CommitQC, and lane-proposal client paths (`ok`,
`unavailable`, `open_stream`, `send`, `receive`, `decode`, `process`,
`wrong_lane`).
- Add `tendermint_p2p_giga_serve{resource,reason}` on GetBlock
empty/error replies (`pruned`, `not_found`, `store_error`) so a lagging
node's `unavailable` can be joined with a tip node's `pruned`.

## Test plan
- [x] `GOWORK=off go test --count=0 ./sei-tendermint/autobahn/blockstore
./sei-tendermint/internal/p2p/giga
./sei-tendermint/internal/autobahn/data`
- [x] `scripts/ramtest.sh ./sei-tendermint/autobahn/blockstore/...
./sei-tendermint/internal/p2p/giga/...
./sei-tendermint/internal/autobahn/data/...`
- [x] On a giga testnet node, scrape Prometheus and confirm
`prune_watermark`, `fetch`, and `serve` series appear; compare a lagging
node's `fetch{resource="block",reason="unavailable"}` with a tip node's
`serve{resource="block",reason="pruned"}` and
`next_block{stage="receive"}`.

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit b9f0e8f)
@cursor

cursor Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Observability-only changes (metric registration and counters); P2P and prune behavior is unchanged aside from labeling pruned vs not-found on block serve.

Overview
Adds Prometheus observability for autobahn block retention and giga P2P sync, following the existing metricsgen pattern.

Blockstore: exposes tendermint_autobahn_blockstore_prune_watermark and updates it when the store opens and after PruneBefore, so operators can see the lowest retained global block. Prune tests assert the gauge matches the clamped floor.

Giga P2P: adds tendermint_p2p_giga_fetch and tendermint_p2p_giga_serve counters labeled by resource (block, full commit QC, app QC, commit QC, lane proposal) and reason (e.g. ok, unavailable, pruned, not_found, stream/decode/process failures). Client streaming and GetBlock paths are instrumented; GetBlock serve now records distinct reasons for pruned vs not-found empty responses. Integration tests check that fetch/serve counters move during replication.

Reviewed by Cursor Bugbot for commit 5d95f77. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedSep 24, 2026, 11:49 PM

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a clean backport of #4329 to giga-1. It adds counters for Giga fetch and serve outcomes, plus a BlockDB prune-watermark gauge. The dependencies it uses (utils.Clamp, BlockDB.GetPruneWatermark, the tmprometheus vec types) exist on this branch. The instrumentation leaves control flow unchanged and has test coverage; I found nothing to block the merge.

Findings: 0 blocking | 0 non-blocking | 0 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • None at the file/PR level.

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.33333% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.32%. Comparing base (7e3ca24) to head (5d95f77).
⚠️ Report is 51 commits behind head on giga-1.

Files with missing lines Patch % Lines
sei-tendermint/internal/p2p/giga/data.go 46.15% 14 Missing ⚠️
sei-tendermint/internal/p2p/giga/avail.go 30.76% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           giga-1    #4331       +/-   ##
===========================================
+ Coverage   65.55%   79.32%   +13.76%     
===========================================
  Files        2081       12     -2069     
  Lines      157460      827   -156633     
===========================================
- Hits       103222      656   -102566     
+ Misses      54097      171    -53926     
+ Partials      141        0      -141     
Flag Coverage Δ
sei-chain ?
sei-chain-pr 79.32% <69.33%> (?)
sei-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-tendermint/autobahn/blockstore/metrics.gen.go 100.00% <100.00%> (ø)
sei-tendermint/autobahn/blockstore/store.go 87.50% <100.00%> (+0.10%) ⬆️
sei-tendermint/internal/p2p/giga/metrics.gen.go 100.00% <100.00%> (ø)
sei-tendermint/internal/p2p/giga/metrics.go 100.00% <100.00%> (ø)
sei-tendermint/internal/p2p/giga/avail.go 69.79% <30.76%> (-7.41%) ⬇️
sei-tendermint/internal/p2p/giga/data.go 71.15% <46.15%> (-5.95%) ⬇️

... and 2071 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@masih

masih commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

What is in giga-1 that's not on main which makes us wnat to backport this @wen-coding @philipsu522 ?

@wen-coding

Copy link
Copy Markdown
Contributor

What is in giga-1 that's not on main which makes us wnat to backport this @wen-coding @philipsu522 ?

All the panic fixes? Without them the giga testnet will die. I have a plan to replace the evmonly cursor persistence with #4306, but it has a dependency on #4341, so I'm fine if we just persist the cursors for now.

@masih

masih commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

All the panic fixes? Without them the giga testnet will die. I have a plan to replace the evmonly cursor persistence with #4306, but it has a dependency on #4341, so I'm fine if we just persist the cursors for now.

All good discussed in DM, happy to land anything in giga-1 as long as it is a backport from main 🙌

@masih
masih added this pull request to the merge queue Sep 25, 2026
Merged via the queue into giga-1 with commit 9bfc0d6 Sep 25, 2026
65 of 66 checks passed
@masih
masih deleted the backport-4329-to-giga-1 branch September 25, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants