feat(governance): v0.0.28 origin-chain-governance pallet scaffold (Phase 5.1 Foundation Treasury CHN-4)
Phase 5.1 GOVERNANCE pallet scaffold canonical. Reemplaza placeholder GovernanceConfig stub en existing origin-chain-governance crate con real FRAME pallet. AI-Driven Human-Guarded canonical CHN-4 — 5 AI advisor agents ADVISE only, humans-only vote canonical non-negotiable. ## Pallet surface canonical - Pallet<T> + Config trait + RuntimeEvent - Proposal struct (11 fields content-addressed via BLAKE2-256) - ProposalStatus enum (Voting + Approved + Rejected + Withdrawn) - Proposals<StorageMap<ProposalId, Proposal>> per-proposal O(1) - Votes<StorageDoubleMap<ProposalId, AccountId, VoteStance>> double-vote prevention - Events ProposalSubmitted + VoteCast + ProposalFinalized - Errors 8 variants (ProposalNotFound + AlreadyVoted + VotingPeriodClosed/Open + StakeInsufficient + ProposalAlreadyFinalized + AdvisorMayNotVote + ProposalIdCollision) - Scaffold dispatchables submit_proposal + cast_vote + finalize_proposal - Helper derive_proposal_id via BLAKE2-256 hash (Inmutable #16 byte-determinism) - sp_api::decl_runtime_apis! GovernanceApi declaration (query_proposal + query_vote) ## Types canonical updated - origin-chain-types/src/governance.rs: added scale derives a ProposalId + VoteStance + Vote (Encode + Decode + DecodeWithMemTracking + MaxEncodedLen + TypeInfo) para FRAME-compatibility canonical ## Files - EDIT: crates/origin-chain-governance/Cargo.toml (stub → FRAME pallet deps canonical) - REPLACE: crates/origin-chain-governance/src/lib.rs (placeholder → ~360 LOC scaffold) - EDIT: crates/origin-chain-types/src/governance.rs (scale derives canonical) - EDIT: CHANGELOG.md (v0.0.28 entry) ## Verification - cargo test -p origin-chain-governance — 5 tests verde, 0 failures (pallet_compiles + derive_proposal_id deterministic + different + status variants + re-export) 🏛️ Phase 5.1 scaffold canonical. Wire pattern v0.0.29 next. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
dc1c2e7cd1
commit
1bde93921e
5 files changed
+453
-24
No files matched your search
@@ -7,7 +7,50 @@ license.workspace = true
|
||||
authors.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
description = "Foundation governance on-chain: Pallet Collective + Pallet Democracy + 5 AI advisor agents, humans-only vote canonical per CHN-4. STUB v0.0.1 — implementation lands Phase 5 of Charon roadmap."
|
||||
description = "Foundation governance on-chain canonical: Proposal + Vote + Tally per CHN-4 AI-Driven Human-Guarded. Phase 5.1 v0.0.28 scaffold — humans-only vote enforced canonical, 5 AI advisor agents advise-only canonical."
|
||||
|
||||
[dependencies]
|
||||
origin-chain-types.workspace = true
|
||||
# Origin Chain canonical types (ProposalId + VoteStance + Vote source-of-truth)
|
||||
origin-chain-types = { workspace = true }
|
||||
|
||||
# FRAME canonical pallet macro + storage + dispatch + events + errors
|
||||
frame-support = { workspace = true }
|
||||
frame-system = { workspace = true }
|
||||
|
||||
# Runtime API canonical (v0.0.31 — GovernanceApi.query_proposal read-only RPC)
|
||||
sp-api = { workspace = true }
|
||||
|
||||
# Substrate primitives canonical (BLAKE2 hashing canonical para derive_proposal_id)
|
||||
sp-core = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
|
||||
# SCALE codec canonical
|
||||
parity-scale-codec = { workspace = true }
|
||||
scale-info = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
# Mock runtime canonical para integration tests v0.0.30 — Pattern v0.0.26 mirror.
|
||||
sp-core = { workspace = true, default-features = true }
|
||||
sp-io = { workspace = true, default-features = true }
|
||||
sp-runtime = { workspace = true, default-features = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"origin-chain-types/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"sp-api/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"parity-scale-codec/std",
|
||||
"scale-info/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-support/try-runtime",
|
||||
"frame-system/try-runtime",
|
||||
]
|
||||
Reference in new issue
Block a user