Skip to content

Conversation

@RegisGraptin
Copy link
Contributor

@RegisGraptin RegisGraptin commented Sep 9, 2025

Following #201

Upgrade the FHEVM to the v0.8.0

Apply the migration on the Gateway callback to have the expected signature

Summary by Sourcery

Migrate FHEVM integration to version 0.8.0 and adapt contracts to the updated cleartexts-based API.

Enhancements:

  • Update finalizeDiscloseEncryptedAmount, finalizeSwap, and finalizeUnwrap to accept cleartexts and signatures, verify with FHE.checkSignatures(cleartexts, signatures), and decode the cleartext amount.

Build:

  • Upgrade FHEVM dependencies to v0.8.0 in package.json, including @fhevm/core-contracts, @fhevm/hardhat-plugin, @fhevm/solidity, and @zama-fhe/relayer-sdk.
  • Update contracts/package.json peerDependencies to reference @fhevm/solidity v0.8.0.

Chores:

  • Remove deprecated FHE.setDecryptionOracle call in VestingWalletConfidentialFactoryMock.

Summary by CodeRabbit

  • New Features

    • Finalization endpoints now accept signed cleartext payloads; amounts are decoded from those payloads and used to trigger transfers.
  • Bug Fixes

    • Ensures recipient tokens are transferred after successful verification in finalize flows.
  • Refactor

    • Unified signature verification to accept cleartexts alongside signatures.
  • Chores

    • Upgraded FHEVM and relayer SDK dependencies; removed decryption-oracle configuration during initialization.
  • Tests

    • Tests now resolve ACL addresses from relayer metadata instead of a hardcoded constant.

@netlify
Copy link

netlify bot commented Sep 9, 2025

Deploy Preview for confidential-tokens ready!

Name Link
🔨 Latest commit 38f10bc
🔍 Latest deploy log https://app.netlify.com/projects/confidential-tokens/deploys/68d2b3166546b30008154fe1
😎 Deploy Preview https://deploy-preview-202--confidential-tokens.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 9, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Migrate the project to FHEVM v0.8.0 by updating core dependencies (core-contracts, hardhat-plugin, solidity compiler, and relayer SDK), refactoring all finalize* gateway callbacks to consume and decode cleartexts in signature verification calls, and removing the now-obsolete decryption oracle setup.

Sequence diagram for new finalizeSwap interaction with FHEVM v0.8.0

sequenceDiagram
    participant User
    participant SwapConfidentialToERC20
    participant FHE
    User->>SwapConfidentialToERC20: call finalizeSwap(requestID, cleartexts, signatures)
    SwapConfidentialToERC20->>FHE: checkSignatures(requestID, cleartexts, signatures)
    FHE-->>SwapConfidentialToERC20: verification result
    SwapConfidentialToERC20->>SwapConfidentialToERC20: decode amount from cleartexts
    SwapConfidentialToERC20->>User: transfer ERC20 tokens
Loading

Sequence diagram for new finalizeDiscloseEncryptedAmount interaction with FHEVM v0.8.0

sequenceDiagram
    participant User
    participant ERC7984
    participant FHE
    User->>ERC7984: call finalizeDiscloseEncryptedAmount(requestId, cleartexts, signatures)
    ERC7984->>FHE: checkSignatures(requestId, cleartexts, signatures)
    FHE-->>ERC7984: verification result
    ERC7984->>ERC7984: decode amount from cleartexts
    ERC7984->>User: emit AmountDisclosed
Loading

Sequence diagram for new finalizeUnwrap interaction with FHEVM v0.8.0

sequenceDiagram
    participant User
    participant ERC7984ERC20Wrapper
    participant FHE
    User->>ERC7984ERC20Wrapper: call finalizeUnwrap(requestID, cleartexts, signatures)
    ERC7984ERC20Wrapper->>FHE: checkSignatures(requestID, cleartexts, signatures)
    FHE-->>ERC7984ERC20Wrapper: verification result
    ERC7984ERC20Wrapper->>ERC7984ERC20Wrapper: decode amount from cleartexts
    ERC7984ERC20Wrapper->>User: transfer ERC20 tokens
Loading

Class diagram for updated gateway callback signatures

classDiagram
    class ERC7984 {
        finalizeDiscloseEncryptedAmount(requestId: uint256, cleartexts: bytes, signatures: bytes)
    }
    class SwapConfidentialToERC20 {
        finalizeSwap(requestID: uint256, cleartexts: bytes, signatures: bytes)
    }
    class ERC7984ERC20Wrapper {
        finalizeUnwrap(requestID: uint256, cleartexts: bytes, signatures: bytes)
    }
