ci: enforce locked installs, security scans, event validation, and st… - #775
Open
Osuochasam wants to merge 1 commit into
Open
ci: enforce locked installs, security scans, event validation, and st…#775Osuochasam wants to merge 1 commit into
Osuochasam wants to merge 1 commit into
Conversation
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.
Overview
This update introduces comprehensive contract state testing, hardens the CI pipeline with locked dependency installations and security scanning, and adds automated drift detection for contract events.
Key Changes:
Contract State Tests: Added a robust test suite (state_transitions.rs) mapped into lib.rs. It thoroughly validates the contract's state machine, covering initial states, pause/unpause transitions by admins, blocked operations during paused states (verifying 17 read-only APIs), and repeated lifecycle cycles.
Reproducible CI Installations: Eliminated dependency drift in the CI pipeline. JavaScript/TypeScript jobs now strictly use npm ci (with separate cache paths), and Rust jobs use cargo fetch --locked. Both are configured to fail fast and provide actionable output for developers if lockfiles are out of sync.
Automated Vulnerability Scanning: Integrated a non-blocking/blocking security scan job into CI. It runs cargo-audit for Rust and npm audit for JS/TS. Informational and low-severity findings are logged, while critical and high-severity vulnerabilities will block the build. Documented the tooling and suppression policies in a new SECURITY_SCANNING.md file.
Event Documentation Validation: Created a new JSON source of truth (contract_events_docs.json) for contract events and a lightweight TypeScript validation script (check_events.ts). A new CI job automatically parses the Rust codebase to detect any drift between the documented events (names, fields, types, topics) and the actual implementation, preventing undocumented API changes.
Closes #712
Closes #714
Closes #718
Closes #719