-
Notifications
You must be signed in to change notification settings - Fork 613
Expand file tree
/
Copy pathRollupOperationsExtLib.sol
More file actions
85 lines (77 loc) · 3.06 KB
/
Copy pathRollupOperationsExtLib.sol
File metadata and controls
85 lines (77 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024 Aztec Labs.
// solhint-disable imports-order
pragma solidity >=0.8.27;
import {Errors} from "@aztec/core/libraries/Errors.sol";
import {STFLib} from "@aztec/core/libraries/rollup/STFLib.sol";
import {Timestamp, TimeLib, Slot, Epoch} from "@aztec/core/libraries/TimeLib.sol";
import {BlobLib} from "@aztec-blob-lib/BlobLib.sol";
import {AttestationLib} from "@aztec/core/libraries/rollup/AttestationLib.sol";
import {
ProposeLib,
ProposeArgs,
CommitteeAttestations,
ValidateHeaderArgs,
ValidatorSelectionLib
} from "./ProposeLib.sol";
import {Signature} from "@aztec/shared/libraries/SignatureLib.sol";
/**
* @title RollupOperationsExtLib - External Rollup Library (Proposal Functions)
* @author Aztec Labs
* @notice External library containing proposal-related functions for the Rollup contract to avoid exceeding max
* contract size.
*
* @dev This library serves as an external library for the Rollup contract, splitting off proposal-related
* functionality to keep the main contract within the maximum contract size limit. Epoch-proof functions
* live in EpochProofExtLib to keep this library itself deployable. The library contains external
* functions primarily focused on:
* - Checkpoint proposal submission and validation
* - Blob validation and commitment management
* - Chain pruning operations
*/
library RollupOperationsExtLib {
using TimeLib for Timestamp;
using TimeLib for Slot;
using AttestationLib for CommitteeAttestations;
function validateHeaderWithAttestations(
ValidateHeaderArgs calldata _args,
CommitteeAttestations calldata _attestations,
address[] calldata _signers,
Signature calldata _attestationsAndSignersSignature
) external {
ProposeLib.validateHeader(_args);
if (_attestations.isEmpty()) {
return; // No attestations to validate
}
Slot slot = _args.header.slotNumber;
Epoch epoch = slot.epochFromSlot();
ValidatorSelectionLib.verifyAttestations(epoch, _attestations, _args.digest);
ValidatorSelectionLib.verifyProposer(
slot, epoch, _attestations, _signers, _args.digest, _attestationsAndSignersSignature, false
);
}
function propose(
ProposeArgs calldata _args,
CommitteeAttestations memory _attestations,
address[] calldata _signers,
Signature calldata _attestationsAndSignersSignature,
bytes calldata _blobInput,
bool _checkBlob
) external {
ProposeLib.propose(_args, _attestations, _signers, _attestationsAndSignersSignature, _blobInput, _checkBlob);
}
function prune() external {
require(STFLib.canPruneAtTime(Timestamp.wrap(block.timestamp)), Errors.Rollup__NothingToPrune());
STFLib.prune();
}
function validateBlobs(bytes calldata _blobsInput, bool _checkBlob)
external
view
returns (bytes32[] memory blobHashes, bytes32 blobsHashesCommitment, bytes[] memory blobCommitments)
{
return BlobLib.validateBlobs(_blobsInput, _checkBlob);
}
function getBlobBaseFee() external view returns (uint256) {
return BlobLib.getBlobBaseFee();
}
}