Loading

Class diagram for VestingWalletCliffExecutorConfidential after decryption oracle removal

classDiagram
    class VestingWalletCliffExecutorConfidential {
        initialize(executor)
        // FHE.setCoprocessor(ZamaConfig.getSepoliaConfig())
        // FHE.setDecryptionOracle(ZamaConfig.getSepoliaOracleAddress()) [REMOVED]
    }
Loading

File-Level Changes

Change Details Files
Upgrade FHEVM dependencies to v0.8.0
  • Bump @fhevm/core-contracts to 0.8.0
  • Update @fhevm/hardhat-plugin to 0.1.0-0
  • Set @fhevm/solidity to 0.8.0
  • Upgrade @zama-fhe/relayer-sdk to v0.2.0
  • Adjust peerDependency solidity version to 0.8.0
package.json
contracts/package.json
Refactor finalize* callbacks to new API signature
  • Change finalizeDiscloseEncryptedAmount to accept cleartexts and pass them into FHE.checkSignatures
  • Decode uint64 amount from cleartexts after signature verification
  • Apply same cleartexts+decode pattern to finalizeSwap and finalizeUnwrap
contracts/token/ERC7984/ERC7984.sol
contracts/mocks/docs/SwapERC7984ToERC20.sol
contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol
Remove deprecated decryption oracle initialization
  • Delete FHE.setDecryptionOracle call in the VestingWalletConfidentialFactoryMock constructor
contracts/mocks/finance/VestingWalletConfidentialFactoryMock.sol

Possibly linked issues

  • Migration to FHEVM 0.8 #201: The PR updates FHEVM to 0.8.0, migrating package versions and refactoring contract functions like finalizeDiscloseEncryptedAmount to the new Gateway callback signature, as specified in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Several contract callbacks were migrated to accept packed cleartexts and signatures; FHE.checkSignatures calls were updated accordingly and amounts are decoded from cleartexts. Conditional token transfers were added in unwrap/swap flows, a decryption-oracle setup was removed from a mock factory, and FHEVM-related dependencies were bumped to 0.8.x.

Changes

Cohort / File(s) Summary
ERC7984 core
contracts/token/ERC7984/ERC7984.sol
finalizeDiscloseEncryptedAmount signature changed to (uint256 requestId, bytes cleartexts, bytes signatures), calls FHE.checkSignatures(requestId, cleartexts, signatures) and decodes uint64 amount from cleartexts.
ERC7984 ERC20 wrapper
contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol
finalizeUnwrap signature changed to (uint256 requestID, bytes cleartexts, bytes signatures), verifies via FHE.checkSignatures(...), decodes amount, and transfers underlying() to recipient using amount * rate().
Swap mock
contracts/mocks/docs/SwapERC7984ToERC20.sol
finalizeSwap now accepts (uint256 requestID, bytes cleartexts, bytes signatures), uses FHE.checkSignatures(...), decodes amount, and conditionally transfers _toToken to recipient if amount != 0.
Vesting factory mock
contracts/mocks/finance/VestingWalletConfidentialFactoryMock.sol
Removed FHE.setDecryptionOracle(...) call from initialize; coprocessor setup and initializer flow remain.
Contracts package
contracts/package.json
Peer dependency @fhevm/solidity bumped from 0.7.00.8.0.
Root packages
package.json
Dev dependency updates: @fhevm/core-contracts 0.7.0-12 → 0.8.0, @fhevm/hardhat-plugin 0.0.1-3 → 0.1.0-0, @fhevm/solidity 0.7.0 → 0.8.0, @zama-fhe/relayer-sdk ^0.1.0-5 → ^0.2.0.
Tests helper
test/helpers/accounts.ts
Replaced static ACL_ADDRESS constant with dynamic runtime resolution via await fhevm.getRelayerMetadata().ACLAddress; removed exported constant.
Tests update
test/token/ERC7984/extensions/ERC7984Freezable.test.ts
Replaced hardcoded ACL address usage with dynamic await fhevm.getRelayerMetadata().ACLAddress when connecting IACL__factory.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant Contract as ERC7984 / Wrapper / SwapMock
  participant FHE as FHE Library
  participant Recipient

  Caller->>Contract: finalize*(requestId, cleartexts, signatures)
  Contract->>FHE: checkSignatures(requestId, cleartexts, signatures)
  FHE-->>Contract: ok / revert
  Note over Contract: amount = abi.decode(cleartexts, (uint64))
  Contract->>Contract: resolve recipient from _receivers and delete mapping
  alt amount != 0
    Contract->>Recipient: transfer tokens (amount or amount * rate)
  end
  Contract-->>Caller: emit events / finish
