-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add transformer that converts 4337 User Ops -> pseudo transactions #291
Conversation
accessing the transformer from children using children[key] returns a value of type any since key isn't a const so the type of children[key] cannot be known
to prep for supporting PseudoTransactions
most transformers don't need the block and can operate on one transaction at a time
src/transformers/_common/accountAbstraction/accounts/unknown.ts
Outdated
Show resolved
Hide resolved
sigHash: String(trace.action.input).slice(0, 10), | ||
})); | ||
export const transform: TxnTransformer = (_block, tx) => { | ||
if (!isRawTransaction(tx)) return tx; |
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.
@datadanne Why was this needed for this one but not for the others?
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.
If you find anything based on this investigation, we can circle back in a follow-up PR. This doesn't need to block merging.
Notes
Next steps
How it works
Split all User Operations from transactions sent to the ERC4337 entrypoint into separate 'UserOp transactions' (1 transaction to the entrypoint can include multiple user operations). This steps also removes log entries from the entry point contract and the eth transfer from the entry point to the bundler that submitted the transaction since those are not relevant to the user operation
Decode the call from the entry point to the smart account contract. Smart account contracts all contain functions that the entry point calls that then executes the user operation, so we need to decode that function call and get the arguments from that to get to what the user wants to do. There are lots of different account implementations where the entrypoint fn signature differ slightly but do the same thing:
After these two steps the existing contextualizers can use the same logic as for non-ERC4337 transactions to give context to the transaction, I've included examples for a token approval, token transfer, eth transfer and an nft mint.
This WIP implementation only supports transactions where each user operation only contains "one action" (either just
execute
orexecuteBatch
with just one action)The diff is best viewed with whitespace hidden (https://github.com/Once-Upon/context/pull/291/files?diff=unified&w=1)