Skip to content

feat(statistics): assurances before rollover + 3-tuple accumulation stats + C(13) prefixes (GP v0.8.0) (#1021)#1034

Merged
YCC3741 merged 1 commit into
1012-update-to-v080from
feat/statistics-1021-v080
Jul 15, 2026
Merged

feat(statistics): assurances before rollover + 3-tuple accumulation stats + C(13) prefixes (GP v0.8.0) (#1021)#1034
YCC3741 merged 1 commit into
1012-update-to-v080from
feat/statistics-1021-v080

Conversation

@HanaYukii

@HanaYukii HanaYukii commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ Behavioural + state-root change

Not a pure notation refactor. Assurances are now credited before the epoch rollover — this changes validator-statistics values on epoch-boundary blocks — and the per-service accumulation stat becomes a 3-tuple, which changes the statistics state bytes (state root). Please review the ordering and the wire shape, not just the length prefix.

Part of #1012 · Closes #1021

Stacked on #1033 (← #1032#1031#1027#1026). Base is feat/accumulation-1019-accseq-v080 (this PR consumes its processed-transfers output); review only this commit. Retarget as the stack merges.

What — three v0.8.0 changes

# change GP ref
1 Assurance ordering (behavioural): assurances credit π_V† before the epoch rollover — on an epoch-boundary block they roll into π_L′, not the fresh accumulator. Other five counters stay post-rollover statistics.tex activity-spec restructure
2 Accumulation stats become 3-tuples (N(s), T(s), G(s)): T(s) counts processed transfers per destination service (from #1033's eq:accseq 5th output). Transfer-only services enter the key domain; (0,0,0) entries drop. Wire: ServiceActivityRecord gains accumulate_transfers_count between count and gas eq:accumulationstatisticsdef/spec
3 C(13): π_V / π_L become var length-prefixed sequences (decode still validates count = |κ|) merklization.tex C(13)

Already aligned: vector sizing to |κ|/|λ| (hard-validated to ValidatorsCount; offenders zeroed in place), update_statistics.go STF wiring.

Tested

  • TestValidatorStats_AssurancesBeforeEpochRollover (new) — epoch-boundary: assurance lands in π_L′, fresh π_V′ stays 0; same-epoch: lands in π_V′
  • TestCalculateAccumulationStatistics_V080Transfers (new) — T counting, transfer-only service inclusion, zero-tuple drop
  • TestEncodeValidatorsStatistics_V080LengthPrefix (new) — prefix + round-trip
  • statistics, accumulation, types, extrinsic, jam_types green; build/vet/gofmt clean
  • ⏭️ statistics + preimages STF modes skipped (preimages vectors carry π_S in state, hit by the 3-tuple change); matching unit vector tests skipped. validate_fuzz.sh statistics expectation moves 1/2 → 0/0 while the mode is skipped — restore with official v0.8.0 vectors (Update to v0.8.0 #1012)

@yu2C yu2C left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

Solid v0.8.0 statistics alignment. The three behavioural/wire changes are implemented consistently: assurances credit π_V† before epoch rollover (with a focused boundary test), accumulation stats become (N, T, G) 3-tuples wired through accumulation → statistics → codec, and π_V/π_L gain C(13) var length prefixes. Vector skips and validate_fuzz.sh expectation updates match the rest of the v0.8.0 stack.

One housekeeping follow-up: fold the new behavioural test into statistics_test.go instead of a separate statistics_v080_test.go.


Issue Verification

Test Status Evidence
go test ./internal/statistics/... -count=1 PASS exit 0; TestValidatorStats_AssurancesBeforeEpochRollover passes; vector tests skipped
TestCalculateAccumulationStatistics_V080Transfers PASS go test ./internal/accumulation/... -run V080 exit 0
TestEncodeValidatorsStatistics_V080LengthPrefix PASS go test ./internal/types/... -run ValidatorsStatistics exit 0
Statistics / preimages STF vectors SKIPPED pending official v0.8.0 vectors (#1012)

Linked issues: #1021 (Closes), #1012 (Part of)


internal/statistics/statistics_v080_test.go

[SUGGESTION] Fold v0.8.0 behavioural test into statistics_test.go

TestValidatorStats_AssurancesBeforeEpochRollover is the only test in this new file. statistics_test.go already owns vector skips and TestMain; please move this test there and delete statistics_v080_test.go to match the pattern used elsewhere in the v0.8.0 stack (codec round-trips stay in internal/types/encode_test.go; package behavioural tests live in the main *_test.go).


internal/accumulation/accseq_v080_test.go

[NIT] Consider moving TestCalculateAccumulationStatistics_V080Transfers to accumulation_test.go

This test exercises calculateAccumulationStatistics (3-tuple / T(s) counting), not accseq prefix length or gas budget. It would read more clearly alongside the other accumulation integration tests. Low priority — behaviour is correct and the test passes.

HanaYukii added a commit that referenced this pull request Jul 15, 2026
…o; relocate stats 3-tuple test (review follow-up, #1021)

Address yu2C's review on #1034:

- TestValidatorStats_AssurancesBeforeEpochRollover moves from the
  standalone statistics_v080_test.go into statistics_test.go (file
  deleted), matching the stack's pattern.
- TestCalculateAccumulationStatistics_V080Transfers moves from
  accseq_v080_test.go to accumulation_test.go next to the other
  accumulation integration tests; the accseq file keeps only the
  eq:accseq prefix/recursion tests (and drops its now-unused
  blockchain import).
@HanaYukii

Copy link
Copy Markdown
Contributor Author

Thanks @yu2C — both applied (63dabfd0):

  • SUGGESTION: TestValidatorStats_AssurancesBeforeEpochRollover folded into statistics_test.go; statistics_v080_test.go deleted.
  • NIT: TestCalculateAccumulationStatistics_V080Transfers relocated to accumulation_test.go next to the other accumulation integration tests — accseq_v080_test.go now holds only the eq:accseq prefix/recursion tests.

Also resolved the conflict against the base (#1033's review follow-up touched the same test file); the branch is green (types / statistics / accumulation / extrinsic) and the PR shows CLEAN again.

… 3-tuple accumulation stats, C(13) prefixes (#1021)

Rebased increment of PR #1034 onto the integrated 1012-update-to-v080
(post-#1042), including the review follow-up.

Three GP v0.8.0 changes:

- Assurance ordering (statistics.tex): assurances are credited to
  pi_V-dagger BEFORE the epoch rollover, so on an epoch-boundary block
  they roll into pi_L' instead of the fresh accumulator. The other five
  counters stay post-rollover. applyAssuranceStatistics replaces
  UpdateAvailabilityStatistics (which ran post-rollover).
- Accumulation statistics (eq:accumulationstatisticsdef/spec): the
  per-service stat becomes the 3-tuple (N(s), T(s), G(s)), with T(s)
  counting processed transfers per destination service (from the
  eq:accseq 5th output). Transfer-only services enter the key domain;
  (0,0,0) entries are dropped. ServiceActivityRecord gains
  AccumulateTransfersCount between count and gas in the wire order.
- Merklization C(13): pi_V / pi_L become var length-prefixed sequences;
  encode emits the prefix, decode validates it equals ValidatorsCount.

Review follow-up (yu2C on #1034): the behavioural test lives in
statistics_test.go and the 3-tuple stats test in accumulation_test.go.

Unit tests: assurance-before-rollover (epoch boundary + same epoch),
accumulation 3-tuple (T counting, transfer-only services, zero-drop),
C(13) prefix round-trip. Statistics + preimages STF modes stay skipped
until official v0.8.0 vectors land (#1012); validate_fuzz.sh statistics
expectation stays 0/0 while skipped.
@HanaYukii
HanaYukii force-pushed the feat/statistics-1021-v080 branch from 63dabfd to a472da8 Compare July 15, 2026 06:59
@HanaYukii
HanaYukii changed the base branch from feat/accumulation-1019-accseq-v080 to 1012-update-to-v080 July 15, 2026 06:59
@HanaYukii

Copy link
Copy Markdown
Contributor Author

Rebased onto the integrated base per the plan on #1042: the PR is now a single commit (a472da8c) directly against 1012-update-to-v080 — no more stacked-base indirection. Increment verified identical to the previously reviewed content (same method as #1042: old-vs-new diff match), and re-tested against the new base including the post-#1042 work (disputes fault fix, guarantee BadErasureShards check): types / statistics / accumulation / extrinsic / work_package / safrole / recent_history / erasure_coding all green, build/vet/gofmt clean. The review follow-up (test relocations) is folded into the commit.

@YCC3741
YCC3741 merged commit 411e961 into 1012-update-to-v080 Jul 15, 2026
@YCC3741
YCC3741 deleted the feat/statistics-1021-v080 branch July 15, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants