Skip to content

feat: avs registrar #484

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

Merged
merged 18 commits into from
Jun 2, 2025
Merged

feat: avs registrar #484

merged 18 commits into from
Jun 2, 2025

Conversation

ypatil12
Copy link
Collaborator

@ypatil12 ypatil12 commented May 29, 2025

Motivation:

We want to update the AVS registrar to be minimal & modular.

Modifications:

Add a new AVSRegistrar with first class support with the KeyRegistrar. We also have the following modules:

  1. SocketRegistry
  2. AllowList

The above modules are abstract and are inherited by AVSRegistrars in the presets folder: AVSRegistrarWithAllowlist and AVSRegistrarWithSocket.

Result:

Simple AVSRegistrar. Note that we are still pending on the KeyRegistrar interface update: Layr-Labs/eigenlayer-contracts#1421

@ypatil12 ypatil12 marked this pull request as ready for review May 30, 2025 00:37
@ypatil12 ypatil12 force-pushed the yash/avs-registrar branch from ee780a5 to 5bb905e Compare May 30, 2025 13:39
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have we considered at all about upgrading OZ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not yet, are you suggesting for unstructured storage?

*
*/

/// @notice The AVS that this registar is for

Choose a reason for hiding this comment

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

nit: registar -> registrar

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

import {Allowlist} from "../modules/Allowlist.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";

contract AVSRegistrarWithAllowlist is AVSRegistrar, Allowlist {

Choose a reason for hiding this comment

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

contract name doesn't match file name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@gpsanant gpsanant left a comment

Choose a reason for hiding this comment

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

Looks very clean. Left a couple comments and DMed you on a few things.

Also, where's the stake evaluation happening? There should be a minimum stake to join and below which ejection is permissionless.

@ypatil12
Copy link
Collaborator Author

ypatil12 commented Jun 2, 2025

Also, where's the stake evaluation happening? There should be a minimum stake to join and below which ejection is permissionless.

Stake evaluation done via operatorTableCalculator.getOperatorWeight(). We'll have entry caps in a separate template. Right now this is minimal to unblock HG. cc @gpsanant

@ypatil12 ypatil12 merged commit 3124f8f into release-dev/multichain Jun 2, 2025
4 of 5 checks passed
@ypatil12 ypatil12 deleted the yash/avs-registrar branch June 2, 2025 18:42
import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";

/// @notice A minimal AVSRegistrar contract that is used to register/deregister operators for an AVS
contract AVSRegistrar is Initializable, AVSRegistrarStorage {
Copy link
Contributor

Choose a reason for hiding this comment

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

If I needed to make this upgradeable, I'm assuming I would need to inherit and make the child contract upgradeable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also should this be abstract or is it intended to be deployed as such if you want the bare functionality?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, see what we do with the presets. Intended to be deployed as such if you want the bare functionality

Comment on lines +60 to +62
_beforeDeregisterOperator(operator, operatorSetIds);

_afterDeregisterOperator(operator, operatorSetIds);
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we just need 1 hook here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Leaving it maximally flexible for now, can change later on. One idea rn is that you may want to preempt some gas-heavy optimizations in the before hook


/// @inheritdoc ISocketRegistry
function updateSocket(address operator, string memory socket) external {
require(msg.sender == operator, CallerNotOperator());
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a check to see if the operator is registerd to atleast one operatorSet of the AVS?

Copy link
Collaborator Author

@ypatil12 ypatil12 Jun 2, 2025

Choose a reason for hiding this comment

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

Doesn't matter since the value will be useless until operator is registered

* @param socket The socket (any arbitrary string as deemed useful by an AVS) to set.
* @dev This function sets a single socket per operator, regardless of operatorSet.
*/
function _setOperatorSocket(address operator, string memory socket) internal {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this also mean that an operator has the same socket for all operator sets of an AVS?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Haven't seen a compelling reason for it to be different given HG and EigenDA

Copy link
Contributor

Choose a reason for hiding this comment

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

But we set the keys per operator set in Layr-Labs/eigenlayer-contracts#1421 right? Shouldn't we be uniform in implementation?

ypatil12 added a commit that referenced this pull request Jul 10, 2025
**Motivation:**

We want to update the AVS registrar to be minimal & modular. 

**Modifications:**

Add a new `AVSRegistrar` with first class support with the
`KeyRegistrar`. We also have the following modules:
1. `SocketRegistry`
2. `AllowList`

The above modules are _abstract_ and are inherited by `AVSRegistrars` in
the `presets` folder: `AVSRegistrarWithAllowlist` and
`AVSRegistrarWithSocket`.

**Result:**

Simple AVSRegistrar. Note that we are still pending on the
`KeyRegistrar` interface update:
Layr-Labs/eigenlayer-contracts#1421
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.

5 participants