-
Notifications
You must be signed in to change notification settings - Fork 383
Migrate fep ecdsa #556
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
base: develop
Are you sure you want to change the base?
Migrate fep ecdsa #556
Conversation
| * The addresses and threshold are managed by the aggchainManager. | ||
| */ | ||
| contract AggchainECDSAMultisig is AggchainBase { | ||
| contract AggchainECDSAMultisig is AggchainBase, MigrationFEPToECDSASlots { |
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.
do you both @invocamanman and @krlosMata agree on this approach?
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 it is not needed, although is does not hurt.
A comment should be enough since the storage slots fulfilled are just not used.
It is needed a deeper analysis if the chain goes again to FEP. Check if the storage slots are rewritten or can potentially imply a security issue
|
|
||
| /// @notice Aggchain version | ||
| string public constant AGGCHAIN_ECDSA_MULTISIG_VERSION = "v1.0.0"; | ||
| string public constant AGGCHAIN_ECDSA_MULTISIG_VERSION = "v1.0.1"; |
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.
unsure if this makes sense. breaks a lot of stuff. but since the contract is changing we need versioning? using semver, +0.0.1 since its not breaking
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.
it does not. I'd increase also to v1.0.1
| address public pendingOptimisticModeManager; | ||
| mapping(bytes32 => AggchainFEP.OpSuccinctConfig) public opSuccinctConfigs; | ||
| bytes32 public selectedOpSuccinctConfigName; | ||
| bytes32 public lastRollupExitRoot; |
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 are you adding this storage that is not from FEP? There is an old deployed version of aggchainFEP with this storage? 🤔 (same for lastMainnetExitRoot, globalExitRootMap)
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.
good catch. i messed it with the copy paste. fixed 2818965
| bytes32 public selectedOpSuccinctConfigName; | ||
| bytes32 public lastRollupExitRoot; | ||
| bytes32 public lastMainnetExitRoot; | ||
| mapping(bytes32 => uint256) public globalExitRootMap; |
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 would consider adding a _gap[50] for future upgrades of FEP
|
check contract LegacyZKEVMStateVariables { I woudl do a very similar approach here, changing names and adig the custom ox renamed from |
|
Remmeber to: |
|
There is one issue with this feature. Due to how initializers work when using upgradable contracts, there is an implicit assumption that the only allowed path is ECDSA->FEP (not the opposite way), see This means that as it is, if we add a new path FEP->ECDSA, we will create an inconsistency in a migration that goes FEP->ECDSA->FEP. In the ECDSA->FEP transition initializeFromECDSAMultisig can't be called anymore, due to the modifier, leading to an inconsistency. This makes this function work only sometimes (when state n-2 was not FEP). This doesn't seem ok to me. One option would be to remove the |
|
I think it depends on the design that we want to take id a chain decides to move from
|
|
@krlosMata agree with your approaches, but wanted to also address this concern.
|
I think it is not an inconsistency. This function can be called the first time that we move from |
yep. more than inconsistency i mean that is not idempotent. you can use the setters but you can no longer call initializeFromECDSAMultisig the second time. If that fine, i think your Design B makes sense. |
contracts/aggchains/AggchainFEP.sol
Outdated
|
|
||
| function reinitializel2Outputs() external { | ||
| // Clear the array by popping all elements | ||
| while (l2Outputs.length > 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.
just setting the length to 0 is enough
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.
cant directly set it to 0.
TypeError: Member "length" is read-only and cannot be used to resize arrays.
--> contracts/aggchains/AggchainFEP.sol:446:9:
|
446 | l2Outputs.length = 0;
| ^^^^^^^^^^^^^^^^
But i can call delete. fixed a27bfd6
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.
older solidity versions allowed it
contracts/aggchains/AggchainFEP.sol
Outdated
| } | ||
| } | ||
|
|
||
| function reinitializel2Outputs() external { |
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.
missing onlyRollupManager
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.
fixed a27bfd6
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.
using onlyAggchainManager as discussed privately
contracts/AgglayerManager.sol
Outdated
| // If update from FEP to ECDSA, clear l2Outputs before upgrade. | ||
| // This ensures if it migrates back to FEP, the l2Outputs are empty. | ||
| if ( | ||
| rollup.rollupVerifierType == VerifierType.ALGateway && |
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 adding chain specific configuration in the AgglayerManager.sol should not be done....it should be at Chains SC level.
Also, we lost history of previous verified states which may be useful.
I think it better to manage this exact same function, but on the chain implementation. I think it is easier on the long-term rather than managing all of them in the Manager
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 see. removed here. a27bfd6
the function call can be passed now as rollupData
a27bfd6#diff-5c5d2e61f08010833196980538de8ebd806d00d53326e4ba06319f3474d7d30bR440
|
Summary of the FEP->ECDSA migration:
|
Uh oh!
There was an error while loading. Please reload this page.