PR U: NotaryRegistry E2E round-trip via ganache CLI + in-process solc #25

Merged
nsatoshi merged 1 commits from devin/1776891791-pr-u-notary-e2e into main 2026-04-22 21:11:53 +00:00
Owner

Summary

Adds a headless end-to-end round-trip that spawns the ganache CLI as a child process, deploys NotaryRegistry.sol via in-process solc-js compilation, and exercises services/notaryChain.ts (anchorPlan + finalizeAnchor) against the real chain via ethers v6.

Closes gap-analysis v3 §7.9 / §8.5 — PR Q’s existing E2E covered Postgres only; this one covers the chain adapter boundary the orchestrator actually depends on.

Changes

  • contracts/NotaryRegistry.sol — add OZ v5 constructor(address initialOwner) Ownable(initialOwner) {} (required by OpenZeppelin v5; contract was written for v4 and would not compile otherwise).
  • orchestrator/src/services/notaryChain.ts:
    • Bug fix: Step tuple ABI shape was (uint8, address, uint256, bytes) — but IComboHandler.Step is (uint8, bytes, address, uint256). Different tuple order → different canonical signature → different function selector → every on-chain call silently reverted with no revert data. Corrected to match.
    • Disable JsonRpcProvider response cache (cacheTimeout: -1) so back-to-back anchor+finalize on fast chains no longer read a stale getTransactionCount and collide on nonce.
  • orchestrator/tests/e2e/helpers/compileNotaryRegistry.ts — in-process solc-js compilation with recursive import resolver (handles ./interfaces/*.sol + @openzeppelin/contracts/...), returns { abi, bytecode } ready for ContractFactory. Avoids any hardhat dependency.
  • orchestrator/tests/e2e/notaryChainRoundtrip.e2e.test.ts — gated on RUN_E2E=1; 3 tests:
    1. anchorPlan writes a PlanRegistered record on-chain (verified via plans(bytes32) read).
    2. finalizeAnchor writes a PlanFinalized record, emits the matching receipt hash.
    3. anchorPlan falls back to mode: mock cleanly when envs are unset.
  • orchestrator/package.json — adds ganache@7.9.2, solc@0.8.20 to devDependencies.

Verification

  • npx tsc --noEmit clean.
  • npx jest unit suite: 10 suites / 128 tests — unchanged, all passing.
  • RUN_E2E=1 npx jest --config=jest.e2e.config.js tests/e2e/notaryChainRoundtrip.e2e.test.ts: 3 / 3 passing.

Notes

  • No UI changes. Entirely backend / test infrastructure.
  • Mock-fallback path for anchorPlan is preserved — production deployments without chain envs degrade gracefully.
  • Does not yet encode full plan steps into registerPlan — PR E’s SWIFT step IDs will land that separately.
## Summary Adds a headless end-to-end round-trip that spawns the ganache CLI as a child process, deploys `NotaryRegistry.sol` via in-process `solc-js` compilation, and exercises `services/notaryChain.ts` (`anchorPlan` + `finalizeAnchor`) against the real chain via ethers v6. Closes gap-analysis v3 §7.9 / §8.5 — PR Q’s existing E2E covered Postgres only; this one covers the chain adapter boundary the orchestrator actually depends on. ## Changes - `contracts/NotaryRegistry.sol` — add OZ v5 `constructor(address initialOwner) Ownable(initialOwner) {}` (required by OpenZeppelin v5; contract was written for v4 and would not compile otherwise). - `orchestrator/src/services/notaryChain.ts`: - **Bug fix**: Step tuple ABI shape was `(uint8, address, uint256, bytes)` — but `IComboHandler.Step` is `(uint8, bytes, address, uint256)`. Different tuple order → different canonical signature → different function selector → every on-chain call silently reverted with no revert data. Corrected to match. - Disable JsonRpcProvider response cache (`cacheTimeout: -1`) so back-to-back anchor+finalize on fast chains no longer read a stale `getTransactionCount` and collide on nonce. - `orchestrator/tests/e2e/helpers/compileNotaryRegistry.ts` — in-process `solc-js` compilation with recursive import resolver (handles `./interfaces/*.sol` + `@openzeppelin/contracts/...`), returns `{ abi, bytecode }` ready for `ContractFactory`. Avoids any hardhat dependency. - `orchestrator/tests/e2e/notaryChainRoundtrip.e2e.test.ts` — gated on `RUN_E2E=1`; 3 tests: 1. `anchorPlan` writes a `PlanRegistered` record on-chain (verified via `plans(bytes32)` read). 2. `finalizeAnchor` writes a `PlanFinalized` record, emits the matching receipt hash. 3. `anchorPlan` falls back to `mode: mock` cleanly when envs are unset. - `orchestrator/package.json` — adds `ganache@7.9.2`, `solc@0.8.20` to devDependencies. ## Verification - `npx tsc --noEmit` clean. - `npx jest` unit suite: **10 suites / 128 tests** — unchanged, all passing. - `RUN_E2E=1 npx jest --config=jest.e2e.config.js tests/e2e/notaryChainRoundtrip.e2e.test.ts`: **3 / 3 passing**. ## Notes - No UI changes. Entirely backend / test infrastructure. - Mock-fallback path for `anchorPlan` is preserved — production deployments without chain envs degrade gracefully. - Does not yet encode full plan steps into `registerPlan` — PR E’s SWIFT step IDs will land that separately.
nsatoshi added 1 commit 2026-04-22 21:03:35 +00:00
PR U: NotaryRegistry E2E round-trip via ganache CLI + in-process solc
Some checks failed
CI / Frontend Lint (pull_request) Failing after 7s
CI / Frontend Type Check (pull_request) Failing after 6s
CI / Frontend Build (pull_request) Failing after 7s
CI / Frontend E2E Tests (pull_request) Failing after 8s
CI / Orchestrator Build (pull_request) Failing after 7s
CI / Orchestrator Unit Tests (pull_request) Failing after 5s
CI / Orchestrator E2E (Testcontainers) (pull_request) Has been skipped
CI / Contracts Compile (pull_request) Failing after 6s
CI / Contracts Test (pull_request) Failing after 6s
Code Quality / SonarQube Analysis (pull_request) Failing after 20s
Code Quality / Code Quality Checks (pull_request) Failing after 5s
Security Scan / Dependency Vulnerability Scan (pull_request) Failing after 5s
Security Scan / OWASP ZAP Scan (pull_request) Failing after 4s
a7b355beef
- Spawn ganache CLI as child process on a random dev port; deploy
  NotaryRegistry.sol compiled via in-process solc-js (no hardhat).
- Add OZ v5 Ownable initialOwner constructor to NotaryRegistry.sol
  (required by OpenZeppelin v5; contract was written pre-v5 and would
  not compile otherwise).
- Fix Step tuple ABI in services/notaryChain.ts — the prior shape
  (uint8, address, uint256, bytes) diverged from IComboHandler.Step
  (uint8, bytes, address, uint256), producing a different function
  selector and silently reverting every on-chain call.
- Disable JsonRpcProvider response cache (cacheTimeout=-1) so
  back-to-back anchor+finalize calls on fast chains no longer read a
  stale getTransactionCount and collide on nonce.
- Gated on RUN_E2E=1 to stay out of the fast unit-test path. 3/3
  tests pass: anchor on-chain write, finalize with receipt hash,
  graceful mock fallback when envs cleared. Full unit suite: 10/10
  (128 tests) still green, tsc --noEmit clean.

Closes gap-analysis v3 §7.9 / §8.5 (chain round-trip coverage).
nsatoshi merged commit a9fbb39889 into main 2026-04-22 21:11:53 +00:00
nsatoshi deleted branch devin/1776891791-pr-u-notary-e2e 2026-04-22 21:11:54 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: d-bis/CurrenciCombo#25