Skip to content
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: BLS key rotation #249

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from
Open

feat: BLS key rotation #249

wants to merge 19 commits into from

Conversation

0x0aa0
Copy link
Contributor

@0x0aa0 0x0aa0 commented Apr 29, 2024

No description provided.

Base automatically changed from feat/reregistration-delay to dev April 30, 2024 14:19
@0x0aa0 0x0aa0 marked this pull request as ready for review May 13, 2024 23:52
Copy link
Contributor

@samlaf samlaf left a comment

Choose a reason for hiding this comment

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

Just did a quick glance review. Will try to summarize what this is doing to make sure I'm not missing anything:

  • operator can either be ejected (force deregister) or deregister by themself
  • both of those have cooldowns (ejectionCooldown and deregistrationCooldown) which force the operator to wait before reregistering
  • We keep the entire history of registered bn254 G1 pubkey hash onchain, such that the AVS can slash an operator for misbehavior using a previous key

Have a Q related to why we need deregistrationCooldown below.

// Check that the operator can reregister
require(
lastEjectionTimestamp[operator] + ejectionCooldown < block.timestamp &&
lastDeregistrationTimestamp[operator] + deregistrationCooldown < block.timestamp,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need a deregistrationCooldown if we keep the entire history of keys onchain?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or is 0 a reasonable value for deregistrationCooldown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gpsanant has suggested this should be a few days. I think something like an hour is more reasonable

Copy link
Contributor

Choose a reason for hiding this comment

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

this...limits the rate at which operators can edit their keys. I don't think it's serving a serious purpose beyond maybe addressing some theoretical worry where an operator keeps changing their key? I guess if you need to search past keys it's potentially problematic if the growth rate of the historical storage isn't limited?

Comment on lines +455 to +457
function setDeregistrationCooldown(uint256 _deregistrationCooldown) external onlyOwner {
deregistrationCooldown = _deregistrationCooldown;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

needs an event.
might want this added to the initializer as well.

I'm considering if any input sanitization makes sense here too -- should this have a min or max? is 0 an OK input? I feel like it's probably OK to not have this, given the owner-only nature of the function... I don't see any super "unsafe" values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't add to init because of bytecode size but I will see if it can be squeezed in. I could see really long values being not great for the delay but will probably not add sanitization for the same bytecode size issue

Copy link
Contributor

Choose a reason for hiding this comment

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

discussed in-person, no sanitization seems OK, not in initializer is also acceptable to me (although not my ideal), no event is something I can live with but probably the most desirable of these

Copy link
Contributor

@ChaoticWalrus ChaoticWalrus left a comment

Choose a reason for hiding this comment

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

Looks quite good. I have a few questions + minor suggestions but this is on the right track.

Copy link
Contributor

@ChaoticWalrus ChaoticWalrus left a comment

Choose a reason for hiding this comment

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

The new view functions LGTM. They differ a bit from the pattern elsewhere due to the historical storage model being different here, but as far as I can tell it's all written correctly. Adding some unit tests that verify the behavior of these view functions would be 🔥 but I'm not going to require that for my approval on this PR.
The nits that I would have considered blocking on have been addressed.
Nice work 👍

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.

3 participants