Tutorial: Testing Compact Contracts — Unit Tests, Assertions, and Local Simulation (Bounty #312)#519
Open
a918124259a wants to merge 3 commits into
Open
Conversation
Covers: - Error code structure (POOL_INVALID_TX = AUTHOR(1000) + 10) - Common error codes: 139, 154, 168, 170, 186 - The 5-dimension cost model with block limits - Diagnostic steps for each error - Quick reference flowchart Based on midnight-ledger source analysis. Closes midnightntwrk#318
- Written tutorial (3,500+ words) covering: - disclose() audit — no secret leaks - ownPublicKey() usage review - Replay protection (nullifiers and nonces) - Exported ledger field review - Witness implementation correctness - Version compatibility confirmation - Proof generation testing on testnet - Accompanying Compact contract code (vulnerable + secure patterns) - TypeScript witness implementations - Complete pre-deployment runbook Closes: midnightntwrk#320
…#312 - Written tutorial (3,000+ words) covering: - Contract simulator setup using Contract class - Vitest unit tests for circuit calls and ledger state - Error condition testing (assert failures, type safety) - Integration tests with Docker stack - GitHub Actions CI pipeline - Sample Counter contract with TypeScript witnesses - Complete test suite with vitest - CI workflow configuration Closes: midnightntwrk#312
|
|
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 PR adds a comprehensive Testing Compact Contracts tutorial, addressing Bounty #312.
Deliverables
Written tutorial (3,000+ words) covering:
ContractclassSample Counter contract with full test coverage
CI workflow with unit and integration test stages
Complete test suite with vitest including:
Checklist
Closes: #312