Skip to content
mapping-invariants logo

Mapping Invariants

mapping-invariants

Phylax Credible Layer assertions invariant mapping. Use when starting a protocol to map invariants before writing phylax/credible layer assertions or tests.

SKILL.md

Full skill instructions

Mapping Invariants

Start here before designing or implementing assertions. This skill defines the invariant‑mapping workflow and hands off to the other skills.

Meta-Cognitive Protocol

Adopt the role of a Meta-Cognitive Reasoning Expert.

For every complex problem: 1.DECOMPOSE: Break into sub-problems 2.SOLVE: Address each with explicit confidence (0.0-1.0) 3.VERIFY: Check logic, facts, completeness, bias 4.SYNTHESIZE: Combine using weighted confidence 5.REFLECT: If confidence <0.8, identify weakness and retry For simple questions, skip to direct answer.

Always output: ∙Clear answer ∙Confidence level ∙Key caveats

When to Use

  • Starting a new protocol assertion effort.
  • You need a structured method to discover invariants.
  • You want the step‑by‑step path before designing-assertions and implementing-assertions.

When NOT to Use

  • You already have a vetted invariant list.
  • You only need implementation details. Use implementing-assertions.
  • You only need testing guidance. Use testing-assertions.

Quick Start

  1. Build the protocol map (assets, roles, entrypoints, state, routers).
  2. Enumerate invariants by category (access control, accounting, pricing, solvency, limits, modes).
  3. Rank invariants by impact and likelihood (losses, control‑plane, liveness).
  4. Identify exceptions and acceptable violations.
  5. Pick data sources (state, logs, call inputs, slots).
  6. Choose enforcement location (chokepoint vs per‑contract).
  7. Produce the invariant matrix and trigger map.
  8. Hand off to designing-assertions → implementing-assertions → testing-assertions.

Skill Map

  • designing-assertions: turn the invariant map into triggerable invariants and edge cases.
  • implementing-assertions: write Solidity assertions and cheatcode logic.
  • testing-assertions: build PCL/​forge tests for assertions.
  • backtesting-assertions: replay mainnet txs to validate triggers.
  • pcl-assertion-workflow: set up PCL project, store/​submit/​deploy.
  • assertion-troubleshooting: diagnose non-triggering or failing assertions.

Workflow

  • Protocol map: read docs/​specs/​audits/​tests; list contracts, assets, roles, and critical entrypoints.
  • Invariant inventory: express “states that must never occur” and rank by impact.
  • Spec classification: split global invariants vs action-specific postconditions (GPOST/​HSPOST).
  • Exception audit: capture legitimate exceptions (bad debt, emergency modes, timelocks).
  • Observation plan: decide which values/​events you will read to validate each invariant.
  • Trigger plan: select the narrowest trigger that guarantees coverage.
  • Coverage check: confirm each invariant is reachable from at least one trigger and entrypoint.
  • Feasibility check: internal calls are not traced; call inputs are ordered per selector; modified mapping keys must be derived from call inputs or logs; if an invariant depends on msg.data, plan to reconstruct it from selector + args because call inputs exclude the selector.

Heuristics

  • Start with loss‑bearing invariants: solvency, accounting integrity, and upgrade control.
  • Prefer cross‑function invariants over per‑function reverts already in code.
  • If you cannot observe an invariant reliably, rephrase it to observable signals.
  • For lending protocols, classify actions by health‑factor impact and list allowed transitions.
  • If an invariant depends on intermediate call frames, plan to use forkPreCall/forkPostCall from the start.

Deliverables

  • Invariant matrix (definition, source, exceptions, priority).
  • Trigger map (selector/​slot/​balance mapping).
  • Data source list (storage layout, logs, call inputs).
  • Test plan (positive/​negative, fuzz, backtest candidates).

Rationalizations to Reject

  • “We can skip invariant mapping and write code directly.”
  • “We only need owner checks.” (Protocols usually fail on accounting and pricing.)
  • “One broad assertion is enough.” (Gas and coverage risks.)
  • “We’ll add exceptions later.” (Most false positives come from ignored exceptions.)

References

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
I
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View