Skip to content

test(grey-state): add proptests for accumulate sub-transition#826

Open
wangzishuai1987 wants to merge 2 commits into
jarchain:masterfrom
wangzishuai1987:test/accumulate-proptest
Open

test(grey-state): add proptests for accumulate sub-transition#826
wangzishuai1987 wants to merge 2 commits into
jarchain:masterfrom
wangzishuai1987:test/accumulate-proptest

Conversation

@wangzishuai1987
Copy link
Copy Markdown

Summary

Adds property-based tests for the accumulate sub-transition's pure functions (Section 12):

decode_preimage_info_timeslots:

  • Roundtrip: encode → decode returns original timeslots
  • No-panic: arbitrary bytes never cause panic

compute_dependencies:

  • No duplicates in dependency set
  • All prerequisites appear in dependencies

partition_reports:

  • Total count invariant: |immediate| + |queued| == |reports|
  • No-dependency reports are always immediate
  • Dependency-bearing reports are always queued

edit_queue:

  • No accumulated entries survive editing
  • No accumulated dependencies survive editing

resolve_queue:

  • Empty queue yields nothing
  • All resolved reports have corresponding records

find_free_service_id:

  • Result is not in the existing accounts map
  • Result is above the S threshold

encode_accumulate_args:

  • Always produces exactly 12 bytes
  • Deterministic encoding

compute_output_hash:

  • Deterministic and order-independent
  • Sensitive to any entry change

Refs: #229

Add property-based tests for the accumulate module's pure functions:
- decode_preimage_info_timeslots: roundtrip and no-panic properties
- compute_dependencies: no duplicates, includes all prerequisites
- partition_reports: total count, no-deps=immediate, with-deps=queued
- edit_queue: no accumulated entries/deps survive editing
- resolve_queue: empty and all-zero-deps properties
- find_free_service_id: result not in accounts, above threshold
- encode_accumulate_args: fixed length and deterministic
- compute_output_hash: deterministic, order-independent, sensitive

Refs: jarchain#229
@github-actions
Copy link
Copy Markdown
Contributor

Genesis Review

Comparison targets:

How to review

Post a comment with the following format (rank from best to worst):

/review
difficulty: <commit1>, <commit2>, ..., <commitN>, currentPR
novelty: <commit1>, <commit2>, ..., <commitN>, currentPR
design: <commit1>, <commit2>, ..., <commitN>, currentPR
verdict: merge

Use the short commit hashes above and currentPR for this PR.
Each line ranks all comparison targets + this PR from best to worst.

To meta-review another reviewer's comment, react with 👍 or 👎.

@johandroid
Copy link
Copy Markdown
Contributor

/review
difficulty: 6d050e3, 835adfe, currentPR, 2bc664b, bf816b6, 84b39d0, b7aa7e8, f2d141e
novelty: 6d050e3, 835adfe, currentPR, 2bc664b, b7aa7e8, bf816b6, 84b39d0, f2d141e
design: 6d050e3, 835adfe, 2bc664b, currentPR, bf816b6, 84b39d0, b7aa7e8, f2d141e
verdict: merge

Adds broad property coverage for accumulate queue/dependency helpers, service ID selection, argument encoding, and output hash determinism/order independence. It ranks below the GRANDPA persistence fix and interpreter dispatch refactor, but above smaller state/type/doc coverage because accumulate has a larger behavioral surface. Merge is reasonable as targeted state-transition test coverage.

@github-actions
Copy link
Copy Markdown
Contributor

JAR Bot: Review recorded from @johandroid (1 reviews, 0 meta-reviews).
Merge weight: 0/37665 (need >50%).

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.

2 participants