Skip to content

feat: add system config consensus to deprecate clique #72

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

Closed
wants to merge 3 commits into from

Conversation

ranchalp
Copy link
Contributor

In conjunction with go-ethereum#1102.

@ranchalp ranchalp requested a review from zimpha January 15, 2025 13:16
@ranchalp ranchalp force-pushed the system-contract branch 4 times, most recently from ececf8e to e5f797e Compare January 15, 2025 13:24
*/
contract SystemSignerRegistry is Ownable {
struct Signer {
uint64 startBlock;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we decide against having the startBlock here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc we discussed it here but didn't reach a conclusion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know that had been discussed (missed that slack conversation), and had not thought of the eventual syncing from L1 thing.

I guess it technically works, but I would advice to explicitly list a blockNum (even if we have power to decide whatever blockNum we want). The reason is that otherwise the zkproof must accept any of two valid keys for commits that happened after a transition from an old signer to the new one (since for all L1 knows the change happened at the first block after the previous commit or at the last one of the current commit?).

I do agree though that it is easier to implement for now to just allow switching and accept blocks in this transitional commit from either of the signers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that otherwise the zkproof must accept any of two valid keys

Which zkproof do you mean? If you mean when we finalize bundles, currently we don't prove anything about the block signatures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Let me put it back with one signer then and forget about this orderly switching with blockNum for now (bringing it back in the future probably).

address signer;
}

Signer[] private signers;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Signer[] private signers;
mapping (address => bool) public isAuthorizedSigner;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to consider how l2geth will read this contract.

  • If it just polls the latest state asking "am I authorized?", then a mapping is suitable.
  • If it just polls the latest state asking "what is the list of current authorized signers?", then an array is suitable.
  • If it fetches events, then I'd still go with mapping.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will we have multiple authorized signer in the same time?

Copy link
Contributor Author

@ranchalp ranchalp Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we should not have multiple authorized signers at the same time in this implementation: a new key will replace the old one even if specifying the same blockNum, although for this I need to make the list in DESC order. (if we go with the easier, optimism-like implementation, then we have multiple authorized sequencers actually, i.e. see this other comment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having multiple makes key rotation a bit more convenient. But if we want to keep it simple, we can also just have one (currentAuthorizedSigner).

* The getSigners() function returns parallel arrays for block numbers and addresses,
*
*/
contract SystemSignerRegistry is Ownable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make this upgradable?

* The getSigners() function returns parallel arrays for block numbers and addresses,
*
*/
contract SystemSignerRegistry is Ownable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not model this after OP's? https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L1/SystemConfig.sol (see for example _setUnsafeBlockSigner).

@zimpha what do you think about storing multiple configs here (including gas coefficients, max gas limit, etc.)? Or is that too expensive gas-wise?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add these config here, we can pack related parameters into single uint256. Then the gas overhead will be minimum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the gas overhead of CALL (e.g. systemContract.getGasParams()), not just SLOAD, is that acceptable?

@ranchalp
Copy link
Contributor Author

ranchalp commented Jan 16, 2025

Added back one signer only. Not sure what is the error with foundry and the lib folder.

@ranchalp ranchalp force-pushed the system-contract branch 5 times, most recently from 5d9034e to 1227fb6 Compare January 16, 2025 14:10
@zimpha
Copy link
Member

zimpha commented Feb 13, 2025

refactor to #75

@zimpha zimpha closed this Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants