@@ -6,11 +6,10 @@ import {
66 SubmitEpochRootProofArgs,
77 PublicInputArgs,
88 IRollupCore,
9- RollupStore,
10- BlockHeaderValidationFlags
9+ RollupStore
1110} from "@aztec/core/interfaces/IRollup.sol " ;
12- import {ChainTipsLib, CompressedChainTips} from "@aztec/core/libraries/compressed-data/Tips.sol " ;
1311import {TempBlockLog} from "@aztec/core/libraries/compressed-data/BlockLog.sol " ;
12+ import {ChainTipsLib, CompressedChainTips} from "@aztec/core/libraries/compressed-data/Tips.sol " ;
1413import {Constants} from "@aztec/core/libraries/ConstantsGen.sol " ;
1514import {Errors} from "@aztec/core/libraries/Errors.sol " ;
1615import {BlobLib} from "@aztec/core/libraries/rollup/BlobLib.sol " ;
@@ -215,6 +214,31 @@ library EpochProofLib {
215214 return publicInputs;
216215 }
217216
217+ /**
218+ * @notice Verifies the attestations for the last block in the epoch
219+ * @param _endBlockNumber The last block number in the epoch
220+ * @param _attestations The attestations to verify
221+ */
222+ function verifyLastBlockAttestations (
223+ uint256 _endBlockNumber ,
224+ CommitteeAttestations memory _attestations
225+ ) private {
226+ // Get the stored attestation hash and payload digest for the last block
227+ TempBlockLog memory blockLog = STFLib.getTempBlockLog (_endBlockNumber);
228+
229+ // Verify that the provided attestations match the stored hash
230+ bytes32 providedAttestationsHash = keccak256 (abi.encode (_attestations));
231+ require (
232+ providedAttestationsHash == blockLog.attestationsHash, Errors.Rollup__InvalidAttestations ()
233+ );
234+
235+ // Get the slot and epoch for the last block
236+ Slot slot = blockLog.slotNumber;
237+ Epoch epoch = STFLib.getEpochForBlock (_endBlockNumber);
238+
239+ ValidatorSelectionLib.verify (slot, epoch, _attestations, blockLog.payloadDigest);
240+ }
241+
218242 function assertAcceptable (uint256 _start , uint256 _end ) private view returns (Epoch) {
219243 RollupStore storage rollupStore = STFLib.getStorage ();
220244
@@ -294,29 +318,4 @@ library EpochProofLib {
294318 function addressToField (address _a ) private pure returns (bytes32 ) {
295319 return bytes32 (uint256 (uint160 (_a)));
296320 }
297-
298- /**
299- * @notice Verifies the attestations for the last block in the epoch
300- * @param _endBlockNumber The last block number in the epoch
301- * @param _attestations The attestations to verify
302- */
303- function verifyLastBlockAttestations (
304- uint256 _endBlockNumber ,
305- CommitteeAttestations memory _attestations
306- ) private {
307- // Get the stored attestation hash and payload digest for the last block
308- TempBlockLog memory blockLog = STFLib.getTempBlockLog (_endBlockNumber);
309-
310- // Verify that the provided attestations match the stored hash
311- bytes32 providedAttestationsHash = keccak256 (abi.encode (_attestations));
312- require (
313- providedAttestationsHash == blockLog.attestationsHash, Errors.Rollup__InvalidAttestations ()
314- );
315-
316- // Get the slot and epoch for the last block
317- Slot slot = blockLog.slotNumber;
318- Epoch epoch = STFLib.getEpochForBlock (_endBlockNumber);
319-
320- ValidatorSelectionLib.verify (slot, epoch, _attestations, blockLog.payloadDigest);
321- }
322321}
0 commit comments