Verified contractExactApache-2.0
RollupOperationsExtLib
Address0x33af347ef0c7c94fe013514b2b6d976ce11beb7e
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.30
- Same code
Only this contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 100 runs
- EVM version
- prague
- License
- Apache-2.0
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,160,095
- Creation transaction
- 0xe7f067c01f…f36cdcf924
91 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/core/libraries/rollup/RollupOperationsExtLib.solmain6.94 KB
- lib/openzeppelin-contracts/contracts/access/Ownable.sol3.1 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol192 B
- lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol181 B
- lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol739 B
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol9.39 KB
- lib/openzeppelin-contracts/contracts/utils/Context.sol963 B
- lib/openzeppelin-contracts/contracts/utils/Panic.sol1.97 KB
- lib/openzeppelin-contracts/contracts/utils/ShortStrings.sol4.28 KB
- lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol5.32 KB
- lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol4.18 KB
- lib/openzeppelin-contracts/contracts/utils/Strings.sol14.83 KB
- lib/openzeppelin-contracts/contracts/utils/TransientSlot.sol5.07 KB
- lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol7.82 KB
- lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol6.61 KB
- lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol3.7 KB
- lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol870 B
- lib/openzeppelin-contracts/contracts/utils/math/Math.sol29.66 KB
- lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol34.94 KB
- lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol2.61 KB
- lib/openzeppelin-contracts/contracts/utils/structs/BitMaps.sol2.02 KB
- lib/openzeppelin-contracts/contracts/utils/structs/Checkpoints.sol21.43 KB
- lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol12.89 KB
- src/core/interfaces/IEscapeHatch.sol3.58 KB
- src/core/interfaces/IFeeJuicePortal.sol1.18 KB
- src/core/interfaces/IRollup.sol13.11 KB
- src/core/interfaces/ISequencerRewardCalculator.sol2.17 KB
- src/core/interfaces/ISlasher.sol530 B
- src/core/interfaces/IStaking.sol5.72 KB
- src/core/interfaces/IValidatorSelection.sol2.98 KB
- src/core/interfaces/IVerifier.sol225 B
- src/core/interfaces/messagebridge/IInbox.sol7.21 KB
- src/core/interfaces/messagebridge/IOutbox.sol4.6 KB
- src/core/libraries/ConstantsGen.sol1.55 KB
- src/core/libraries/DataStructures.sol1.96 KB
- src/core/libraries/Errors.sol16.7 KB
- src/core/libraries/HatchMath.sol575 B
- src/core/libraries/SlashRoundLib.sol1.93 KB
- src/core/libraries/StakingQueue.sol2.31 KB
- src/core/libraries/TimeLib.sol6.05 KB
- src/core/libraries/compressed-data/CheckpointLog.sol4.15 KB
- src/core/libraries/compressed-data/StakingQueueConfig.sol2.87 KB
- src/core/libraries/compressed-data/Tips.sol2.19 KB
- src/core/libraries/compressed-data/fees/FeeConfig.sol5.17 KB
- src/core/libraries/compressed-data/fees/FeeStructs.sol5.18 KB
- src/core/libraries/crypto/Hash.sol3.03 KB
- src/core/libraries/crypto/SampleLib.sol3.77 KB
- src/core/libraries/rollup/AttestationLib.sol8.66 KB
- src/core/libraries/rollup/BlobLib.sol11.87 KB
- src/core/libraries/rollup/CoordinationSignatureLib.sol3.19 KB
- src/core/libraries/rollup/FeeLib.sol24.27 KB
- src/core/libraries/rollup/FieldLib.sol889 B
- src/core/libraries/rollup/ProposeLib.sol28.01 KB
- src/core/libraries/rollup/ProposedHeaderLib.sol2.24 KB
- src/core/libraries/rollup/RewardLib.sol20.85 KB
- src/core/libraries/rollup/STFLib.sol25.95 KB
- src/core/libraries/rollup/SequencerRewardCalculatorLib.sol5.93 KB
- src/core/libraries/rollup/StakingLib.sol51.03 KB
- src/core/libraries/rollup/ValidatorSelectionLib.sol37.95 KB
- src/core/reward-boost/RewardBooster.sol5.04 KB
- src/core/slashing/Slasher.sol2.91 KB
- src/governance/Bn254LibWrapper.sol752 B
- src/governance/GSE.sol39.93 KB
- src/governance/GSEPayload.sol6.29 KB
- src/governance/Governance.sol32.6 KB
- src/governance/interfaces/IBn254LibWrapper.sol459 B
- src/governance/interfaces/IEmpire.sol1.3 KB
- src/governance/interfaces/IGovernance.sol3.91 KB
- src/governance/interfaces/IGovernanceProposer.sol359 B
- src/governance/interfaces/IPayload.sol597 B
- src/governance/interfaces/IProposerPayload.sol327 B
- src/governance/interfaces/IRegistry.sol1.21 KB
- src/governance/interfaces/IRewardDistributor.sol1.28 KB
- src/governance/libraries/AddressSnapshotLib.sol9.83 KB
- src/governance/libraries/CheckpointedUintLib.sol3.02 KB
- src/governance/libraries/ConfigurationLib.sol5 KB
- src/governance/libraries/DepositDelegationLib.sol10.98 KB
- src/governance/libraries/Errors.sol4.49 KB
- src/governance/libraries/ProposalLib.sol8.54 KB
- src/governance/libraries/compressed-data/Ballot.sol2.33 KB
- src/governance/libraries/compressed-data/Configuration.sol4.5 KB
- src/governance/libraries/compressed-data/Proposal.sol6.35 KB
- src/governance/proposer/EmpireBase.sol12.69 KB
- src/governance/proposer/GovernanceProposer.sol4.25 KB
- src/mock/libraries/BlobLib.sol5.65 KB
- src/shared/libraries/BN254Lib.sol10.21 KB
- src/shared/libraries/CompressedTimeMath.sol1.27 KB
- src/shared/libraries/SignatureLib.sol983 B
- src/shared/libraries/TimeMath.sol3.54 KB
src/core/libraries/rollup/RollupOperationsExtLib.sol
// 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 {CheckpointHeaderValidationFlags, CheckpointPreflightArgs} from "@aztec/core/interfaces/IRollup.sol";
import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.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 {FeeLib} from "@aztec/core/libraries/rollup/FeeLib.sol";
import {
ProposeLib,
ProposeArgs,
ProposeConfig,
CommitteeAttestations,
ValidateHeaderArgs,
ValidatorSelectionLib
} from "./ProposeLib.sol";
import {ProposedHeader} from "./ProposedHeaderLib.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;
/**
* @dev Assembles `ValidateHeaderArgs` here rather than in the Rollup: building that struct
* (which embeds a full `ProposedHeader`) in the Rollup's own code costs several hundred
* bytes of runtime bytecode it cannot spare.
*/
function validateHeaderWithAttestations(
ProposedHeader calldata _header,
CommitteeAttestations calldata _attestations,
address[] calldata _signers,
Signature calldata _attestationsAndSignersSignature,
bytes32 _digest,
bytes32 _blobsHash,
CheckpointHeaderValidationFlags calldata _flags
) external {
checkHeaderWithAttestations(
_header, _attestations, _signers, _attestationsAndSignersSignature, _digest, _blobsHash, _flags
);
}
/**
* @notice Validates a checkpoint header together with its final Inbox consumption against the parent `propose`
* would build on at the simulated `block.timestamp`, returning the bucket sequence to submit as `bucketHint`
*
* @dev The parent is derived exactly as `propose` derives it: the effective pending checkpoint at
* `block.timestamp`, i.e. the proven tip if the pending chain is prunable at that time. The caller states
* which parent it built on and the call rejects any other, so a simulation whose state overrides do not
* survive the real prune rule fails here instead of at `propose`. The header's `lastArchiveRoot` is checked
* against that parent's archive by the shared header validation, and the parent's consumed total comes from
* its stored record, never from the caller. The Inbox check resolves `_expectedTotal` to a live bucket and runs
* the same settlement, monotonicity, cap and censorship predicate as `propose`.
*
* Meant to be simulated with the intended execution timestamp and state; the real transaction's
* `block.timestamp` remains authoritative.
*
* @param _args - The header validation inputs plus the consumed Inbox total and the expected parent
* @param _inbox - The Inbox to validate consumption against
* @return The sequence number of the bucket ending at `_args.expectedTotal`
*/
function validateCheckpointHeaderAndInbox(CheckpointPreflightArgs calldata _args, IInbox _inbox)
external
returns (uint64)
{
uint256 effectiveParent = STFLib.getEffectivePendingCheckpointNumber(Timestamp.wrap(block.timestamp));
require(
effectiveParent == _args.expectedParentCheckpointNumber,
Errors.Rollup__UnexpectedParentCheckpoint(_args.expectedParentCheckpointNumber, effectiveParent)
);
checkHeaderWithAttestations(
_args.header,
_args.attestations,
_args.signers,
_args.attestationsAndSignersSignature,
_args.digest,
_args.blobsHash,
_args.flags
);
return ProposeLib.validateInboxConsumptionAtTotal(
_inbox,
_args.header.inboxRollingHash,
_args.expectedTotal,
_args.header.slotNumber,
STFLib.getInboxMsgTotal(effectiveParent)
);
}
function propose(
ProposeArgs calldata _args,
CommitteeAttestations memory _attestations,
address[] calldata _signers,
Signature calldata _attestationsAndSignersSignature,
bytes calldata _blobInput,
bool _checkBlob,
IInbox _inbox
) external {
ProposeLib.propose(
_args,
_attestations,
_signers,
_attestationsAndSignersSignature,
_blobInput,
ProposeConfig({inbox: _inbox, checkBlob: _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();
}
function checkHeaderWithAttestations(
ProposedHeader calldata _header,
CommitteeAttestations calldata _attestations,
address[] calldata _signers,
Signature calldata _attestationsAndSignersSignature,
bytes32 _digest,
bytes32 _blobsHash,
CheckpointHeaderValidationFlags calldata _flags
) internal {
ProposeLib.validateHeader(
ValidateHeaderArgs({
header: _header,
digest: _digest,
manaMinFee: FeeLib.summedMinFee(ProposeLib.getManaMinFeeComponentsAt(Timestamp.wrap(block.timestamp), true)),
blobsHashesCommitment: _blobsHash,
flags: _flags
})
);
if (_attestations.isEmpty()) {
return; // No attestations to validate
}
Slot slot = _header.slotNumber;
Epoch epoch = slot.epochFromSlot();
ValidatorSelectionLib.verifyAttestations(epoch, _attestations, _digest);
ValidatorSelectionLib.verifyProposer(
slot, epoch, _attestations, _signers, _digest, _attestationsAndSignersSignature, false
);
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 100,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"@oz/=lib/openzeppelin-contracts/contracts/",
"@aztec/=src/",
"@test/=test/",
"@generated/=generated/",
"@zkpassport/=lib/circuits/src/solidity/src/",
"@zkpassport-test/=lib/circuits/src/solidity/test/",
"@aztec-blob-lib/=src/mock/libraries/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"circuits/=lib/circuits/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.