-
Notifications
You must be signed in to change notification settings - Fork 24
Add TACo Account Abstraction signing demo #693
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
base: signing-epic
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive TACo Account Abstraction signing demo that demonstrates how to use TACo's distributed threshold signatures with ERC-4337 Account Abstraction. The demo creates a smart account using MetaMask Delegation Toolkit with TACo signers and executes real transactions on Sepolia testnet.
Key Changes:
- Added complete working demo with TACo testnet integration (2-of-3 threshold)
- Implemented MetaMask Delegation Toolkit smart account creation with balance tracking
- Added Pimlico bundler integration for UserOperation execution with comprehensive documentation
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
demos/taco-aa-signing/src/index.ts |
Main demo implementation showing TACo threshold signatures with ERC-4337 |
demos/taco-aa-signing/package.json |
Project dependencies including TACo, viem, and MetaMask delegation toolkit |
demos/taco-aa-signing/README.md |
Complete documentation with setup instructions and example output |
demos/taco-aa-signing/tsconfig.json |
TypeScript configuration extending the root config |
demos/taco-aa-signing/.env.example |
Environment configuration template for RPC, private key, and bundler |
demos/README.md |
Updated main demos index to include the new TACo AA signing demo |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Add comprehensive demo showing how to integrate TACo's distributed threshold signatures with Account Abstraction wallets using MetaMask Delegation Toolkit. Features: - Single-file implementation - Real TACo testnet integration with 2-of-3 threshold - Balance tracking and fund management - ERC-4337 UserOperation signing with Pimlico bundler - Clean documentation with example output
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## signing-epic #693 +/- ##
===============================================
Coverage ? 88.85%
===============================================
Files ? 92
Lines ? 7934
Branches ? 279
===============================================
Hits ? 7050
Misses ? 881
Partials ? 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…uality - Replace ts-node with tsx for better performance and compatibility - Add --dry-run flag support for CI syntax checking - Relax TypeScript strict mode for third-party type incompatibilities - Add explicit TypeScript type annotations for better type safety - Apply Prettier formatting to improve code consistency - Fix type casting for viem/account-abstraction compatibility - Update dependencies in pnpm-lock.yaml
- Add createViemTacoAccount utility to wrap TACo signers as Viem accounts - Replace localAccount parameter with TACo-wrapped account in smart account creation - Update function signature to eliminate private key requirement for signatory - Improve type safety by replacing explicit 'any' types where possible - Add ESLint exemptions for necessary type casts due to library incompatibilities Resolves nucypher#699: AA demo now works without local wallet, making it AI agent ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see AA in this nice demo 🚀
I had some questions mostly about adding some helper functions to taco-web.
| // This satisfies MetaMask's signatory requirement without using a local wallet | ||
| const tacoAccount = createViemTacoAccount(signers[0]); | ||
|
|
||
| const smartAccount = await toMetaMaskSmartAccount({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have the demo as a webpage, in order to check directly with MetaMask? Or is it that we like to run the demo in the command line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check what with metamask? I'm not sure what running in the browser would show here
| return { smartAccount, threshold }; | ||
| } | ||
|
|
||
| async function signUserOpWithTaco( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we generalize this, making it more type-safe, and have it as part of taco-web? I mean specifically for
const tacoUserOp: UserOperation = {
sender: userOp.sender,
nonce: Number(userOp.nonce),
factory: userOp.factory || '0x',
factoryData: userOp.factoryData || '0x',
callData: userOp.callData,
callGasLimit: Number(userOp.callGasLimit),
verificationGasLimit: Number(userOp.verificationGasLimit),
preVerificationGas: Number(userOp.preVerificationGas),
maxFeePerGas: Number(userOp.maxFeePerGas),
maxPriorityFeePerGas: Number(userOp.maxPriorityFeePerGas),
paymaster: userOp.paymaster || '0x',
paymasterVerificationGasLimit: Number(
userOp.paymasterVerificationGasLimit || 0,
),
paymasterPostOpGasLimit: Number(userOp.paymasterPostOpGasLimit || 0),
paymasterData: userOp.paymasterData || '0x',
signature: '0x',
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is to do with converting from a Viem UserOp. I'm opening to making the sdk more general, but I think we should wait until your Viem PR is in. This is just demo code for an adopter
| const COHORT_ID = 1; | ||
| const AA_VERSION = 'mdt'; | ||
|
|
||
| async function createTacoSmartAccount( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to generalize this function and put it or part of it inside taco-web?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is specific to Metamask (i don't know if other AA wallets will require the same). It's also viem specific, so if we do this, Viem becomes a dependency.
Co-authored-by: Derek Pierre <[email protected]> Co-authored-by: Muhammad Altabba <[email protected]>
- Rename demo folder to be MetaMask Delegation Toolkit specific - Update package name to taco-mdt-aa-signing-demo - Update README title to include "MetaMask Delegation Toolkit" - Add note explaining MDT-specific implementation requirements - Update main demos README link reference Addresses Derek's feedback in PR nucypher#693 about making the demo more specific to MetaMask's Delegation Toolkit implementation.
…gner - Add getCohortMultisigAddress() method to SigningCoordinatorAgent - Calls getSigningCoordinatorChild(chainId) to get child contract - Uses cohortMultisigs(cohortId) mapping to get actual multisig address - Update taco-mdt-aa-signing demo to use cohort multisig address - Replace signers[0] placeholder with proper deployed multisig contract - Add console log showing cohort multisig address being used - Update documentation to reflect multisig vs individual signer usage Addresses Derek's feedback in PR nucypher#693 to use the deployed cohort multisig contract (e.g., 0x857949079dB532301157Eb7Fb5AEC3398043A186) instead of individual signer addresses for ERC-1271 compatibility. Successfully tested - demo retrieves correct multisig and executes transactions.
…gner - Add getCohortMultisigAddress() method to SigningCoordinatorAgent - Calls getSigningCoordinatorChild(chainId) to get child contract - Uses cohortMultisigs(cohortId) mapping to get actual multisig address - Update taco-mdt-aa-signing demo to use cohort multisig address - Replace signers[0] placeholder with proper deployed multisig contract - Add console log showing cohort multisig address being used - Update documentation to reflect multisig vs individual signer usage Addresses Derek's feedback in PR nucypher#693 to use the deployed cohort multisig contract (e.g., 0x857949079dB532301157Eb7Fb5AEC3398043A186) instead of individual signer addresses for ERC-1271 compatibility. Successfully tested - demo retrieves correct multisig and executes transactions.
a0519f0 to
0004216
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Also it is good to have a follow-up task to check and add possible abstracted code to taco-web, if it was generic enough to be so.
Summary
Demo Features
Test Plan