designing-assertions

designing-assertions

Phylax Credible Layer assertions design. Designs invariants and trigger mapping for phylax/credible layer assertions.

0stars
0forks
Updated 1/21/2026
SKILL.md
readonlyread-only
name
designing-assertions
description

"Phylax Credible Layer assertions design. Designs invariants and trigger mapping for phylax/credible layer assertions."

Designing Assertions

Design high-signal invariants and map them to precise triggers before writing any Solidity.

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 assertion suite for a protocol or contract.
  • Turning protocol rules into enforceable pre/post invariants.
  • Choosing between call, storage, or balance triggers.

When NOT to Use

  • You need to discover invariants from scratch. Use mapping-invariants.
  • You only need cheatcode syntax or implementation details. Use implementing-assertions.
  • You only need test harness patterns. Use testing-assertions.
  • You are doing a general security review without writing assertions.

Quick Start

  1. Identify assets, roles, and trust boundaries.
  2. List state transitions that can violate safety properties.
  3. Express invariants as pre/post comparisons or event-accounting rules.
  4. Select data sources (state, logs, call inputs, storage slots).
  5. Choose minimal triggers that cover all violating paths.
  6. Decide whether the invariant needs call-frame checks (forkPreCall/forkPostCall) or only tx-level checks.

Workflow

  • Build a protocol map: key contracts, roles, assets, mutable state.
  • Draft invariants in plain language and math form.
  • Identify legitimate exceptions in specs/audits and encode them explicitly (events/logs are often the signal).
  • Decide if the invariant is transaction-scoped (pre/post) or call-scoped (per call id).
  • Choose enforcement location (per-contract vs chokepoint) based on call routing.
  • Flag upgradeability/proxy entrypoints and token integration assumptions.
  • Pick observation strategy:
    • State comparisons for monotonicity and conservation.
    • Event-based accounting when internal state is opaque.
    • Call input parsing for authorization or parameter bounds.
  • Map to triggers with the smallest blast radius.
  • For calldata-keyed invariants (timelock queues, executableAt[msg.data]), plan how to rebuild calldata from selector + args.
  • Group invariants into multiple assertion contracts when needed to avoid CreateContractSizeLimit.
  • Enumerate edge cases (zero supply, empty vaults, proxy upgrades, nested batches).

Rationalizations to Reject

  • "Trigger on any call; it is simpler." This risks gas-limit reverts and false drops.
  • "Post-state is enough." Many invariants need pre/post deltas.
  • "Ignore batch or nested calls." Real protocols use them heavily.
  • "We can skip edge cases like zero supply." These are common sources of false positives.

Deliverable

  • Invariant spec with: definition, data sources, trigger list, and edge cases.
  • A candidate list of assertion functions with one invariant per function.

References

You Might Also Like

Related Skills

summarize

summarize

179Kresearch

Summarize or extract text/transcripts from URLs, podcasts, and local files (great fallback for “transcribe this YouTube/video”).

openclaw avataropenclaw
Get
prompt-lookup

prompt-lookup

143Kresearch

Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.

skill-lookup

skill-lookup

143Kresearch

Activates when the user asks about Agent Skills, wants to find reusable AI capabilities, needs to install skills, or mentions skills for Claude. Use for discovering, retrieving, and installing skills.

sherpa-onnx-tts

sherpa-onnx-tts

88Kresearch

Local text-to-speech via sherpa-onnx (offline, no cloud)

moltbot avatarmoltbot
Get
openai-whisper

openai-whisper

87Kresearch

Local speech-to-text with the Whisper CLI (no API key).

moltbot avatarmoltbot
Get
seo-review

seo-review

66Kresearch

Perform a focused SEO audit on JavaScript concept pages to maximize search visibility, featured snippet optimization, and ranking potential

leonardomso avatarleonardomso
Get