Invalid delegate
The Delegation ManagerDelegation Manager The component that validates and redeems delegations, including signature checks and caveat enforcer hooks. reverts with InvalidDelegate() in the following two cases.
Account is not the delegate
The account redeeming the delegation is not the delegateDelegate account The account that receives delegated authority and can redeem a delegation under its constraints. specified in the delegation.
The Delegation Manager checks that msg.sender matches the delegate field of
the delegation, unless it's an open delegation.
Solution
Verify that the account redeeming the delegation matches the address in the
delegation's to field. If the delegate is a smart account, send the user operationUser operation A signed instruction package that tells a smart account what executions to perform.
from that smart account.
Broken redelegation chain
When Delegation Manager validates a redelegation chain, each child delegation's delegatorDelegator account The account that creates and signs a delegation to grant limited authority to another account.
must match the parent delegation's delegateDelegate account The account that receives delegated authority and can redeem a delegation under its constraints.. If any link in the chain fails this check, the
authority is invalid.
Solution
Verify that the redelegation chain is consistent. For each pair of adjacent
delegations, the child's delegator must be the parent's delegate.
This error can also occur if the delegations are not passed in the correct order. The delegation array order should be from leaf to root.
For example, if the delegation chain is Alice to Bob to Carol, the order should be following:
const rootDelegation = createDelegation({
from: "0xAlice",
to: "0xBob",
//..
})
const leafDelegation = createDelegation({
from: "OxBob",
to: "0xCarol",
parentDelegation: rootDelegation,
// ...
})
const data = DelegationManager.encode.redeemDelegations({
// Make sure the order is from leaf to root.
// Passing them in the wrong order causes the authority validation to fail.
delegations: [[ leafDelegation, rootDelegation ]],
modes: [ ExecutionMode.SingleDefault ],
executions: [[ execution ]],
});