Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Feature Request: Support Multiple Permission IDs in Single Transaction for Smart Sessions #116

Open
1 task done
joepegler opened this issue Nov 13, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@joepegler
Copy link
Collaborator

Feature or Improvement Description

Enhance the Smart Sessions module to allow users to send multiple calls in a single transaction using several permissionIds at once. This feature will enable batching multiple actions, each associated with different permissions, within a single user operation.

Benefits & Outcomes

  • Improve Efficiency: Reduces the number of transactions required by batching multiple actions, saving gas fees and improving user experience.
  • Enhance Flexibility: Allows complex operations that require different permissions to be executed atomically.
  • Support Advanced Use Cases: Enables developers to build more sophisticated dApps that can perform multiple operations securely in one transaction.
  • Align with User Needs: Addresses requests from users who need to perform multiple actions that require different permissions without multiple round-trips.
  • Stay Competitive: Keeps the Nexus SDK at the forefront by offering advanced session management capabilities.

Implementation Ideas

  1. Update the Smart Sessions Validator Module

    • Modify the toSmartSessionsValidator function to handle multiple permissionIds.
    • Update the sigGen method to accept an array of permissionIds and generate signatures accordingly.
  2. Extend Signature Encoding

    • Adjust the encodeSmartSessionSignature function (from @rhinestone/module-sdk) to support multiple permissionIds.
    • Ensure that the signature correctly represents all permissions associated with the calls.
  3. Modify the Use Session Functions

    • Update usePermission and useDistributedPermission functions to accept an array of permissionIds matching the calls.
    • Ensure that each call is paired with its corresponding permissionId.
  4. Adjust the User Operation Preparation

    • In functions like prepareUserOperation, modify the logic to include multiple permissions.
    • Ensure that the assembled user operation correctly reflects all calls and permissions.
  5. Update Type Definitions

    • Modify types such as UsePermissionModuleData, UseDistributedPermissionParameters, and others to support arrays of permissionIds.
    • Ensure TypeScript types accurately represent the new structures.
  6. Implement Validation Logic

    • Add checks to validate that the number of permissionIds matches the number of calls.
    • Ensure that permissions are correctly assigned to each call.
  7. Testing

    • Write unit tests to cover the new functionality.
      • Test sending multiple calls with different permissionIds in one transaction.
      • Test error handling when mismatched numbers of calls and permissions are provided.
    • Update existing tests to ensure they still pass with the new changes.
  8. Update Documentation

    • Revise the documentation to explain how to use multiple permissionIds in a single transaction.
    • Provide examples demonstrating the new feature.
  9. Backward Compatibility

    • Ensure that existing functionality remains intact for users who only need to send single calls with one permissionId.
    • Implement default behaviors where appropriate.
  10. Performance Optimization

    • Assess any potential performance impacts of the changes.
    • Optimize the encoding and processing of multiple permissions.

References

Any References?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@joepegler joepegler added the enhancement New feature or request label Nov 13, 2024
@joepegler joepegler self-assigned this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant