Skip to content

Conversation

@arr00
Copy link
Contributor

@arr00 arr00 commented Sep 4, 2025

Summary by Sourcery

Documentation:

  • Fix incorrect AsciiDoc include path in token.adoc

Summary by CodeRabbit

  • Documentation
    • Fixed token swap examples to reference the ERC7984→ERC20 flow and adjusted the included snippet range so examples render correctly.
  • Refactor
    • Internal contract examples updated to use a simplified encryption API for handling confidential amounts, improving clarity and consistency without changing public interfaces.

@arr00 arr00 requested a review from a team as a code owner September 4, 2025 14:18
@netlify
Copy link

netlify bot commented Sep 4, 2025

Deploy Preview for confidential-tokens ready!

Name Link
🔨 Latest commit e47116f
🔍 Latest deploy log https://app.netlify.com/projects/confidential-tokens/deploys/68b9ae94b4e24b0007fe9e8e
😎 Deploy Preview https://deploy-preview-196--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 4, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR fixes a broken docs embed reference in token.adoc by updating the include path to the correct location, ensuring the referenced content is properly rendered.

File-Level Changes

Change Details Files
Corrected the AsciiDoc embed directive path
  • Adjusted the embed/include macro to use the correct relative path
  • Fixed a typo in the file path argument
  • Verified that the embedded section renders without errors
docs/modules/ROOT/pages/token.adoc

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 4, 2025

Walkthrough

Updated a docs include and replaced extension-method calls with static FHE API calls in two mock contracts. The docs token.adoc include range and referenced example file were adjusted. No public signatures were changed.

Changes

Cohort / File(s) Change Summary
Docs: token page includes
docs/modules/ROOT/pages/token.adoc
Adjusted ERC7984-to-ERC7984 include range from [lines=8..24] to [lines=8..23]; replaced include target SwapConfidentialToERC20.sol with SwapERC7984ToERC20.sol.
Contracts: FHE API switch (mint/burn)
contracts/mocks/docs/ERC7984MintableBurnable.sol
Replaced extension-style calls amount.fromExternal(inputProof) with static calls FHE.fromExternal(amount, inputProof); removed using FHE for *; and unused imports (ebool, euint64), kept FHE and externalEuint64. Signatures unchanged.
Contracts: FHE API switch (swap)
contracts/mocks/docs/SwapERC7984ToERC20.sol
Removed using FHE for *; and replaced extension calls with static equivalents: encryptedInput.fromExternal(inputProof)FHE.fromExternal(encryptedInput, inputProof) and amount.allowTransient(address(_fromToken))FHE.allowTransient(amount, address(_fromToken)). Core swap logic unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hopped through code and trimmed a line,
Replaced some magic methods with a straight call sign.
Docs now point to the swapped-up toy,
I munch on changes, nibble with joy. 🥕🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/fix-docs-ref

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 (1)
docs/modules/ROOT/pages/token.adoc (1)

100-100: Option: include only the swap function excerpt for consistency with prior example.

The ERC7984→ERC7984 snippet uses a lines range; consider excerpting the key function here too.

-include::api:example$SwapERC7984ToERC20.sol[]
+include::api:example$SwapERC7984ToERC20.sol[lines=8..24]

Adjust the range to match the swap function’s exact lines.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5cee399 and e31b9a2.

📒 Files selected for processing (1)
  • docs/modules/ROOT/pages/token.adoc (1 hunks)
⏰ 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). (4)
  • GitHub Check: boostsecurity - boostsecurityio/semgrep-pro
  • GitHub Check: slither
  • GitHub Check: coverage
  • GitHub Check: tests
🔇 Additional comments (1)
docs/modules/ROOT/pages/token.adoc (1)

100-100: Correct include target; aligns with ERC7984-to-ERC20 example. LGTM.

The reference now matches the section’s intent. No other issues spotted in the block structure.

[source,solidity]
----
include::api:example$SwapConfidentialToERC20.sol[]
include::api:example$SwapERC7984ToERC20.sol[]
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

Verify Antora include resolves and remove stale references.

Ensure the example file exists under the expected Antora path (modules/api/examples) and that no docs still reference the old filename.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Verify example file exists:"
fd -a 'SwapERC7984ToERC20.sol'

echo "2) Verify it's under modules/api/examples for Antora family 'example$':"
fd -a 'SwapERC7984ToERC20.sol' | grep -E 'modules/api/examples/SwapERC7984ToERC20\.sol$' || {
  echo "Expected path modules/api/examples/SwapERC7984ToERC20.sol not found"; exit 1; }

