Skip to content

test: apply PR #620 simulator-migration review feedback - #631

Merged
0xisk merged 2 commits into
mainfrom
fix/simulator-migration-review
Jun 26, 2026
Merged

test: apply PR #620 simulator-migration review feedback#631
0xisk merged 2 commits into
mainfrom
fix/simulator-migration-review

Conversation

@0xisk

@0xisk 0xisk commented Jun 26, 2026

Copy link
Copy Markdown
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Follow-up to #620. Applies the CodeRabbit + Andrew review feedback that
landed after #620 was merged.

Applied

  • Drop the redundant resolves.not.toThrow() matcher across the access
    and token unit specs (54 sites). On a resolving promise the matcher is
    vacuous (.resolves already fails the test on rejection), so the calls
    are now a plain await, which is what Andrew suggested.
  • Assert resolved values where the call returns data: MultiToken
    balanceOf is 0n after init, and ZOwnablePK _computeOwnerId returns
    32 bytes.
  • transferOwnership now receives newIdHash (the new owner id) rather
    than the commitment, so the id-to-commitment path and the counter-bump
    case are actually exercised.
  • Pin the live-stack images: proof-server:8.0.3 and
    indexer-standalone:4.0.1, the validated combo for midnight-node:0.22.2.
    latest drifts onto the Cardano-bridge indexer line, which crash-loops on
    boot against this stack.
  • make env-up waits for health (docker compose up -d --wait), so
    yarn test:live straight after env-up no longer races the stack during
    startup.

Not applied (with reason)

  • await this.setPrivateState(...) in the three injectSecretKey helpers.
    setPrivateState is synchronous (: void) in
    @openzeppelin/compact-simulator@0.2.0, so there is no promise to await
    and no race. Awaiting it would await undefined and falsely imply
    asynchrony.
  • Splitting the proof-server command into ['midnight-proof-server', '-v'].
    The image ENTRYPOINT is bash -c, so ['midnight-proof-server -v'] is
    parsed correctly. Splitting would push -v into $0 and silently drop the
    verbose flag.
  • Removing src/archive/. Deferred to feat(token): add native shielded token standard MIP-0011 #621, which replaces it with the
    final feature (agreed in review).

PR Checklist

Further comments

Local validation was limited to tsc --noEmit (green) in this environment;
the dry unit suite (yarn test) runs in CI.

Summary by CodeRabbit

  • Bug Fixes

    • Improved local environment startup reliability by waiting for services to become ready before completing setup.
    • Pinned key local services to specific versions to reduce unexpected boot failures and crash loops.
  • Tests

    • Strengthened automated coverage around access control, ownership, and token behaviors to better validate successful flows.

0xisk added 2 commits June 26, 2026 11:23
Apply CodeRabbit + Andrew feedback on the async simulator migration.

* Replace redundant `await expect(x).resolves.not.toThrow()` with a
  plain `await x`. The matcher is vacuous on a resolving promise (the
  `.resolves` modifier already fails the test on rejection), so awaiting
  the circuit directly carries the same "does not throw" intent with
  less ceremony. Andrew suggested dropping the wrapper.
* Assert resolved values where the call returns data: MultiToken
  `balanceOf` is `0n` post-init, and ZOwnablePK `_computeOwnerId`
  returns 32 bytes.
* Pass `newIdHash` (the new owner id) to `transferOwnership` instead of
  the commitment, so the id-to-commitment path and the counter-bump
  case are actually exercised.

Refs: #620
* Pin proof-server to 8.0.3 and indexer-standalone to 4.0.1, the
  validated combo for midnight-node 0.22.2. `latest` drifts onto the
  Cardano-bridge indexer line, whose config wants an unset
  `infra.spo_node.blockfrost_id` and crash-loops on boot.
* `make env-up` now runs `docker compose up -d --wait` so it blocks
  until the proof-server, indexer, and node healthchecks pass instead
  of returning mid-startup. `yarn test:live` straight after env-up was
  racing the stack and failing intermittently.

Refs: #620
@0xisk
0xisk requested review from a team as code owners June 26, 2026 09:25
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef201342-89c2-4bf4-a767-f0ba264016d2

📥 Commits

Reviewing files that changed from the base of the PR and between d5713b5 and 66cf993.

📒 Files selected for processing (8)
  • Makefile
  • contracts/src/access/test/AccessControl.test.ts
  • contracts/src/access/test/Ownable.test.ts
  • contracts/src/access/test/ShieldedAccessControl.test.ts
  • contracts/src/access/test/ZOwnablePK.test.ts
  • contracts/src/token/test/MultiToken.test.ts
  • contracts/src/token/test/nonFungibleToken.test.ts
  • local-env.yml

Walkthrough

This PR changes multiple contract tests to use direct awaited success calls instead of resolves.not.toThrow(), updates one token test to assert a zero balance, and pins local Compose image tags while adding --wait to env-up.

Changes

Assertion updates across contract tests

Layer / File(s) Summary
AccessControl assertions
contracts/src/access/test/AccessControl.test.ts
Successful role checks and admin handoff cases now use direct awaited calls instead of promise-based non-throw assertions.
Ownable assertions
contracts/src/access/test/Ownable.test.ts
Ownership-transfer success checks now use direct awaits after owner changes.
Shielded access assertions
contracts/src/access/test/ShieldedAccessControl.test.ts
Initialization, role grant/revoke, renounce, and admin-reassignment success cases now await the simulator calls directly.
ZOwnablePK assertions and identifiers
contracts/src/access/test/ZOwnablePK.test.ts
Owner ID computation now checks the returned length, and ownership-transfer success checks and arguments now use direct awaits and newIdHash.
Token assertions
contracts/src/token/test/MultiToken.test.ts, contracts/src/token/test/nonFungibleToken.test.ts
The multi-token initialization test now checks a zero balance, and several NFT success cases now await direct calls.

Local environment updates

Layer / File(s) Summary
Compose wait behavior
Makefile
env-up adds --wait to the Docker Compose up -d command.
Pinned service images
local-env.yml
proof-server and indexer use pinned image tags, and the indexer entry adds comments about latest drift and compatibility.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

I hopped through tests with a careful nose,
Awaited the checks as the green garden grows.
Compose went “wait” and the images stayed true,
Pinning the burrow from wobble and dew.
🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the changeset and accurately signals follow-up review feedback, though it is broader than the specific test and stack updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/simulator-migration-review

Comment @coderabbitai help to get the list of available commands.

@0xisk
0xisk merged commit 4270c2c into main Jun 26, 2026
10 checks passed
@0xisk
0xisk deleted the fix/simulator-migration-review branch June 26, 2026 09:42
@0xisk 0xisk mentioned this pull request Jun 30, 2026
8 tasks
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.

2 participants