Skip to content

spec: Add Channel API contract, generator, and Emerald composition#236

Draft
mpoke wants to merge 16 commits intomainfrom
marius/quint-channel-api
Draft

spec: Add Channel API contract, generator, and Emerald composition#236
mpoke wants to merge 16 commits intomainfrom
marius/quint-channel-api

Conversation

@mpoke
Copy link
Contributor

@mpoke mpoke commented Feb 20, 2026

Work in progress. DO NOT MERGE

Goal: Component-Based Specification in Quint

Each reusable component publishes: Spec (internal logic), Contract (declarative API guarantees), Generator (small state machine producing valid traces). The contract is authoritative; the generator is a verified tool. Consumers trust the contract and check only their own invariants.

Current Spec Artifacts (Channel API)

All in emerald/specs/:

faults.qnt

Reusable fault event types and disk/mem convention

channel_api_contract.qnt

Properties over ChannelState = { disk: { all_proposals, decisions }, mem: { event_history } }:

channel_api_generator.qnt

Minimal state machine producing valid Channel API message sequences:

emerald_with_generator.qnt

Composition via all { gen::sendX(node), handleX(node) }:

mpoke and others added 16 commits February 20, 2026 16:33
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace PendingWork/ProcessingContext split with a flat List[WorkItem]
queue where engine API calls and local Emerald state updates are
interleaved as equal work items. This generalizes naturally to apps
talking to multiple external components.

Key changes:
- WorkItem sum type: EngineCall | FinalizeGetValue | FinalizeReceivedProposal | FinalizeDecided
- pendingWork: List[WorkItem] replaces Option[PendingWork]
- stepAdvanceWork processes one item per step with uniform queue pop
- Handlers renamed handle* → finalize* to reflect they update Emerald state
- Stale proposal check moved to stepReceivedProposal (before enqueueing)
- Removed rethUnchanged alias, PendingWork type, ProcessingContext type
- Added TODOs for EngineCallSpec boilerplate and state separation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Categorize invariants by scope: Emerald-only, Emerald↔Malachite,
  Emerald↔Reth
- Remove chain_continuity_inv (Reth contract property, duplicated from
  reth::contractInv)
- Add commented channelContractInv/engineContractInv for full contract
  verification
- Update independent crash TODO with concrete design: deadlock analysis,
  work queue clearing, validated_cache handling, invariant gating on
  Reth phase

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant