Skip to content

Feat: generate parameters for checkSignatures by referencing OperatorStateRetriever on-chain #461

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 44 commits into from
May 6, 2025

Conversation

ypatil12
Copy link
Collaborator

Motivation:

Computation of the parameters needed for signature verification is typically done through the Eigen go or rust services. However, the rust services are not reliable at the current moment and some projects might want to have signature verifications without having to rely on these services.

This PR aims to make the computation of the NonSignerStakesAndSignature parameter easier and accessible through implementing it in OperatorStateRetriever contract

Modifications:

added getNonSignerStakesAndSignature to OperatorStateRetriever
added BN256G2 solidity library dependency
Result:

Computing the data necessary for performing signature verification is more accessible

rubydusa and others added 30 commits March 11, 2025 16:05
Co-authored-by: Tomás Grüner <[email protected]>
rubydusa and others added 7 commits April 10, 2025 22:40
refactor: import path

refactor: rename

format: forge fmt
**Motivation:**

Computation of the parameters needed for signature verification is typically done through the Eigen go or rust services. However, the rust services are not reliable at the current moment and some projects might want to have signature verifications without having to rely on these services.

This PR aims to make the computation of the `NonSignerStakesAndSignature` parameter easier and accessible through implementing it in `OperatorStateRetriever` contract
 
**Modifications:**

- added `getNonSignerStakesAndSignature` to `OperatorStateRetriever` 
- added BN256G2 solidity library dependency

**Result:**

Computing the data necessary for performing signature verification is more accessible
@RonTuretzky
Copy link
Contributor

lgtm!

1 similar comment
@RonTuretzky
Copy link
Contributor

lgtm!

* @param p The point to check, in G1
* @return true if the point lies on the curve, false otherwise
*/
function _isOnCurve(
Copy link
Contributor

Choose a reason for hiding this comment

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

should be a library method

Copy link
Contributor

Choose a reason for hiding this comment

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

ISlashingRegistryCoordinator registryCoordinator,
bytes calldata quorumNumbers,
BN254.G1Point calldata sigma,
address[] calldata operators,
Copy link
Contributor

Choose a reason for hiding this comment

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

i think people want to call this with operatorIds, not addresses?

Copy link
Contributor

Choose a reason for hiding this comment

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

I highly doubt that they will... we can duplicate this method to add another entrypoint with operator ids though


// Trim the nonSignerOperatorIds array to the actual count
bytes32[] memory trimmedNonSignerOperatorIds = new bytes32[](nonSignerOperatorsCount);
for (uint256 i = 0; i < nonSignerOperatorsCount; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

combine this loop and the next

Copy link
Contributor

Choose a reason for hiding this comment

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

.getQuorumBitmapAtBlockNumberByIndex(
m.signingOperatorIds[i], blockNumber, signingOperatorQuorumBitmapIndices[i]
);
require(signingOperatorQuorumBitmap != 0, OperatorNotRegistered());
Copy link
Contributor

Choose a reason for hiding this comment

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

this should make sure they intersect with quorumNumbers

Copy link
Contributor

Choose a reason for hiding this comment

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

address operator = registryCoordinator.getOperatorFromId(operatorIds[i]);
BN254.G1Point memory operatorPk;
(operatorPk.X, operatorPk.Y) = blsApkRegistry.operatorToPubkey(operator);
apk = BN254.plus(apk, operatorPk);
Copy link
Contributor

Choose a reason for hiding this comment

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

apk.plus(operatorPk)

Copy link
Contributor

Choose a reason for hiding this comment

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

rubydusa added 3 commits May 2, 2025 15:16
fix: make quorumNotCreated tests have valid quorumNumber lists
chore: `BN254.plus` -> `apk.plus`
@rubydusa
Copy link
Contributor

rubydusa commented May 2, 2025

I opened #469 because I don't have write access to this branch

@rubydusa
Copy link
Contributor

rubydusa commented May 2, 2025

About the CI errors:
For some reason there are problems with the storage layout checks.
The error messages are a bit cryptic but I think based on the .md extension there is a requirement that every solidity file will have a markdown document?
@gpsanant WDYT?

Run if diff --unified pr target; then
Only in pr: BLSSigCheckOperatorStateRetriever.md
Only in pr: BN256G2.md
Error: Differences found between PR and target branch storage layouts
Error: Process completed with exit code 1.

CI run

@rubydusa
Copy link
Contributor

rubydusa commented May 2, 2025

Also, only now I noticed the commitlint CI check fails.
I would prefer to avoid to edit the commit messages because it would break all previous PRs and discussions due to modified hashes.
Is it maybe possible to ignore the commintlint CI specifically for this PR?

@ypatil12
Copy link
Collaborator Author

ypatil12 commented May 2, 2025

Don't worry about the storage issues or CI errors on this one. @rubydusa

Fixes for BLSSigCheckOperatorStateRetriever
@ypatil12
Copy link
Collaborator Author

ypatil12 commented May 5, 2025

cc @gpsanant for re-review

* @param p The point to check, in G1
* @return true if the point lies on the curve, false otherwise
*/
function isOnCurve(
Copy link
Contributor

Choose a reason for hiding this comment

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

should be part of the BN254.sol library? or was this done due to lack of audit?

Copy link
Contributor

Choose a reason for hiding this comment

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

Lack of audit, didn't want to change BN254

@ypatil12 ypatil12 merged commit 08e16bd into dev May 6, 2025
4 of 5 checks passed
@ypatil12 ypatil12 deleted the local/on-chain-check-sigs branch May 6, 2025 15:20
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.

9 participants