echo "3) Ensure no stale references remain:"
rg -nS 'SwapConfidentialToERC20\.sol' docs || echo "No stale references."

echo "4) Ensure all includes use the new file:"
rg -nS 'include::api:example\$SwapERC7984ToERC20\.sol' docs || {
  echo "No include found for the new file; verify location or module name."; exit 1; }

Length of output: 589


Move SwapERC7984ToERC20.sol into docs/modules/api/examples and remove stale references

  • Relocate contracts/mocks/docs/SwapERC7984ToERC20.sol to docs/modules/api/examples/SwapERC7984ToERC20.sol so include::api:example$SwapERC7984ToERC20.sol[] resolves correctly.
  • Search for and delete any lingering mentions of SwapConfidentialToERC20.sol.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
contracts/mocks/docs/SwapERC7984ToERC20.sol (1)

34-38: Fix custom error usage: require cannot emit custom errors.
Use explicit revert with the custom error.

Apply:

-        require(to != address(0), SwapConfidentialToERC20InvalidGatewayRequest(requestID));
+        if (to == address(0)) {
+            revert SwapConfidentialToERC20InvalidGatewayRequest(requestID);
+        }
🧹 Nitpick comments (1)
contracts/mocks/docs/SwapERC7984ToERC20.sol (1)

12-15: Make token references immutable.
Saves gas and documents single-assignment intent.

-    IERC7984 private _fromToken;
-    IERC20 private _toToken;
+    IERC7984 private immutable _fromToken;
+    IERC20 private immutable _toToken;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 124e620 and e47116f.

📒 Files selected for processing (2)
  • contracts/mocks/docs/ERC7984MintableBurnable.sol (2 hunks)
  • contracts/mocks/docs/SwapERC7984ToERC20.sol (1 hunks)
⏰ 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). (4)
  • GitHub Check: boostsecurity - boostsecurityio/semgrep-pro
  • GitHub Check: coverage
  • GitHub Check: slither
  • GitHub Check: tests
🔇 Additional comments (3)
contracts/mocks/docs/ERC7984MintableBurnable.sol (3)

4-4: Import change aligns with static FHE API. LGTM.
Switching to {FHE, externalEuint64} is consistent with replacing extension methods.


20-22: Correct use of FHE.fromExternal for burn.
Same as mint—migration looks good.


16-18: Approve code changes
All mocks now call FHE.fromExternal; no extension-form usages remain.

Comment on lines +22 to +23
euint64 amount = FHE.fromExternal(encryptedInput, inputProof);
FHE.allowTransient(amount, address(_fromToken));
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

Right migration: extension → static FHE API.
FHE.fromExternal then FHE.allowTransient(amount, address(_fromToken)) is the correct order before calling _fromToken.confidentialTransferFrom.

Quick scan for any lingering extension-style calls:


🏁 Script executed:

#!/bin/bash
rg -nP '\.\s*(fromExternal|allowTransient)\s*\(' -S -g '!**/node_modules/**'

Length of output: 3418


Correct static FHE usage; migrate remaining extension-style calls
The snippet in contracts/mocks/docs/SwapERC7984ToERC20.sol correctly calls

FHE.fromExternal(...);
FHE.allowTransient(...);

before invoking the token transfer.
I ran rg -nP '\.\s*(fromExternal|allowTransient)\s*\(' -S -g '!**/node_modules/**' and uncovered multiple other extension-style FHE calls across the repo. Please update each occurrence to the static FHE API pattern (i.e. FHE.fromExternal(...) immediately followed by FHE.allowTransient(...)) before any _transfer, _mint, _burn, or confidentialTransferFrom calls.

🤖 Prompt for AI Agents
In contracts/mocks/docs/SwapERC7984ToERC20.sol around lines 22-23, the FHE API
is already used correctly (FHE.fromExternal(...) then FHE.allowTransient(...));
however, scan the repo for any extension-style calls like
encryptedInput.fromExternal(...) or amount.allowTransient(...) (use the provided
ripgrep command) and refactor each to the static API pattern: call
FHE.fromExternal(...) and immediately call FHE.allowTransient(...) before any
subsequent _transfer, _mint, _burn, or confidentialTransferFrom invocation;
ensure ordering is preserved and replace the extension-method call sites with
the two static FHE calls so transient allowances are always set prior to token
operations.

@arr00 arr00 merged commit 93a1f79 into master Sep 10, 2025
15 checks passed
@arr00 arr00 deleted the chore/fix-docs-ref branch September 10, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants