dotnet icon indicating copy to clipboard operation
dotnet copied to clipboard

Integrate Ecosystem Signing Policies

Open 0xFirekeeper opened this issue 6 months ago • 3 comments

Closes TOOL-4019

Pending tests


PR-Codex overview

This PR focuses on enhancing the PersonalSign methods across various wallet classes to include optional parameters for originalMessage and chainId. It also introduces new classes for user operations and improves JSON serialization settings.

Detailed summary

  • Added UserOperationHexifiedV6 and UserOperationHexifiedV7 classes with JSON serialization.
  • Updated PersonalSign methods in PrivateKeyWallet, EngineWallet, and IThirdwebWallet to include originalMessage and chainId parameters.
  • Enhanced JSON serialization in ThirdwebRPC and EcosystemWallet to ignore null values.
  • Modified payloads in EcosystemWallet for signing messages to include new parameters.
  • Adjusted HashAndSignUserOp methods in SmartWallet to pass new parameters during signing.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Expanded signature methods across various wallet types to accept additional optional parameters for enhanced signing flexibility.
  • Improvements

    • Improved JSON serialization to ignore null values in wallet operations and batch requests, resulting in cleaner and more efficient request payloads.
  • Documentation

    • Updated method documentation to reflect new optional parameters in wallet signing interfaces.

0xFirekeeper avatar May 27 '25 13:05 0xFirekeeper

Walkthrough

The changes introduce optional originalMessage and chainId parameters to PersonalSign methods across wallet classes and interfaces. These parameters are included in payloads sent to enclave signing endpoints and used in user operation signing. JSON serialization is updated to ignore null values for these new fields and related user operation classes.

Changes

File(s) Change Summary
Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs
Thirdweb/Thirdweb.Wallets/EngineWallet/EngineWallet.cs
Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs
Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs
Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs
Added optional originalMessage and chainId parameters to PersonalSign methods and updated implementations to include these in signing payloads or calls.
Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs Added [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] attribute to user operation classes to ignore null values during serialization.
Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs Updated JSON serialization settings to ignore null values in batch RPC requests by introducing _jsonSerializerSettings.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant SmartWallet
    participant PersonalAccount
    participant EnclaveAPI

    Caller->>SmartWallet: HashAndSignUserOp(userOp, chainId)
    SmartWallet->>SmartWallet: EncodeUserOperation(userOp)
    SmartWallet->>PersonalAccount: PersonalSign(userOpHash, originalMessage=userOp, chainId)
    PersonalAccount->>EnclaveAPI: POST /sign-message { message, isRaw, originalMessage, chainId }
    EnclaveAPI-->>PersonalAccount: signature
    PersonalAccount-->>SmartWallet: signature
    SmartWallet-->>Caller: signature

Assessment against linked issues

Objective Addressed Explanation
Pass originalMessage and chainId to enclave sign-message API when signing user operations (TOOL-4019)

📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69df32e27b6588c07002e64ec59c70c7c80c5f6e and edbe643488b78b30dbe2da6e6d7ff3afb9348974.

📒 Files selected for processing (1)
  • Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-test-cov
✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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

Documentation and Community

  • 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.

coderabbitai[bot] avatar May 27 '25 13:05 coderabbitai[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 60.96%. Comparing base (b6541d6) to head (edbe643).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #149      +/-   ##
==========================================
+ Coverage   60.94%   60.96%   +0.01%     
==========================================
  Files          41       41              
  Lines        6563     6566       +3     
  Branches      832      832              
==========================================
+ Hits         4000     4003       +3     
  Misses       2376     2376              
  Partials      187      187              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar May 27 '25 13:05 codecov-commenter