-
Notifications
You must be signed in to change notification settings - Fork 10
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/sma 809 potential account factories #73
Conversation
Feat/sma 809 potential account factory (Draft)
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
also linking this here |
contracts/utils/Bootstrap.sol
Outdated
|
||
/** | ||
* This function is intended to be called by the MSA with a delegatecall. | ||
* Make sure that the MSA already initilazed the linked lists in the ModuleManager prior to |
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.
typo
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.
initilazed
contracts/utils/Bootstrap.sol
Outdated
} | ||
|
||
function _getInitMSACalldata( | ||
BootstrapConfig[] calldata $valdiators, |
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.
typo
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.
which typo?
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.
valdiators
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 agree to all the proposed changes. Question re MetaFactory
|
…getting init nexus calldata
… BOOTSTRAPPER.getInitNexusScopedCalldata function
…getting init nexus calldata
Got some thoughts on the recent PR. I think we can simplify things and make it more efficient
this will reduce gas with less external calls, simplify initData structure and reduce the number of contracts (files)
Lmk what your thoughts |
Chore/account factory refactoring
There are some review comments I am keeping and leaving a note here. NexusAccountFactory ModuleWhitelistFactory K1ValidatorFactory |
🤖 Slither Analysis Report 🔎Slither report
# Slither report
_This comment was automatically generated by the GitHub Actions workflow._
THIS CHECKLIST IS NOT COMPLETE. Use controlled-delegatecall🔴 Impact: High
|
couple of things may be reverted from this change. first, here is the list of changes below and then I would dive into discussion and link the PR for further experimental changes.
1. Stakeable
Added common/Stakeable contract (which is Ownable) that can be inherited by the factory [ Or any entity which needs a stake on the entry point for that matter ]
2. AccountFactory minor changes
base StakeManager was wrong.
now Factory inherits from Stakeable which makes it also Owned. Using this owner we could further add access controlled actions like whitelisting one or more modules, Or setting ERC7484 registry which checks on module being installed
also it felt right to rename getCounterFactualAddress -> computeAccountAddress :))
3.small) Took a snapshot of current AccountFactory in case we start editing this one in current branch
that would mean altering createAccount method from
function createAccount(address validationModule, bytes calldata moduleInstallData, uint256 index)
to something
which can
i. accept generic initData to be directly posted on the account (account.call(initData)) / initData to call specific method on the account INexus.initializeAccount(initData)
ii. accepts array of modules and setup datas, or packed data and factory knows how to decode those and check agaisnt some whitelist.
4. BiconomyMetaFactory. inspired from kernel's factory staker
Stakeable Ownable Factory, idea is to use this as meta factory and it's address will be part of the initcode and under the hood you can use any approved (only approved ones) factory using deployUsingFactory() method.
clear benefit is you can gatekeep factories
if the approved/whitelisted factory has generic call data then issue reported by holterhaus still remains. perhaps these factories can have initial validator/few modules enshrined or whitelisted
in the future you can just add a new factory under the hood and start using it.
con might be added gas but that comes with any kind of whitelisting anywhere or when addressing security concerns.
5. Bootstrap.sol
singleton bootstrap contract inspired from ERC7579 reference implementation
this contract has util methods to prepare the module installation calldata
it would work like this in Nexus initialisation
using Bootstrap util contract one can make bootstrap config using array of modules to be installed upon.
implementation is not altered in this branch to use this bootstrap contract
but experimental changes are here with evolved Bootstrap contract
https://github.com/bcnmy/nexus/blob/test/showcase-alterations-using-bootstrap/contracts/utils/Bootstrap.sol#L82
P.S - This does not help resolve Holterhaus reported issue but only to allow installing multiple modules. If we go with this approach I haven't thought about how to decode bootstrap config and make checks for individual module addresses or payloads.