-
Notifications
You must be signed in to change notification settings - Fork 314
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
Sovereign bridge implementation #330
Conversation
45319de
to
e7d1432
Compare
contracts/v2/sovereignChains/GlobalExitRootManagerL2SovereignChain.sol
Outdated
Show resolved
Hide resolved
contracts/v2/sovereignChains/GlobalExitRootManagerL2SovereignChain.sol
Outdated
Show resolved
Hide resolved
3e47d79
to
0dc632d
Compare
contracts/v2/sovereignChains/GlobalExitRootManagerL2SovereignChain.sol
Outdated
Show resolved
Hide resolved
ea3cb9f
to
a73bba5
Compare
jsut run the coverage:
|
also we shoudl update the 1_create genesis deployment script to be able to put a flag "sovereign" and deploy these contracts |
Ger implementation shoould write blockHashes right?¿ probably from AggLayer or L1, to mirror the behaviour of Current Global exit root Even tho in the zkResidency we though to change that to an index to help us retrieve all the improted GERs, but that depends a lot on what impementaiton we will follow to do that. |
overall LGTM ^^ but we should do a proper review ^^ |
As an added comment i think the docker does not work since the bytecode of hte new bridge contract is too big.
We should reduce the bytecode size, the eaisest way is to put it on exceptions on harhdat and lower the optimizer runs by default |
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.
😸
3059d25
to
3e8ba6f
Compare
8a0f2c1
to
97609ea
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.
😸
52e4397
to
0225d15
Compare
Add more testing Refactor function overrite Refactor GlobalExitRoot contracts for dovereign chains First testing iteration sovereign chains Review fixes Review fixes II Review fixes III Full testing coverage for sovereign contracts Added sovereign bridge features - Batch call function implementation to remap multiple tokens - Allow migrating legacy to updated tokens natively - Added weth mapped address are initializer Refactor migrateLegacyToken function Coverage tests + fix 1_genesis script + typos Fix sovereign chain deployment at docker and removed struct Add remove ger function at sovereign GER contracts Review comment and add override at initialize function Refactor gerManagerSovereigns Create batch for pessimistic networks
Update bridge at create rollup for vanilla clients Review update
a649b0f
to
0440e6c
Compare
@@ -608,7 +619,7 @@ contract PolygonZkEVMBridgeV2 is | |||
address destinationAddress, | |||
uint256 amount, | |||
bytes calldata metadata | |||
) external ifNotEmergencyState { | |||
) external virtual ifNotEmergencyState { |
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.
added virtural for no reason?¿
* @notice Updated bridge manager address | ||
* @param _bridgeManager Bridge manager address | ||
*/ | ||
function setBridgeManager( |
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.
settes/getters usually go downside of the code
*/ | ||
event RemoveLastGlobalExitRoot(bytes32 indexed removedGlobalExitRoot); | ||
|
||
modifier onlyGlobalExitRootUpdater() { |
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.
Following the rest of contrats convention, modifiers go after consturctor and initialization
// Set sovereign weth token or create new if not provided | ||
if (_sovereignWETHAddress == address(0)) { | ||
// Create a wrapped token for WETH, with salt == 0 | ||
WETHToken = _deployWrappedToken( |
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.
could check tha WETHisNotMIntable is false?¿
amount | ||
); | ||
} else { | ||
// Claim wETH |
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.
comment
) internal override { | ||
// If is not mintable transfer instead of mint | ||
if (wrappedAddressIsNotMintable[address(tokenWrapped)]) { | ||
// Transfer wETH |
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.
comment
|
||
/** | ||
* @notice Mints tokens from wrapped token to proceed with the claim, if the token is not mintable it will be transferred | ||
* note This function has been extracted to be able to override it by other contracts like Bridge2SovereignChain |
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.
commenr
Package-lock Small fix upgrade rollupManager pessimistic script
@@ -34,7 +34,7 @@ | |||
"@nomicfoundation/hardhat-toolbox": "^3.0.0", | |||
"@openzeppelin/contracts": "4.8.2", | |||
"@openzeppelin/contracts-upgradeable": "4.8.2", | |||
"@openzeppelin/contracts5": "npm:@openzeppelin/contracts@^5.0.0", | |||
"@openzeppelin/contracts5": "npm:@openzeppelin/[email protected]", |
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! ^^
Update deploy scripts with more checks Improve upgrade presimistic script
d096d19
to
ddfd159
Compare
Quality Gate passedIssues Measures |
Create Bridge and GlobalExitRootManager contracts for Sovereign chains + tests.
BridgeL2SovereignChain.sol
: extends fromPolygonZkEVMBridgeV2
with the features of:GlobalExitRootManagerL2SovereignChain.sol
: extends fromPolygonZkEVMGlobalExitRootL2
with the features of:insertGlobalExitRoot
only callable by coinbase to update the GER of a Sovereign Chain