Loading
sequenceDiagram
  autonumber
  participant Caller
  participant Factory as VestingWalletConfidentialFactoryMock
  participant FHE as FHE Library

  Caller->>Factory: initialize(...)
  Note over Factory: setCoprocessor(...) only\n(FHE.setDecryptionOracle call removed)
  Factory-->>Caller: initialized
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • Migration to FHEVM 0.8 #201 — Migration to FHEVM v0.8 callback/signature pattern (cleartexts + signatures) and FHE.checkSignatures usage; aligns with signature and decode changes in this PR.

Possibly related PRs

Suggested labels

ignore-changeset

Suggested reviewers

  • arr00
  • james-toussaint

I twitch my whiskers at byte-bound gates,
Cleartexts tumble, signatures congregate.
Amounts unwrapped, tokens hop to paws,
Oracle burrow removed without a pause.
A happy rabbit cheers these tidy updates. 🐇✨

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed The description thoroughly outlines the key package upgrades, API changes, and contract adaptations introduced in the pull request, and it is directly related to the summarized changes, providing context and links to relevant issues and dependencies.
Title Check ✅ Passed The PR title "Migrate @fhevm/solidity to 0.8.0" is concise and accurately captures the primary intent of the changeset (upgrading FHEVM-related packages and migrating code to v0.8.0), matching the PR objectives and the file-level summaries. It is specific enough for a reviewer to understand the main change without noisy details. The title is a clear single sentence and does not use vague terms or extraneous information.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@RegisGraptin RegisGraptin force-pushed the chore-migrate-fhevm-0.8.0 branch from a910e01 to 1968dbc Compare September 9, 2025 13:14
@RegisGraptin RegisGraptin force-pushed the chore-migrate-fhevm-0.8.0 branch from 1968dbc to fb3cd45 Compare September 9, 2025 13:20
@RegisGraptin RegisGraptin marked this pull request as ready for review September 9, 2025 13:21
@RegisGraptin RegisGraptin requested a review from a team as a code owner September 9, 2025 13:21
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
contracts/package.json (1)

35-35: Peer dependency alignment confirmed: pinned 0.8.0 matches the root devDependency and no version skew detected. Optional: switch to ^0.8.0 to accept future patch releases.

contracts/token/ERC7984/ERC7984.sol (1)

228-230: Add a minimal sanity check to avoid OOB on empty handles.

Guard against unexpected empty handle arrays from the gateway to prevent an index underflow.

Apply within this block:

-        euint64 requestHandle = euint64.wrap(FHE.loadRequestedHandles(requestId)[0]);
+        bytes32[] memory handles = FHE.loadRequestedHandles(requestId);
+        if (handles.length == 0) revert ERC7984InvalidGatewayRequest(requestId);
+        euint64 requestHandle = euint64.wrap(handles[0]);
contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol (1)

137-138: Skip zero-amount transfers to maximize ERC‑20 compatibility

Some nonstandard tokens revert on zero transfers. Guarding the transfer avoids edge-case failures without behavior change.

-        SafeERC20.safeTransfer(underlying(), to, amount * rate());
+        uint256 payout = uint256(amount) * rate();
+        if (payout != 0) {
+            SafeERC20.safeTransfer(underlying(), to, payout);
+        }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5476ee4 and fb3cd45.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • contracts/mocks/docs/SwapERC7984ToERC20.sol (1 hunks)
  • contracts/mocks/finance/VestingWalletConfidentialFactoryMock.sol (0 hunks)
  • contracts/package.json (1 hunks)
  • contracts/token/ERC7984/ERC7984.sol (1 hunks)
  • contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol (1 hunks)
  • package.json (2 hunks)
💤 Files with no reviewable changes (1)
  • contracts/mocks/finance/VestingWalletConfidentialFactoryMock.sol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: tests
  • GitHub Check: slither
🔇 Additional comments (6)
contracts/token/ERC7984/ERC7984.sol (2)

221-227: Finalize callback migrated to cleartexts/signatures — good ordering and decode.

Signature check occurs before decode; decoding to uint64 matches the single-handle request in discloseEncryptedAmount. LGTM.


221-227: All finalize callers/tests use the updated (uint256, bytes, bytes) signature; no stale usage found.

contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol (2)

130-138: Migration to cleartexts + signature verification looks correct

