feat(node): integrate epoch reward processing#2874
Conversation
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
📝 WalkthroughWalkthroughLoad-mode startup now creates a snapshot manager, installs epoch-boundary snapshot capture, and captures the epoch-0 genesis snapshot before replay. Genesis snapshot errors use shared block-producer and relay handling. Tests cover hook wiring, error behavior, and the Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/node/load_test.go (1)
507-524: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the relay warning, not only the nil error.
This test passes if snapshot failures are silently swallowed. Capture the logger output and assert the warning message.
Proposed test improvement
func TestCaptureLoadGenesisSnapshot_RelayWarnsAndContinues(t *testing.T) { db := newTestDB(t) - logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + var logs bytes.Buffer + logger := slog.New(slog.NewTextHandler(&logs, nil)) mgr := snapshot.NewManager(db, nil, logger) require.NoError(t, db.Close()) err := captureLoadGenesisSnapshot( context.Background(), mgr, &config.Config{BlockProducer: false}, logger, ) require.NoError(t, err) + require.Contains(t, logs.String(), "failed to capture genesis snapshot") }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/node/load_test.go` around lines 507 - 524, Update TestCaptureLoadGenesisSnapshot_RelayWarnsAndContinues to capture logger output instead of discarding it, then assert that the relay failure path emits the expected warning message while retaining the existing require.NoError assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/node/load_test.go`:
- Around line 507-524: Update
TestCaptureLoadGenesisSnapshot_RelayWarnsAndContinues to capture logger output
instead of discarding it, then assert that the relay failure path emits the
expected warning message while retaining the existing require.NoError assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 694b0bd3-73dc-44fb-9753-071aecc23881
📒 Files selected for processing (4)
internal/node/load.gointernal/node/load_test.goledgerstate/import.gonode_forging.go
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Summary by cubic
Integrates epoch reward processing by capturing genesis and epoch-boundary snapshots during
dingo load, surfacing any capture failures, and rebuilding live stake with progress so the first reward round runs on time. Addresses #1959 by seeding the epoch-0 mark snapshot duringdingo loadto prevent skipped rewards on devnets.New Features
dingo loadafterls.Start; fatal for block producers, warn for relays viasnapshot.HandleGenesisSnapshotError.snapshot.Manager; record failures and fail load after replay to avoid missing mark/reward snapshots.ledgerstate.ImportLedgerStatewith progress reporting and a cancellation pre-check.Bug Fixes
RewardSnapshotwhen replaying Shelley-genesis staking so epoch-3 rewards are applied.Written for commit 51bf721. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes