-
Notifications
You must be signed in to change notification settings - Fork 38
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: Factory Deployment Script #318
Conversation
43d5021
to
db63642
Compare
e3fa152
to
065b98c
Compare
Note that the factory address prediction reads addresses from the env for dependencies, rather than using the predicted addresses in the same script, as those may differ from the predicted addresses. |
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, had a couple small comments
script/DeployFactory.s.sol
Outdated
expectedFactoryAddr = vm.envOr("FACTORY", address(0)); | ||
factorySalt = vm.envOr("FACTORY_SALT", uint256(0)); |
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.
I think the current var used in the .env.example
file is ACCOUNT_FACTORY
and ACCOUNT_FACTORY_SALT
. I'm fine with using either that or the one here, but could you make it consistent across the locations?
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.
Will do! Good catch, in my infinite wisdom I didn't check .env.example :)
script/GetInitcodeHash.s.sol
Outdated
} else { | ||
console.log("Using user-defined EntryPoint at: %x", address(entryPoint)); | ||
} | ||
IEntryPoint entryPoint = _getEntryPoint(); //IEntryPoint(payable(vm.envOr("ENTRYPOINT", address(0)))); |
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.
nit: delete comment
} | ||
|
||
function _getSemiModularAccountBytecodeImpl() internal view returns (SemiModularAccountBytecode) { | ||
return SemiModularAccountBytecode(payable(vm.envOr("SEMI_MODULAR_ACCOUNT_BYTECODE_IMPL", address(0)))); |
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.
I think there's a different format already set up in .env.example
without the _IMPL
ending, could you make that consistent here too?
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.
Yup, will do!
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.
Oops-- actually the one in .env.example
has _IMPL
, I'd say we're good to keep it, it ensures the developer knows we're looking for an implementation, not an actual account.
test/script/DeployFactory.s.t.sol
Outdated
entryPoint = IEntryPoint(address(6)); | ||
modularAccountImpl = ModularAccount(payable(address(1))); | ||
semiModularAccountBytecodeImpl = SemiModularAccountBytecode(payable(address(2))); | ||
singleSignerValidationModule = address(3); | ||
webAuthnValidationModule = address(4); |
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.
Why not deploy real copies of them? The EP can use the deploy script in OptimizedTest.
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.
Honestly, could go either way, I just didn't really want to test anything related to deploying anything else-- but it's a small change, I'll address this!
test/script/DeployFactory.s.t.sol
Outdated
semiModularAccountBytecodeImpl = SemiModularAccountBytecode(payable(address(2))); | ||
singleSignerValidationModule = address(3); | ||
webAuthnValidationModule = address(4); | ||
factoryOwner = address(5); |
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.
nit: prefer makeAddr
over incrementing numbers due to appearing as precompiles in the test traces.
Motivation
We need scripts to predict the factory address and to deploy it.
Solution
Implement the aforementioned scripts, as well as some minor refactors to reduce resulting code duplication.
TODO