Callback shape, signature check, receiver lookup, and deletion-before-transfer all look good. Transfer scales by rate() as expected.


130-133: Verify gateway callback payloads in FHEVM v0.8
In contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol (finalizeUnwrap, lines 130–133), confirm that:

  • cleartexts is ABI-encoded for a single uint64 (so abi.decode(cleartexts,(uint64)) is valid).
  • signatures is delivered as one bytes blob (not bytes[]), matching FHE.checkSignatures(uint256,bytes,bytes).
    Any discrepancy in encoding or signature shape will break decryption or verification—ensure your local FHE interface matches the upstream v0.8.0 definitions.
contracts/mocks/docs/SwapERC7984ToERC20.sol (2)

37-47: Callback update matches the new pattern; post‑verify transfer is safe

Signature check first, receiver lookup + delete, then conditional transfer is sound.


37-39: No outdated callback signatures remain
All finalizeSwap implementations now use bytes memory cleartexts and bytes memory signatures, matching the FHE.checkSignatures(uint256, bytes, bytes) signature in FHE.sol.

package.json Outdated
Comment on lines 47 to 50
"@fhevm/core-contracts": "0.8.0",
"@fhevm/hardhat-plugin": "0.1.0-0",
"@fhevm/solidity": "0.8.0",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.6",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

FHE stack bumped (core-contracts 0.8.0, hardhat-plugin 0.1.0-0, solidity 0.8.0, relayer-sdk ^0.2.0).

Looks consistent with contract changes. Please verify Hardhat config still loads the updated plugin and tasks, and that Node 20+ works end-to-end.

  • If the plugin interface changed, ensure hardhat.config.{ts,js} imports "@fhevm/hardhat-plugin" and any config keys were migrated.
  • Consider pinning the prerelease plugin to an exact version in CI to avoid surprise breaks.

Run:

Also applies to: 66-66


🏁 Script executed:

#!/bin/bash
rg -nP '@fhevm/hardhat-plugin|fhevm' -C2 hardhat.config.* scripts || true
node -v
npm ci
npm run compile

Length of output: 2867


🏁 Script executed:

#!/bin/bash
# Show lines around the docs/config import in Hardhat config
sed -n '30,50p' hardhat.config.ts

# Verify existence of docs/config file
find . -type f | grep 'docs/config' || echo 'No docs/config file found'

Length of output: 278


Hardhat configuration broken by missing docs/config import

  • The docgen setting in hardhat.config.ts uses require('./docs/config'), but no such file exists, causing build failures. Add the missing docs/config module or update the import path.
  • Ensure import '@fhevm/hardhat-plugin' and any plugin-specific config keys in hardhat.config.{ts,js} reflect the updated interface.
  • Pin @fhevm/hardhat-plugin to the exact prerelease version in CI to avoid surprise breaks.
🤖 Prompt for AI Agents
In package.json around lines 47 to 50, the project references
@fhevm/hardhat-plugin but the Hardhat config currently requires a missing
./docs/config module which breaks builds; add the missing docs/config module
(exporting the config object expected by hardhat.config.ts) or update
hardhat.config.ts to import the correct path, update hardhat.config.{ts,js} to
include import '@fhevm/hardhat-plugin' and adjust any plugin-specific config
keys to match the plugin's current interface, and pin @fhevm/hardhat-plugin to
the exact prerelease version in package.json and CI (use the full version
string) so installs are deterministic.

@RegisGraptin
Copy link
Contributor Author

Notice some issue in the test relating to a missing import form import constants from '../../node_modules/@fhevm/hardhat-plugin/src/constants'; used to defined the ACL address.
This file is currently no more available in the hardhat-plugin from fhevm.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/helpers/accounts.ts (1)

19-20: Good move to resolve ACL at runtime; add a guard (and optional fallback) to avoid brittle failures.

  • Protect against undefined/zero address and optionally allow an env override for CI.
  • Also consider importing the ACL artifact JSON instead of reading from fs (path stability).

Please verify the exact API/field name on the upgraded plugin (that fhevm.getRelayerMetadata() exists and returns ACLAddress)—the docs show the fhevm module but don’t explicitly list this method. (docs.zama.ai)

Apply within this hunk:

