Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
ac803c7
fix: use blockchain timestamp and dynamic port in CLI tests
Feb 8, 2026
7b32787
This is an unrelated change (looks like it was made by the vibe-kanba…
Feb 8, 2026
f3ad997
fix: patch buffer-equal-constant-time for Node 25 compatibility
Feb 8, 2026
f243f8f
fix: increase Anvil startTimeout to prevent test failures during para…
Feb 8, 2026
16480ad
refactor: remove web3 from @celo/utils and @celo/connect
Feb 8, 2026
5b33f0a
feat: add web3 compatibility shim and fix downstream web3 usage
Feb 8, 2026
9ed36d5
style: apply prettier formatting
Feb 8, 2026
28a18df
refactor: remove web3 dependency from all remaining packages
Feb 8, 2026
f802f6e
chore: remove stale web3 resolutions from root package.json
Feb 8, 2026
77b41e4
chore: remove stale wallet-rpc build artifacts
Feb 8, 2026
c2fa8de
Revert "chore: remove stale wallet-rpc build artifacts"
Feb 8, 2026
53ce3ef
chore: remove stale wallet-rpc test artifacts that depend on web3
Feb 8, 2026
365e55d
refactor: rename web3 parameter to client and add Web3 type interface
Feb 9, 2026
47e4167
style: apply formatter fixes from pre-commit hook
Feb 9, 2026
7ce5458
merge: resolve conflicts with master
Feb 9, 2026
a405a8d
fix: fix web3 shim and test compatibility issues after merge
Feb 9, 2026
24004ca
style: apply formatter fix
Feb 9, 2026
aeefc1d
fix: add web3 compat type coercion for viem ABI encoding in shim
Feb 9, 2026
e45d385
fix: add signTransaction to web3 shim and fix wallet-local signing test
Feb 9, 2026
f0b0871
fix: remove web3 import from Accounts.test.ts, use inline constant
Feb 9, 2026
c44e50b
style: fix formatter issue in .vscode/extensions.json
Feb 9, 2026
71976fa
style: use dot notation for listeners object access in connection.ts
Feb 9, 2026
d305566
fix: remove web3 dependency from BaseWrapper and fix soliditySha3 compat
Feb 9, 2026
ff759e7
style: apply biome formatter to BaseWrapper files
Feb 9, 2026
c3f6ad3
ci: retrigger CI
Feb 9, 2026
f0fe3a8
fix: fix hashMessage to treat input as UTF-8 and handle gas:0 in send…
Feb 9, 2026
80416a0
fix: fix sourcify test mock to produce valid ABI-encoded address
Feb 9, 2026
a1ebdff
chore: revert .vscode/extensions.json to master version
Feb 10, 2026
dc1feb7
fix: replace any types with strong types across web3 shim and consumers
Feb 10, 2026
0a5ba91
Committed as `dc1feb705`. All 35 files staged and committed with a de…
Feb 10, 2026
73d4ee7
fix: add type casts for DecodedParamsObject values in tx-uri and bloc…
Feb 10, 2026
20a1310
chore: update .vscode/extensions.json (worktree artifact)
Feb 10, 2026
4ab6b06
fix: redact sensitive RPC params from debug logs
Feb 10, 2026
05b8706
fix: add type cast for DecodedParamsObject value in proposals.ts
Feb 10, 2026
e60d897
fix: use mock Provider instead of string URL in BaseWrapper test
Feb 10, 2026
33286c6
fix: improve RPC debug log sanitization for payloads and responses
Feb 10, 2026
1757faf
chore: revert .vscode/extensions.json to master version
Feb 10, 2026
7fe8c44
refactor: migrated from Web3 to viem ABIs and added kit.web3 deprecat…
Feb 15, 2026
5136110
Removal of web3 altogether
Feb 16, 2026
615ba41
fix: use resilient error assertions in contractkit tests
Feb 16, 2026
fe8d2bd
fix: replace console.info with debug in ledger wallet and fix wallet-…
Feb 16, 2026
2187a4f
fix: remove debug console.log statements from lockedcelo delegate com…
Feb 16, 2026
f6e017a
refactor(contractkit): added explicit return types to wrapper methods
Feb 16, 2026
033b696
fix(contractkit): correct type annotations for ReleaseGold wrapper me…
Feb 16, 2026
b9dcd1e
refactor(wallet-base): remove dead 'Web3 removed' comment in signing-…
Feb 26, 2026
5da239d
refactor(contractkit): rename web3ContractCache to nativeContractCach…
Feb 26, 2026
63b7d21
refactor(contractkit): make getProviderForKit options param optional
Feb 26, 2026
b6b985a
fix(contractkit): update stale cUSD reference to USDm in Accounts tes…
Feb 26, 2026
b21e0f1
fix(connect): throw on unsupported bytesN value types and deduplicate…
Feb 26, 2026
2cf0163
fix(connect): remove unnecessary | null from topics array type in rpc…
Feb 26, 2026
6ea79de
docs(connect): add comments explaining magic numbers in deploy test
Feb 26, 2026
654fff4
docs(utils): fix misleading 'Alias' comment on sha3 function
Feb 26, 2026
1795094
refactor(utils): remove unnecessary intermediate variable in solidity…
Feb 26, 2026
b2e6ff2
refactor(contractkit): rename _web3Contracts to _contracts across cod…
Feb 26, 2026
61f2a2a
refactor(connect): fix naming inconsistency in estimateGas local vari…
Feb 26, 2026
f8421a0
refactor(connect): deduplicate isEmpty/isPresent into abi-coder as ca…
Feb 26, 2026
46581dd
refactor(connect): deduplicate pollForReceipt — use pollForReceiptHel…
Feb 26, 2026
c8710f2
refactor(explorer): replace inline require('crypto') with proper impo…
Feb 26, 2026
e91de7c
docs(connect): add explanatory comment to empty catch block in rpc-co…
Feb 26, 2026
f561a74
refactor(cli): rename leftover web3 params to providerOwner in CLI ut…
Feb 26, 2026
d9beed0
refactor(connect): rename _originalWeb3 to _originalProviderOwner in …
Feb 26, 2026
c20ae35
refactor(connect): remove redundant 'as Provider' casts on _provider
Feb 26, 2026
8aa8782
refactor(connect): use viem toHex instead of manual hex conversion in…
Feb 26, 2026
408cd09
refactor(connect): extract defaultGasEstimator and defaultCaller as p…
Feb 26, 2026
50cc8a0
refactor(contractkit): remove unnecessary 'as AbiItem[]' cast in find…
Feb 26, 2026
95227b1
refactor(connect): extract GetLogsParams interface from inline type i…
Feb 26, 2026
9894b2b
refactor(contractkit): replace raw wei strings with parseEther in Acc…
Feb 26, 2026
b868a05
refactor(wallet-hsm-aws): replace raw wei strings with named constant…
Feb 26, 2026
d7435e0
fix(contractkit): fix proxy.ts findInitializeAbi — move cast to retur…
Feb 26, 2026
7461402
refactor(connect): replace fixed-interval polling with exponential ba…
Feb 26, 2026
8d33ac1
refactor(dev-utils): rename `client` callback parameter to `providerO…
Feb 26, 2026
bcca0bb
refactor(connect): type _provider as CeloProvider and remove unnecess…
Feb 26, 2026
e76f977
style: format fixes for providerOwner rename (biome line wrapping)
Feb 26, 2026
cd681ac
refactor(contractkit): use parseEther for wei values in EpochManager,…
Feb 26, 2026
e706c6d
fix(connect): fix CeloTx type — remove number from `from` field, add …
Feb 26, 2026
7005bef
refactor(connect): remove unused re-exports from connection.ts — keep…
Feb 26, 2026
2dff86e
test(connect): extract abi-coder tests to separate file and add bool/…
Feb 26, 2026
269bc08
refactor(connect): extract enrichAbiWithSignatures and buildEventsMap…
Feb 26, 2026
adad8d8
refactor(connect): remove dead _originalProviderOwner field and simpl…
Feb 26, 2026
9feecd7
refactor(contractkit): extract inline type to DeployResult interface …
Feb 26, 2026
a03c9b4
refactor(contractkit): extract createMockProvider helper in contract-…
Feb 26, 2026
05a38c9
fix(governance): surface require errors in requireABI instead of sile…
Feb 26, 2026
be43e7b
refactor(connect): rename abi-coder.ts to viem-abi-coder.ts for clarity
Feb 26, 2026
4b4892b
refactor(wallet-hsm-aws): use parseEther from viem instead of raw wei…
Feb 26, 2026
07439d1
fix(connect): restore isPresent and isEmpty re-exports from connectio…
Feb 26, 2026
79130d9
fix(contractkit): pass providerOwner.currentProvider to Connection in…
Feb 26, 2026
d39b841
fix(cli): type setupSafeContracts param as ProviderOwner instead of any
Feb 26, 2026
6b2ecb1
refactor(cli): extract RpcBlockResponse interface in multisigUtils
Feb 26, 2026
f0e4e50
refactor(contractkit): use keccak256 from viem in Attestations.test.ts
Feb 26, 2026
3162595
refactor(contractkit): use viem encodePacked+keccak256 in Escrow.test.ts
Feb 26, 2026
cd628a7
test(contractkit): restore API key assertion in newKitWithApiKey test
Feb 26, 2026
3176649
docs(contractkit): add comment explaining BN-to-hex conversion in kec…
Feb 26, 2026
4f6f127
docs(connect): improve bigintToString comment explaining web3 compat
Feb 26, 2026
c8778b3
refactor(connect): use encodeAbiParameters directly in deploy() for c…
Feb 26, 2026
b502391
style: biome format fixes
Feb 26, 2026
65e429e
test(contractkit): restore exact block number assertions in EpochMana…
Feb 26, 2026
090cbd3
refactor(wallet-local): simplify signing.test.ts, remove web3-like cl…
Feb 26, 2026
b54ffba
test(connect): add comprehensive unit tests for RpcContract (40 tests)
Feb 26, 2026
29bf390
refactor(contractkit): remove unnecessary generic T from BaseWrapper/…
Feb 26, 2026
5b37366
style: biome format after generic removal
Feb 26, 2026
b778208
fix(contractkit): pad address to bytes32 in Escrow.test.ts viem encod…
Feb 26, 2026
579617c
style: biome format Escrow test
Feb 26, 2026
0c964db
docs(connect): add comment explaining why coerceArgs is needed in Rpc…
Feb 26, 2026
a3fc740
docs(contractkit): document SimpleHttpProvider host usage and dedup r…
Feb 26, 2026
46f9529
refactor(dev-utils): replace ProviderOwner wrapper with direct Provid…
Feb 26, 2026
9111347
refactor(contractkit): replace web3 Contract with viem-native ViemCon…
Feb 26, 2026
c4cc15d
style(contractkit): biome format + fix @ts-expect-error in EpochManag…
Feb 26, 2026
2a5f333
refactor(cli): migrate CLI from web3 Contract to viem-native ViemCont…
Feb 26, 2026
0429634
refactor(dev-utils,explorer): migrate from web3 Contract to viem-nati…
Feb 26, 2026
4595734
refactor(contractkit): migrate remaining tests + deprecate createCont…
Feb 26, 2026
ae8dd38
chore: add changeset for viem-native contract migration
Feb 26, 2026
138b85b
fix(connect,governance): enrich ViemContract ABI with signatures + mi…
Feb 26, 2026
7a95740
refactor(connect): make ViemContract and createViemTxObject generic o…
Feb 26, 2026
0eafd94
refactor(contractkit): add typed overloads to BaseWrapper proxyCall/p…
Feb 26, 2026
0ca2e45
refactor(contractkit): add TypedContractABIs map and ContractABI util…
Feb 26, 2026
c5fef4b
refactor(contractkit): migrate token wrapper hierarchy to typed ABI g…
Feb 26, 2026
3b8deb4
refactor(contractkit): migrate simple wrappers to typed ABI generics …
Feb 26, 2026
d96b9dd
refactor(contractkit): migrate simple wrappers to typed ABI generics …
Feb 26, 2026
75502c5
refactor(contractkit): migrate EpochManager wrapper to typed ABI generic
Feb 26, 2026
ecbc316
refactor(contractkit): migrate complex governing wrappers to typed AB…
Feb 26, 2026
00d2a37
refactor(contractkit): migrate remaining wrappers to typed ABI generics
Feb 26, 2026
d1b4c9b
fix(cli): update validator deregister test
Feb 26, 2026
a975a9e
refactor(contractkit): enforce compile-time type safety for all wrapp…
Feb 26, 2026
e1280ee
fix: resolve SortedOracles report() from-address propagation and Anvi…
Feb 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-ledger-console-noise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/wallet-ledger': patch
---

Replace `console.info` with `debug` for derivation path logging to avoid noisy test output
5 changes: 5 additions & 0 deletions .changeset/remove-delegate-debug-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/celocli': patch
---

Remove debug console.log statements from lockedcelo:delegate command that were leaking internal values to stdout
10 changes: 10 additions & 0 deletions .changeset/remove-web3-shim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@celo/connect': major
'@celo/contractkit': major
'@celo/celocli': major
'@celo/explorer': patch
'@celo/governance': patch
'@celo/dev-utils': patch
---

Remove Web3 shim from Connection and migrate contractkit to use viem ABIs with Connection.createContract(). Add backward-compatible kit.web3 shim (deprecated). Add newKitFromProvider() factory function.
5 changes: 5 additions & 0 deletions .changeset/strong-typing-contractkit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/contractkit': minor
---

**Improved type safety**: Added explicit type annotations to all wrapper methods that previously emitted `CeloTransactionObject<any>` or `Promise<any>` in their declaration files. All `proxySend` and `proxyCall` usages now have explicit return types, eliminating approximately 110 instances of `any` in the public API surface. This provides better IDE autocompletion and compile-time type checking for consumers of `@celo/contractkit`.
15 changes: 15 additions & 0 deletions .changeset/viem-native-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@celo/connect': minor
'@celo/contractkit': minor
'@celo/explorer': patch
---

**Migrate internal contract interaction from web3-style RPC Contract to viem-native ViemContract**

- Added `ViemContract` type and `createViemTxObject()` function in `@celo/connect`
- Added `Connection.getViemContract()` factory method
- Updated all 36 ContractKit wrappers to use viem-native contract interaction
- Updated `proxyCall`/`proxySend` to accept `ViemContract` + function name strings
- Migrated CLI commands, dev-utils, and explorer to use new API
- Deprecated `Connection.createContract()` (kept for backward compatibility with `.deploy()`)
- Public API unchanged: `CeloTransactionObject`, wrapper method signatures remain the same
66 changes: 66 additions & 0 deletions .opencode/agents/approver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
description: Final approval gate. Verifies build, lint, tests all pass and all review verdicts are PASS.
mode: subagent
model: anthropic/claude-opus-4-6
permission:
edit: deny
bash: allow
webfetch: deny
---

ROLE: Final Approver.
You are the last gate before implementation is considered done. You independently verify everything works.

Rules:
- Do NOT trust previous agent outputs blindly. Run the verification commands yourself.
- Do NOT make any code changes. Only report findings.

**ANVIL TEST POLICY (MANDATORY):**
- You MUST run Anvil tests as part of verification. They are not optional.
- Anvil **v1.0.0** is required. Install with: `curl -L https://foundry.paradigm.xyz | bash && foundryup --install 1.0.0`. Verify with `anvil --version`.
- Run ALL tests with Anvil enabled: `RUN_ANVIL_TESTS=true yarn workspace <package> run test` (value MUST be `'true'`, not `'1'`).
- **ALWAYS** use the package's `test` script, NEVER run `jest` directly. The scripts set `NODE_OPTIONS=--experimental-vm-modules` required for `@viem/anvil`. Without it, tests crash with `TypeError: A dynamic import callback was invoked without --experimental-vm-modules`.
- If you must run a single test file: `NODE_OPTIONS=--experimental-vm-modules yarn workspace <package> run --top-level jest --forceExit <path>`
- If ANY test fails, you MUST verify whether it is pre-existing or a regression:
1. Stash changes: `git stash`
2. Rebuild: `yarn workspace <package> run build`
3. Run the SAME failing test on baseline: `RUN_ANVIL_TESTS=true yarn workspace <package> run test`
4. Record baseline result.
5. Restore changes: `git stash pop`
6. REGRESSION (passes on baseline, fails on branch) → automatic REJECTED
7. PRE-EXISTING (fails on baseline too) → document with proof, does NOT block approval
- NEVER approve if Anvil tests were not run. NEVER approve if regressions exist.
- NEVER accept "Anvil not available" as an excuse — install it.

**CLI TEST SUITE (`@celo/celocli`):**
- If CLI tests crash with `TypeError: Cannot read properties of undefined (reading 'prototype')` from `buffer-equal-constant-time`, run `yarn install` to apply the Yarn patch in `.yarn/patches/`.
- CLI tests should be run the same way as other Jest packages: `RUN_ANVIL_TESTS=true yarn workspace @celo/celocli run test`

**DEVCHAIN-STATE SNAPSHOTS:**
- Inline snapshots with contract addresses, block numbers, or epoch numbers depend on the Anvil devchain state. Snapshot mismatches from devchain changes are NOT regressions — they must be updated with `jest -u`.

Process:
1. Run `yarn build:changes` and verify it completes with zero errors. If it fails due to cross-package dependencies, fall back to `yarn build`.
2. Run `yarn lint` and verify it passes.
3. Run `yarn fmt:diff` and verify formatting is clean.
4. Ensure Anvil is installed.
5. Run `RUN_ANVIL_TESTS=1 yarn test:changes` and verify ALL tests pass (including Anvil tests). If no changed packages are detected, fall back to running tests for the specific packages identified in `git diff --stat`.
6. For any test failures, verify against baseline (see Anvil Test Policy). Classify each as REGRESSION or PRE-EXISTING with proof.
7. Run `git diff --stat` to summarize the scope of changes.
8. Read the spec file and verify all AC items are addressed based on the diff.
9. Check that all previous gate verdicts (reviewer, tester, QA, security, architect) were PASS.
10. Check that a changeset exists in `.changeset/` if public API was changed or a bug was fixed.

Output:
- Build result: PASS/FAIL
- Lint result: PASS/FAIL
- Format result: PASS/FAIL
- Test result: PASS/FAIL (with Anvil tests explicitly included)
- For any test failures: classification as REGRESSION or PRE-EXISTING with baseline proof
- Changeset: PRESENT/MISSING/NOT_NEEDED
- AC coverage: list each AC item as DONE/NOT_DONE
- Previous gate verdicts summary

End with VERDICT: APPROVED / REJECTED.
APPROVED only if: build PASS + lint PASS + format PASS + ALL tests PASS including Anvil (no regressions) + changeset PRESENT or NOT_NEEDED + all AC items DONE.
If REJECTED, list every issue that must be resolved.
50 changes: 50 additions & 0 deletions .opencode/agents/architect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
description: Guards long-term design consistency. Flags coupling, boundaries, and maintainability issues.
mode: subagent
model: anthropic/claude-opus-4-6
permission:
edit: deny
bash: allow
webfetch: deny
---

ROLE: Architect.
Guard long-term design consistency, package boundaries, and maintainability.

Rules:
- Run `git diff` to see all uncommitted changes.
- Run `git diff --stat` to understand the scope.
- Read the spec file to understand the intended design.
- Explore existing code patterns in affected packages to verify consistency.
- Do NOT modify any files — only report findings.

Check for these concerns:

1. **Package boundaries**: Changes should respect the monorepo package structure. No cross-package imports that bypass the public API. Check that `@celo/*` imports go through published entry points, not deep paths.
2. **Abstraction leaks**: Implementation details should not leak into public APIs. Check for internal types or helpers being exported.
3. **Dependency direction**: Dependencies should flow downward (CLI -> contractkit -> base). Flag circular or upward dependencies.
4. **Pattern consistency**: New code should follow established patterns:
- Factory functions over direct construction (`newKit()`, not `new Kit()`)
- Wrapper + cache pattern in contractkit
- `Result<T, E>` for functional error handling where the pattern exists
- Existing naming conventions (see AGENTS.md)
5. **Dual paradigm awareness**: Changes should be aware of both the legacy web3-based path (`Connection`, `ContractKit`) and modern viem-based path (`PublicCeloClient`). New features should target the modern path unless the spec says otherwise.
6. **Module size and complexity**: Flag files growing beyond ~300 lines or functions with deep nesting. Suggest decomposition where appropriate.
7. **Public API surface**: New exports should be intentional. Check barrel files (`index.ts`) for unintended exposure.
8. **Backwards compatibility**: Flag breaking changes to public APIs unless the spec explicitly allows them.

Process:
1. Read the spec and the diff.
2. Identify affected packages and their role in the dependency graph.
3. Apply each architecture check.
4. Rate each concern: CRITICAL / WARNING / SUGGESTION.

Output:
- Architecture concerns: list with severity, file:line, description
- Pattern adherence: confirmation of which project patterns are followed
- Suggested refactors: high-level suggestions (not code changes)
- Complexity hotspots: files or functions that are getting too complex

End with VERDICT: PASS/FAIL.
PASS only if there are zero CRITICAL concerns.
If FAIL, list every CRITICAL concern that must be resolved.
38 changes: 38 additions & 0 deletions .opencode/agents/builder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
description: Implements code against a locked specification. Writes production code, not tests.
mode: subagent
model: anthropic/claude-opus-4-6
permission:
edit: allow
bash: allow
webfetch: allow
---

ROLE: Builder.
You implement production code against a locked specification and its Acceptance Criteria.

Rules:
- Read the spec file provided to you FIRST. Understand every AC item before writing any code.
- Follow all code style rules in AGENTS.md (no semicolons, single quotes, 2-space indent, etc.).
- Use existing patterns in the codebase — do not invent new abstractions unless the spec requires it.
- Modern packages use `.js` extensions on relative imports (ESM). Legacy SDK packages use extensionless imports.
- Do NOT write tests — the tester agent handles that.
- Do NOT run `yarn build` or `yarn test` — the fixer and tester agents handle that.
- Commit nothing — the approver agent handles that.
- If the spec has unresolved open questions, use the proposed defaults.
- When modifying code used by tests (especially test utilities, harnesses, or shared helpers), be aware that Anvil-based tests exist and MUST continue to work. If you change a test utility like `testWithWeb3()` or `testWithAnvilL2()`, you MUST ensure ALL existing test consumers still get the interface they expect. Downstream agents will run `RUN_ANVIL_TESTS=true` and any breakage will be caught and sent back for fixing.
- **Anvil v1.0.0** is the required version for tests. Devchain state (contract addresses, epoch numbers, block numbers) depends on this specific version.
- The `@celo/celocli` test suite has a pre-existing `buffer-equal-constant-time` / `@azure/identity` crash affecting ~92 of 98 suites. CLI code changes should be verified with `yarn run --top-level tsc -b packages/cli/tsconfig.json` (TypeScript compilation) rather than expecting the full test suite to pass.

Process:
1. Read the spec file.
2. Explore relevant existing code to understand current patterns.
3. Implement changes file by file, following the spec's migration tiers / priority order.
4. After all code is written, list every file you changed or created.

Output:
- List of files changed/created
- Brief summary of what was implemented per AC item
- Any assumptions made

End with: BUILD: COMPLETE
52 changes: 52 additions & 0 deletions .opencode/agents/fixer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
description: Fixes build, lint, type, and test failures. Applies targeted corrections.
mode: subagent
model: anthropic/claude-opus-4-6
permission:
edit: allow
bash: allow
webfetch: allow
---

ROLE: Fixer.
You receive failure reports from other agents (reviewer, tester, QA, security, architect) and fix the issues.

Rules:
- Read the failure report carefully. Fix only the issues listed — do not refactor unrelated code.
- After each fix, verify it by running the relevant command:
- Type errors: `yarn workspace <package> run build`
- Lint errors: `yarn lint`
- Format errors: `yarn fmt`
- Test failures: `RUN_ANVIL_TESTS=1 yarn workspace <package> run test` (Jest) or `yarn workspace <package> run vitest --run` (Vitest)
- Follow code style rules in AGENTS.md at all times.
- If a fix requires changing the approach (not just a typo), explain why.
- If a reported issue is a false positive, explain why and mark it as such.

**ANVIL TEST POLICY (MANDATORY):**
- When verifying test fixes, ALWAYS run with `RUN_ANVIL_TESTS=true` (the value MUST be `'true'`, not `'1'`).
- Anvil **v1.0.0** is required. Install with: `curl -L https://foundry.paradigm.xyz | bash && foundryup --install 1.0.0`. Verify with `anvil --version`.
- **ALWAYS** use the package's `test` script (e.g. `yarn workspace <package> run test`), NEVER run `jest` directly. The scripts set `NODE_OPTIONS=--experimental-vm-modules` required for `@viem/anvil`. Without it, tests crash with `TypeError: A dynamic import callback was invoked without --experimental-vm-modules`.
- If you must run a single test file: `NODE_OPTIONS=--experimental-vm-modules yarn workspace <package> run --top-level jest --forceExit <path>`
- If an Anvil test fails after your fix, you MUST fix it or prove it is pre-existing by running on baseline.
- NEVER skip Anvil tests or treat their failures as acceptable.

**CLI TEST SUITE (`@celo/celocli`):**
- If CLI tests crash with `TypeError: Cannot read properties of undefined (reading 'prototype')` from `buffer-equal-constant-time`, run `yarn install` to apply the Yarn patch in `.yarn/patches/`.
- CLI tests should be run the same way as other Jest packages: `RUN_ANVIL_TESTS=true yarn workspace @celo/celocli run test`

**DEVCHAIN-STATE SNAPSHOTS:**
- If tests fail due to inline snapshot mismatches on contract addresses, block numbers, or epoch numbers, update them with `jest -u`. These are tied to the Anvil devchain state, not code regressions.

Process:
1. Read the failure report / issue list.
2. For each issue, locate the file and apply the fix.
3. Ensure Anvil is installed if test fixes are involved.
4. Run verification commands after each fix (with `RUN_ANVIL_TESTS=1` for test verification).
5. Repeat until all issues are resolved and verification passes.

Output:
- List of fixes applied (file:line + description)
- Verification results (build/lint/test output, including Anvil test results)
- Any issues that could not be fixed, with explanation

End with: FIX: COMPLETE or FIX: INCOMPLETE (if some issues remain).
71 changes: 71 additions & 0 deletions .opencode/agents/qa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
description: Designs test plan and verifies test coverage against AC. No code changes.
mode: subagent
model: anthropic/claude-opus-4-6
permission:
edit: deny
bash: allow
webfetch: deny
---

ROLE: QA.
Verify that test coverage is adequate for every Acceptance Criteria item.

Rules:
- Read the spec file to understand each AC item.
- Run `git diff --name-only` to identify all changed/created files.
- Read the test files for each changed module. Test files are co-located: `foo.ts` -> `foo.test.ts`.
- For each AC item, verify:
1. At least one test directly exercises the happy path.
2. Edge cases and error paths are covered (invalid inputs, null/undefined, boundary values).
3. Negative tests exist where appropriate (e.g. testing that invalid addresses are rejected).
4. If the AC involves a public API change, the test exercises the public API surface (not just internals).
- Run the test suite for affected packages to confirm tests actually pass:
- `yarn workspace <package> run test` for Jest packages
- `yarn workspace <package> run vitest --run` for Vitest packages
- Do NOT modify any files — only report findings.

**ANVIL TEST POLICY (MANDATORY):**
- You MUST run Anvil tests for every affected package that has them.
- Anvil **v1.0.0** is required. Install with: `curl -L https://foundry.paradigm.xyz | bash && foundryup --install 1.0.0`. Verify with `anvil --version`.
- Run with: `RUN_ANVIL_TESTS=true yarn workspace <package> run test` (value MUST be `'true'`, not `'1'`).
- **ALWAYS** use the package's `test` script, NEVER run `jest` directly. The scripts set `NODE_OPTIONS=--experimental-vm-modules` required for `@viem/anvil`. Without it, tests crash with `TypeError: A dynamic import callback was invoked without --experimental-vm-modules`.
- If you must run a single test file: `NODE_OPTIONS=--experimental-vm-modules yarn workspace <package> run --top-level jest --forceExit <path>`
- If ANY Anvil test fails, you MUST verify whether the failure is pre-existing or caused by the changes:
1. Stash changes: `git stash`
2. Rebuild: `yarn workspace <package> run build`
3. Run the SAME failing test on baseline: `RUN_ANVIL_TESTS=true yarn workspace <package> run test`
4. Record baseline result.
5. Restore changes: `git stash pop`
6. If test PASSES on baseline but FAILS on branch → regression caused by changes → VERDICT: FAIL
7. If test FAILS on baseline too → pre-existing → document with baseline output as proof, does NOT block verdict
- NEVER skip Anvil tests. NEVER assume failures are pre-existing without running them on the baseline.
- NEVER accept "Anvil not available" — install it.

**CLI TEST SUITE (`@celo/celocli`):**
- If CLI tests crash with `TypeError: Cannot read properties of undefined (reading 'prototype')` from `buffer-equal-constant-time`, run `yarn install` to apply the Yarn patch in `.yarn/patches/`.
- CLI tests should be run the same way as other Jest packages: `RUN_ANVIL_TESTS=true yarn workspace @celo/celocli run test`

**DEVCHAIN-STATE SNAPSHOTS:**
- Inline snapshots with contract addresses, block numbers, or epoch numbers depend on the Anvil devchain state. Snapshot mismatches from devchain changes are NOT regressions — update them with `jest -u`.

Process:
1. Read the spec file and list all AC items.
2. Identify affected packages and their test files.
3. For each AC item, map it to specific test cases (file:line).
4. Identify gaps: AC items without tests, missing edge cases, untested error paths.
5. Ensure Anvil is installed.
6. Run the FULL test suite (including Anvil tests with `RUN_ANVIL_TESTS=1`) for all affected packages.
7. For any test failures, verify against baseline (see Anvil Test Policy).

Output:
- Test matrix: table mapping each AC item to its test case(s) with file:line references
- Coverage assessment per AC item: COVERED / PARTIAL / MISSING
- Missing tests: specific tests that should exist but don't
- Edge cases: untested scenarios that should be covered
- Test suite results: pass/fail counts per package (including Anvil tests)
- For any failures: classification as REGRESSION (caused by changes) or PRE-EXISTING (with baseline proof)

End with VERDICT: PASS/FAIL.
PASS only if: every AC item has at least one direct test, no critical edge cases are missing, all tests pass (including Anvil), and no regressions exist.
If FAIL, list exactly what is missing and where tests should be added.
Loading
Loading