From 06e88b311ef27618b4b878a78cbbb24358104ab9 Mon Sep 17 00:00:00 2001 From: quaq <56312047+0x0aa0@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:40:59 -0600 Subject: [PATCH] update blob verifier (#992) --- contracts/src/core/EigenDABlobVerifier.sol | 2 +- contracts/src/interfaces/IEigenDAStructs.sol | 1 - .../EigenDABlobVerificationUtils.sol | 26 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/contracts/src/core/EigenDABlobVerifier.sol b/contracts/src/core/EigenDABlobVerifier.sol index 34c93e9d6d..d89198e391 100644 --- a/contracts/src/core/EigenDABlobVerifier.sol +++ b/contracts/src/core/EigenDABlobVerifier.sol @@ -134,7 +134,7 @@ contract EigenDABlobVerifier is IEigenDABlobVerifier { return EigenDABlobVerificationUtils._getNonSignerStakesAndSignature( operatorStateRetriever, registryCoordinator, - signedBatch.attestation + signedBatch ); } diff --git a/contracts/src/interfaces/IEigenDAStructs.sol b/contracts/src/interfaces/IEigenDAStructs.sol index faa5eab441..5413929dba 100644 --- a/contracts/src/interfaces/IEigenDAStructs.sol +++ b/contracts/src/interfaces/IEigenDAStructs.sol @@ -103,7 +103,6 @@ struct Attestation { BN254.G1Point sigma; BN254.G2Point apkG2; uint32[] quorumNumbers; - uint32 referenceBlockNumber; } ///////////////////////// SIGNATURE VERIFIER /////////////////////////////// diff --git a/contracts/src/libraries/EigenDABlobVerificationUtils.sol b/contracts/src/libraries/EigenDABlobVerificationUtils.sol index 694c01d5d4..0a08de8844 100644 --- a/contracts/src/libraries/EigenDABlobVerificationUtils.sol +++ b/contracts/src/libraries/EigenDABlobVerificationUtils.sol @@ -307,7 +307,7 @@ library EigenDABlobVerificationUtils { NonSignerStakesAndSignature memory nonSignerStakesAndSignature = _getNonSignerStakesAndSignature( operatorStateRetriever, registryCoordinator, - signedBatch.attestation + signedBatch ); _verifyBlobV2ForQuorums( @@ -336,7 +336,7 @@ library EigenDABlobVerificationUtils { NonSignerStakesAndSignature memory nonSignerStakesAndSignature = _getNonSignerStakesAndSignature( operatorStateRetriever, registryCoordinator, - signedBatch.attestation + signedBatch ); _verifyBlobV2ForQuorumsForThresholds( @@ -354,30 +354,30 @@ library EigenDABlobVerificationUtils { function _getNonSignerStakesAndSignature( OperatorStateRetriever operatorStateRetriever, IRegistryCoordinator registryCoordinator, - Attestation memory attestation + SignedBatch memory signedBatch ) internal view returns (NonSignerStakesAndSignature memory nonSignerStakesAndSignature) { - bytes32[] memory nonSignerOperatorIds = new bytes32[](attestation.nonSignerPubkeys.length); - for (uint i = 0; i < attestation.nonSignerPubkeys.length; ++i) { - nonSignerOperatorIds[i] = BN254.hashG1Point(attestation.nonSignerPubkeys[i]); + bytes32[] memory nonSignerOperatorIds = new bytes32[](signedBatch.attestation.nonSignerPubkeys.length); + for (uint i = 0; i < signedBatch.attestation.nonSignerPubkeys.length; ++i) { + nonSignerOperatorIds[i] = BN254.hashG1Point(signedBatch.attestation.nonSignerPubkeys[i]); } bytes memory quorumNumbers; - for (uint i = 0; i < attestation.quorumNumbers.length; ++i) { - quorumNumbers = abi.encodePacked(quorumNumbers, uint8(attestation.quorumNumbers[i])); + for (uint i = 0; i < signedBatch.attestation.quorumNumbers.length; ++i) { + quorumNumbers = abi.encodePacked(quorumNumbers, uint8(signedBatch.attestation.quorumNumbers[i])); } OperatorStateRetriever.CheckSignaturesIndices memory checkSignaturesIndices = operatorStateRetriever.getCheckSignaturesIndices( registryCoordinator, - attestation.referenceBlockNumber, + signedBatch.batchHeader.referenceBlockNumber, quorumNumbers, nonSignerOperatorIds ); nonSignerStakesAndSignature.nonSignerQuorumBitmapIndices = checkSignaturesIndices.nonSignerQuorumBitmapIndices; - nonSignerStakesAndSignature.nonSignerPubkeys = attestation.nonSignerPubkeys; - nonSignerStakesAndSignature.quorumApks = attestation.quorumApks; - nonSignerStakesAndSignature.apkG2 = attestation.apkG2; - nonSignerStakesAndSignature.sigma = attestation.sigma; + nonSignerStakesAndSignature.nonSignerPubkeys = signedBatch.attestation.nonSignerPubkeys; + nonSignerStakesAndSignature.quorumApks = signedBatch.attestation.quorumApks; + nonSignerStakesAndSignature.apkG2 = signedBatch.attestation.apkG2; + nonSignerStakesAndSignature.sigma = signedBatch.attestation.sigma; nonSignerStakesAndSignature.quorumApkIndices = checkSignaturesIndices.quorumApkIndices; nonSignerStakesAndSignature.totalStakeIndices = checkSignaturesIndices.totalStakeIndices; nonSignerStakesAndSignature.nonSignerStakeIndices = checkSignaturesIndices.nonSignerStakeIndices;