Set of Opted-in Validators

The validator registry contract maintains a set of validators who are opted in to the mev-commit protocol. This is achieved by requiring those validators to stake ether with the registry on behalf of their BLS public key.

Anyone can query the full set of validator pubkeys who have opted in to mev-commit by calling the getNumberOfStakedValidators function in conjunction with getStakedValidators on the validator registry contract. See the following signatures:

/// @return numStakedValidators uint number of currently staked validators. 
/// @return stakedValsetVersion uint version of the staked valset at the time of query.
function getNumberOfStakedValidators() external view returns (uint256, uint256);

/// @dev Returns an array of staked validator BLS pubkeys within the specified range. Ordering is unspecified.
/// We require users to query in batches, with knowledge from getNumberOfStakedValidators().
///
/// Note Only 1000 validator pubkeys can be queried per batch, as an application-level rate limiting 
/// mechanism preventing a user from overwhelming a node with a large query.
///
/// @return set of staked validator BLS pubkeys.
/// @return stakedValsetVersion uint version of the staked valset at the time of query.
function getStakedValidators(uint256 start, uint256 end) external view returns (bytes[] memory, uint256);

The returned stakedValsetVersion is updated on-chain anytime the set of opted-in validators changes. This value can be used for debugging and/or as an optimistic locking mechanism to ensure the set of validators hasn’t changed during a batch query.

That is, if all queries in a batch return the same stakedValsetVersion, the aggregate staked validator set is valid. Otherwise handling is left to the user (who will likely retry the batch query).

Note geth supports batched RPC requests which can be used to speed up this process.

Golang example

You can programmatically query the validator registry via golang scripts.

For example, to query the full set of staked validators, use this example script as described below.

First clone the validator-registry repo:

❯_ terminal
git clone https://github.com/primev/validator-registry.git

Then cd into the repo and run the query script:

❯_ terminal
cd validator-registry/cmd/query
go run main.go

This script can act as a starting point for integrating validator registry queries into your own tooling. The contract’s go binding is available here.

Upcoming Proposers

To determine whether the proposer for a certain L1 slot has opted in to mev-commit, you can cross-check the full set of opted-in validators, with knowledge of proposer selection on the beacon chain.

Note proposer selection is only stable within the context of the current epoch, and must be checked during the epoch in question. See specification here and here.

To query proposer selection on the beacon chain, use the getProposerDuties endpoint.

The mev-commit-oracle will streamline this process by updating a contract on the mev-commit chain with opted-in proposers for the current L1 epoch.