feat(statistics): assurances before rollover + 3-tuple accumulation stats + C(13) prefixes (GP v0.8.0) (#1021)#1034
Conversation
yu2C
left a comment
There was a problem hiding this comment.
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.
…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).
|
Thanks @yu2C — both applied (
Also resolved the conflict against the base (#1033's review follow-up touched the same test file); the branch is green ( |
… 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.
63dabfd to
a472da8
Compare
|
Rebased onto the integrated base per the plan on #1042: the PR is now a single commit ( |
Part of #1012 · Closes #1021
What — three v0.8.0 changes
(N(s), T(s), G(s)):T(s)counts processed transfers per destination service (from #1033'seq:accseq5th output). Transfer-only services enter the key domain;(0,0,0)entries drop. Wire:ServiceActivityRecordgainsaccumulate_transfers_countbetween count and gaseq:accumulationstatisticsdef/specAlready aligned: vector sizing to |κ|/|λ| (hard-validated to
ValidatorsCount; offenders zeroed in place),update_statistics.goSTF 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 dropTestEncodeValidatorsStatistics_V080LengthPrefix(new) — prefix + round-tripstatistics,accumulation,types,extrinsic,jam_typesgreen; build/vet/gofmt cleanvalidate_fuzz.shstatistics expectation moves 1/2 → 0/0 while the mode is skipped — restore with official v0.8.0 vectors (Update to v0.8.0 #1012)