feat: add governance and timelock safety analysis - #105
Merged
Manuelshub merged 1 commit intoAug 28, 2026
Merged
Conversation
Emmy123222
force-pushed
the
feat/governance-timelock-safety-analysis
branch
from
August 28, 2026 20:52
6ddf432 to
5f6095d
Compare
Manuelshub
reviewed
Aug 28, 2026
Manuelshub
left a comment
Contributor
There was a problem hiding this comment.
LGTM and a good work @Emmy123222
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #84.
Implements Task 2: a production-grade, deterministic governance, timelock, multisig, and proposal
execution safety analyzer for ChainProof.
What changed
OpenZeppelin Governor/TimelockController, Compound Governor Bravo, Safe-style multisigs, and
cross-chain governance receivers.
CP-GOV-001–CP-GOV-016) covering live/same-block voting power,snapshots, quorum/window math, timelock readiness, replay, complete proposal/operation identity,
arbitrary target/value/calldata flow, guardian bypasses, delay updates, predecessors, salts, role
separation, upgrades, cross-chain domains, and threshold signatures.
sanitized diagnostics, configuration validation, and v0→v1 migration.
chainproof governancewith rule selection, resource limits, model output, report artifacts,and configurable CI severity exit thresholds.
Scope
The analyzer reports structural implementation safety. It does not score political legitimacy,
voter preferences, or proposal outcomes.
Architecture and security boundaries
model.tsperforms a bounded, cycle-safe AST walk and emits semantic state/transition/operationrecords.
adapters.tsrecognizes framework structure without treating a name as proof of safety.analyzer.tsruns pure rules over that model;api.tsowns budgets, cancellation, deterministicordering, and sanitized filesystem diagnostics;
serialize.tsand the CLI are transport/presentationonly. The feature performs no RPC, network, package download, compiler subprocess, symbolic
execution, or provider call. Deployment role membership, bridge finality/authenticity, economic
adequacy, and political outcomes remain outside the static source boundary.
Precision / recall considerations
dedicated API skips it and can model generic implementations directly.
taint. Framework adapters suppress only mitigations visible in source.
and domain-separated cross-chain fixtures are zero-finding false-positive controls.
configuration, and external bridge/token behavior may require manual review and are documented.
Performance
Local Node.js benchmark on the final implementation (100 copies of
VulnerableGovernor.sol, 1,024finding cap): 599.2 ms, 17.4 MiB heap delta. Preflight source/contract/function checks and
per-function operation, per-finding evidence, project file, and total finding limits provide
deterministic adversarial bounds. Regression tests enforce early contract limiting, an eight-operation
cap on a 200-statement function, cancellation, and a 5-second guardrail for the bounded fixture.
Validation
npm run buildnpm testnpm run lintnpm run test:ci --workspace=packages/coreLatest local evidence after updating from target
master: 41 core suites / 332 tests and6 CLI suites / 24 tests pass. Core coverage is 83.9% statements overall and 91.78% statements
for
src/governance.Follow-up work
Review guide
packages/core/src/governance/model.tsandanalyzer.ts.api.ts,config.ts, andserialize.ts.chainproof governance examples/contracts/governance --format json --fail-on none.examples/contracts/governance/.