
davidherranandClaude Opus 4.7
7c1425ff66
feat(governance): v0.0.30 — submit_proposal + cast_vote + finalize_proposal impl complete + mock runtime integration tests E2E (10 scenarios)
Phase 5.1 GOVERNANCE pallet REAL IMPL canonical. Full dispatchables canonical
7+6+5 step CHN-4 flow + storage assertions + tally + voting period enforcement
+ mock runtime + 10 integration tests E2E pattern v0.0.26 mirror.
## Real dispatchables canonical
- submit_proposal (7 steps): ensure_signed + stake>=MIN + derive_id BLAKE2-256 + collision + build + insert + emit
- cast_vote (6 steps): ensure_signed + get_proposal + status_voting + block<=end + !already_voted + update_tally + emit
- finalize_proposal (5 steps): ensure_signed + get_proposal + status_voting + block>end + tally + status + emit
## Mock runtime + 10 integration tests E2E canonical
- scenario_1: Submit happy path → stored + event
- scenario_2: Stake insufficient → StakeInsufficient (CHN-4 5.3)
- scenario_3: Vote Aye tally → yes_weight += 500
- scenario_4: Vote Nay tally → nay_weight += 750
- scenario_5: Double vote → AlreadyVoted
- scenario_6: Finalize voting open → VotingPeriodOpen
- scenario_7: Finalize Approved yes majority → status=Approved + event
- scenario_8: Finalize Rejected nay majority → status=Rejected
- scenario_9: Vote closed period → VotingPeriodClosed
- scenario_10: Full lifecycle (submit → 3 votes → finalize Approved)
## Files
- EDIT: crates/origin-chain-governance/src/lib.rs (real impl + MIN_PROPOSAL_STAKE + account_bytes helper)
- NEW: crates/origin-chain-governance/src/mock.rs (85 LOC mock runtime)
- NEW: crates/origin-chain-governance/src/tests_integration.rs (290 LOC, 10 tests)
- EDIT: CHANGELOG.md (v0.0.30 entry)
## Verification
- cargo test -p origin-chain-governance — 17 tests verde, 0 failures
(10 integration + 5 standalone + 2 auto-generated)
🛠️ Phase 5.1 real impl canonical. Runtime API v0.0.31 next → Phase 5 FOUNDATION COMPLETE.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>