-
Notifications
You must be signed in to change notification settings - Fork 347
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
[WIP] Chain registrar #1064
base: release-v25-protocol-defense
Are you sure you want to change the base?
[WIP] Chain registrar #1064
Conversation
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
9cfe4de
to
5579d5a
Compare
Signed-off-by: Danil <[email protected]>
Signed-off-by: Danil <[email protected]>
8b32b48
to
65c9acb
Compare
Signed-off-by: Danil <[email protected]>
65c9acb
to
7610082
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.
have a feeling that will improve UX by x2 :)
// require(success); | ||
// address chainAdmin = bytesToAddress(returnData); | ||
address chainAdmin = IGetters(diamondProxy).getAdmin(); | ||
address l2BridgeAddress = bridgehub.sharedBridge().l2BridgeAddress(chainId); |
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.
Hm, you can do that without specifying class?
IL1SharedBridge(bridgehub.sharedBridge()).l2BridgeAddress(chainId);
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.
Yes, we can. Because it's already specified.
emit NewChainDeployed(chainId, diamondProxy, author, chainAdmin); | ||
emit SharedBridgeRegistered(chainId, l2BridgeAddress); |
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.
If these are always emitted together - any point of not putting l2BridgeAddress into NewChainDeployed?
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 was thinking about it, but for the future those events, will be most likely independent. because it's two different actions and for not breaking the future interface I think it's better to make it like this from the very beginning
// (bool success, bytes memory returnData) = diamondProxy.call(abi.encodeWithSelector(IGetters.getAdmin.selector)); | ||
// require(success); | ||
// address chainAdmin = bytesToAddress(returnData); | ||
address chainAdmin = IGetters(diamondProxy).getAdmin(); |
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 as alternative:
address chainAdmin = IStateTransitionManager(stm).getChainAdmin(chainId);
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.
we need pendingAdmin... and IGetter is the only way
baseToken: BaseToken({ | ||
tokenAddress: tokenAddress, | ||
tokenMultiplierSetter: tokenMultiplierSetter, | ||
gasPriceMultiplierNominator: gasPriceMultiplierNominator, |
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.
maybe adding more validations on gasPriceMultiplierNominator
, I'd say at min check both values are 1, 1 if base token is ETH
uint128 gasPriceMultiplierNominator, | ||
uint128 gasPriceMultiplierDenominator | ||
) public { | ||
ChainConfig memory config = ChainConfig({ |
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.
should we also think about returning base token once the registration is done ? :D
idk, if it makes sense to keep author there...
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.
No, we need some token to operate on chain in the future
Signed-off-by: Danil <[email protected]>
revert ChainIsNotYetDeployed(); | ||
} | ||
address diamondProxy = IStateTransitionManager(stm).getHyperchain(chainId); | ||
(bool success, bytes memory returnData) = diamondProxy.call(abi.encodeWithSelector(IGetters.getAdmin.selector)); |
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.
for some reasons only this way correctly work with tests, meanwhile all selectors are identical
emit NewChainDeployed(chainId, diamondProxy, author, chainAdmin); | ||
emit SharedBridgeRegistered(chainId, l2BridgeAddress); |
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 was thinking about it, but for the future those events, will be most likely independent. because it's two different actions and for not breaking the future interface I think it's better to make it like this from the very beginning
uint128 gasPriceMultiplierNominator, | ||
uint128 gasPriceMultiplierDenominator | ||
) public { | ||
ChainConfig memory config = ChainConfig({ |
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.
No, we need some token to operate on chain in the future
// (bool success, bytes memory returnData) = diamondProxy.call(abi.encodeWithSelector(IGetters.getAdmin.selector)); | ||
// require(success); | ||
// address chainAdmin = bytesToAddress(returnData); | ||
address chainAdmin = IGetters(diamondProxy).getAdmin(); |
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.
we need pendingAdmin... and IGetter is the only way
// require(success); | ||
// address chainAdmin = bytesToAddress(returnData); | ||
address chainAdmin = IGetters(diamondProxy).getAdmin(); | ||
address l2BridgeAddress = bridgehub.sharedBridge().l2BridgeAddress(chainId); |
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.
Yes, we can. Because it's already specified.
3883f46
to
e10fc7a
Compare
Signed-off-by: Danil <[email protected]>
e10fc7a
to
863a189
Compare
What ❔
Add Chain registrar contracts, that allow partners to register their chains and then configure their chain from L1
Why ❔
For making our registration process a bit more transparent and later on make it even easier
Checklist