-
Notifications
You must be signed in to change notification settings - Fork 564
Suggested Smart Account Changes #378
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
Conversation
dbefd29
to
84d042e
Compare
79041d6
to
9296637
Compare
df921df
to
1228434
Compare
@@ -20,10 +20,12 @@ import "lib/dynamic-contracts/src/core/Router.sol"; | |||
contract ManagedAccount is AccountCore, Router { | |||
address public factory; | |||
|
|||
constructor(IEntryPoint _entrypoint) AccountCore(_entrypoint) {} | |||
constructor(IEntryPoint _entrypoint) AccountCore(_entrypoint) { | |||
_disableInitializers(); |
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.
what does this do? is to prevent initializing the implementation itself?
isnt that already handled by the initializer
modifier?
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.
The _disableInitializer
function has a different job than the initializer
modifier.
You call the _disableInitializer
function inside the constructor of the implementation smart contract instance to make sure that no one can call the initialize
function on the implementation and mutate its state.
From reading the code -- calling _disableInitializer
inside the implementation contract's constructor is a good practice and a recommendation in the code comments, but not doing this does not affect the proxy contracts that point at it.
Code comments for _disableInitializer
:
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ | | ||
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/ | ||
|
||
abstract contract BaseAccountFactory is IAccountFactory, Multicall { |
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.
nice de-duping here, thanks for refactoring that
No description provided.