Querying for Proposers
Use the pointers below to determine whether an upcoming proposer has opted in to mev-commit or not.
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:
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:
Then cd into the repo and run the query script:
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.