-  const aclAddress = (await fhevm.getRelayerMetadata()).ACLAddress;
-  const aclContract = await hre.ethers.getContractAt(acl_abi, aclAddress);
+  const { ACLAddress } = await fhevm.getRelayerMetadata();
+  const aclAddress = process.env.ACL_ADDRESS ?? ACLAddress;
+  if (!ethers.isAddress(aclAddress) || aclAddress === ethers.ZeroAddress) {
+    throw new Error(
+      "ACL address unavailable. Ensure fhevm.getRelayerMetadata() is supported by @fhevm/hardhat-plugin 0.1.0-0 and/or set ACL_ADDRESS."
+    );
+  }
+  const aclContract = await hre.ethers.getContractAt(acl_abi, aclAddress);

Outside this hunk (optional), prefer importing the artifact over fs:

// at top-level (requires resolveJsonModule in tsconfig)
import aclArtifact from '@fhevm/core-contracts/artifacts/contracts/ACL.sol/ACL.json';
const acl_abi = (aclArtifact as any).abi;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb3cd45 and efc8713.

📒 Files selected for processing (1)
  • test/helpers/accounts.ts (2 hunks)
🔇 Additional comments (1)
test/helpers/accounts.ts (1)

5-5: Correct usage: importing fhevm from Hardhat is supported—LGTM.
The plugin exposes fhevm as a named export from "hardhat". (docs.zama.ai)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
test/token/ERC7984/extensions/ERC7984Freezable.test.ts (5)

45-53: Potentially redundant double call to createEncryptedAmount in no-proof path

You do both a stateful call and a staticCall. If createEncryptedAmount doesn't require a stateful pre-call, drop the first tx to speed up tests.

If safe:

-      } else {
-        await token.connect(freezer).createEncryptedAmount(amount);
-        params.push(await token.connect(freezer).createEncryptedAmount.staticCall(amount));
-      }
+      } else {
+        params.push(await token.connect(freezer).createEncryptedAmount.staticCall(amount));
+      }

200-207: Parse the exact ConfidentialTransfer event (avoid address-only filter)

Filter by the event topic to avoid matching an unrelated log from the same contract.

-    const transferEvent = (await tx
-      .wait()
-      .then(receipt => receipt!.logs.filter((log: any) => log.address === token.target)[0])) as EventLog;
+    const receipt = await tx.wait();
+    const topic = ethers.id('ConfidentialTransfer(address,address,bytes32)');
+    const transferEvent = receipt!.logs.find(
+      (log: any) => log.address === token.target && log.topics[0] === topic,
+    ) as EventLog;

226-230: Prefer anyone.address in withArgs for determinism

Passing the Signer object works with some matchers, but using the address is unambiguous across matcher versions.

-      .withArgs(encryptedInput.handles[0], anyone);
+      .withArgs(encryptedInput.handles[0], anyone.address);

27-31: Cache token address within each test to avoid repeated await token.getAddress()

Minor perf/readability win.

Example:

const tokenAddress = await token.getAddress();
// ... reuse tokenAddress in createEncryptedInput/userDecryptEuint calls

Also applies to: 45-49, 67-69, 71-73, 141-143, 156-160, 212-214


21-22: Add ACLAddress validity check and consolidate retrieval logic

  • Validate ACLAddress from getRelayerMetadata before connecting:
-    const acl = IACL__factory.connect((await fhevm.getRelayerMetadata()).ACLAddress, ethers.provider);
+    const { ACLAddress } = await fhevm.getRelayerMetadata();
+    if (!ethers.isAddress(ACLAddress)) {
+      throw new Error(`Invalid ACL address from relayer metadata: ${ACLAddress}`);
+    }
+    const acl = IACL__factory.connect(ACLAddress, ethers.provider);
  • Extract this pattern into a shared test helper to avoid duplication across suites.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efc8713 and bba11a7.

📒 Files selected for processing (2)
  • test/helpers/accounts.ts (2 hunks)
  • test/token/ERC7984/extensions/ERC7984Freezable.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/helpers/accounts.ts

@arr00 arr00 changed the title chore: migrate fhevm to 0.8.0 Migrate @fhevm/solidity to 0.8.0 Sep 12, 2025
@arr00
Copy link
Contributor

arr00 commented Sep 12, 2025

Thanks for kicking off the effort here @RegisGraptin !

Copy link
Contributor

@james-toussaint james-toussaint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @RegisGraptin 👍

@arr00 arr00 merged commit b891874 into OpenZeppelin:master Sep 23, 2025
13 checks passed
@arr00 arr00 linked an issue Sep 23, 2025 that may be closed by this pull request
@github-actions github-actions bot mentioned this pull request Oct 9, 2025
@github-actions github-actions bot mentioned this pull request Nov 12, 2025
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.

Migration to FHEVM 0.8

3 participants