-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: Deferred Validation Installation #177
Conversation
4d980b3
to
23c298e
Compare
Contract sizes: | Contract | Size (B) | Margin (B) |
|------------------------------|----------|------------|
| AccountFactory | 4,763 | 19,813 |
| ERC1967Proxy | 104 | 24,472 |
| ModularAccount | 26,483 | -1,907 |
| SemiModularAccount | 27,540 | -2,964 |
| SingleSignerValidationModule | 3,444 | 21,132 |
| TokenReceiverModule | 2,189 | 22,387 | Code coverage:
|
By the way, the use of the |
Summary by OctaneNew ContractsNo new contracts were added in this PR. Updated Contracts
🔗 Commit Hash: 8f72474 |
Overview
Detailed findings
|
ff550f2
to
21b45d0
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.
Awesome feature 🔥
Had a few small comments
validationFunction, deferredValidationInstallData, deferredInstallSig | ||
); | ||
|
||
// Use a self-call to install the deferred validation. |
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.
question: can we use the internal _installValidation
, or do we need to convert calldata types to memory types?
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 _installValidation()
does do some calldata bytes slicing. It's possible to modify it to work internally in memory, but we might have efficiency loss in the standard installValidation()
case. My thoughts were to just keep it simple and run a self-call. Wdyt?
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.
Ah yep, that's what I thought. The current approach makes sense, no need to do big refactors at the moment imo.
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.
Looks good, 1. small nit
src/account/ModularAccount.sol
Outdated
@@ -352,32 +369,151 @@ contract ModularAccount is | |||
override | |||
returns (uint256 validationData) | |||
{ | |||
// Use outer validation as 1271 validation, then installed validation to validate the rest |
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.
tiny tiny nit: I think this comment only applies in the case where we're using the deferred validation install path, so could you move this comment to within the if (isDeferredInstallValidation) {
block?
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.
Done!
Motivation
We want to support flows like deferring session key installs until the first action that requires them.
Solution
During UO validation, use a specific (previously unused) bit in the signature field to indicate whether or not a deferred validation is necessary. If so, decode part of the signature field into the data needed to validate and install the inner validation. Note that the standard validation packing scheme (for the first 24 bytes of the signature) is, in this case, the validation used to validate the installation.
Post-installation, validate the user operation with the newly installed validation.