Skip to content

fix to field in delegation quickstart #2158

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alexandratran
Copy link
Contributor

@alexandratran alexandratran commented Jul 18, 2025

Description

Fix incorrect to field in the redeem delegation step in the delegation quickstart.

Issue(s) fixed

Fixes #2082

Preview

https://metamask-docs-me6d08aa4-consensys-ddffed67.vercel.app/delegation-toolkit/development/get-started/delegation-quickstart/#7-redeem-the-delegation

Checklist

Complete this checklist before merging your PR:

  • If this PR contains a major change to the documentation content, I have added an entry to the top of the "What's new?" page.
  • The proposed changes have been reviewed and approved by a member of the documentation team.

@alexandratran alexandratran requested review from a team as code owners July 18, 2025 21:54
Copy link

vercel bot commented Jul 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
metamask-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2025 10:11pm

@@ -146,7 +146,7 @@ const userOperationHash = await bundlerClient.sendUserOperation({
account: delegateSmartAccount,
calls: [
{
to: delegateSmartAccount.address,
to: delegatorSmartAccount.address,
Copy link
Member

Choose a reason for hiding this comment

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

I'm not actually sure if we should document delegatorSmartAccount. It assumes the delegatorSmartAccount will be present always which is not the case, if the delegations are stored, or if delegations are used in different environment to redeem like server, it won't stand true. Hence it was using delegateSmartAccount.address. Maybe we should change the documentation for redeemDelegation rather than quickstart. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we keep delegateSmartAccount here, what about the issue stated in #2082?

Using the delegate's address causes the UserOperation to fail, often with no clear error unless debugged deeply. The delegation signature isn't validated on the delegate’s account, which leads to invalid operations.

Copy link
Member

Choose a reason for hiding this comment

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

It should work fine, when redeemDelegations is called on Smart Account, it just works as a proxy for delegation manager. So all the calls are passed and processed by Delegation manager.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Delegation Redemption Redirects to Incorrect Account

The to address for delegation redemption was incorrectly changed from the delegate's smart account to the delegator's smart account. This forces the delegate to call the delegator's account, which is logically incorrect and assumes the delegator's account is always available. This breaks redemption functionality in environments where the delegator's account may not be present (e.g., servers), as the delegate should directly execute the DelegationManager call through their own account, as originally designed.

delegation-toolkit/get-started/delegation-quickstart.md#L148-L149

{
to: delegatorSmartAccount.address,

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@Rahul-cyber26 Rahul-cyber26 mentioned this pull request Jul 19, 2025
2 tasks
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.

to field in sendUserOperation() is incorrect in Quick Start example
2 participants