Skip to content

Commit 7784f75

Browse files
committed
fix(fast-inbox): split epoch-proof functions into EpochProofExtLib to stay deployable (A-1384)
The streaming inbox consumption validation in ProposeLib pushed RollupOperationsExtLib past the EIP-170 deployable size limit (25470 > 24576), failing every real deployment (test_rollup_upgrade.sh). Move submitEpochRootProof and getEpochProofPublicInputs into a new EpochProofExtLib external library, leaving both libraries with comfortable margins (19296 and 13440 bytes).
1 parent 6c863a0 commit 7784f75

4 files changed

Lines changed: 44 additions & 23 deletions

File tree

l1-contracts/src/core/Rollup.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {
4141
Epoch,
4242
Timestamp,
4343
CommitteeAttestations,
44+
EpochProofExtLib,
4445
RollupOperationsExtLib,
4546
ValidatorOperationsExtLib,
4647
EthValue,
@@ -300,7 +301,7 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
300301
ProposedHeader[] calldata _headers,
301302
bytes calldata _blobPublicInputs
302303
) external view override(IRollup) returns (bytes32[] memory) {
303-
return RollupOperationsExtLib.getEpochProofPublicInputs(_start, _end, _args, _headers, _blobPublicInputs);
304+
return EpochProofExtLib.getEpochProofPublicInputs(_start, _end, _args, _headers, _blobPublicInputs);
304305
}
305306

306307
/**

l1-contracts/src/core/RollupCore.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol";
1818
import {Constants} from "@aztec/core/libraries/ConstantsGen.sol";
1919
import {CommitteeAttestations} from "@aztec/core/libraries/rollup/AttestationLib.sol";
2020
import {Errors} from "@aztec/core/libraries/Errors.sol";
21+
import {EpochProofExtLib} from "@aztec/core/libraries/rollup/EpochProofExtLib.sol";
2122
import {RollupOperationsExtLib} from "@aztec/core/libraries/rollup/RollupOperationsExtLib.sol";
2223
import {ValidatorOperationsExtLib} from "@aztec/core/libraries/rollup/ValidatorOperationsExtLib.sol";
2324
import {SlasherDeploymentExtLib} from "@aztec/core/libraries/rollup/SlasherDeploymentExtLib.sol";
@@ -466,7 +467,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
466467
* @param _args Contains the epoch range, public inputs, fees, attestations, and the ZK proof
467468
*/
468469
function submitEpochRootProof(SubmitEpochRootProofArgs calldata _args) external override(IRollupCore) {
469-
RollupOperationsExtLib.submitEpochRootProof(_args);
470+
EpochProofExtLib.submitEpochRootProof(_args);
470471
}
471472

472473
/**
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright 2024 Aztec Labs.
3+
pragma solidity >=0.8.27;
4+
5+
import {SubmitEpochRootProofArgs, PublicInputArgs} from "@aztec/core/interfaces/IRollup.sol";
6+
import {ProposedHeader} from "@aztec/core/libraries/rollup/ProposedHeaderLib.sol";
7+
import {EpochProofLib} from "./EpochProofLib.sol";
8+
9+
/**
10+
* @title EpochProofExtLib - External Rollup Library (Epoch Proof Functions)
11+
* @author Aztec Labs
12+
* @notice External library containing epoch-proof functions for the Rollup contract to avoid exceeding max
13+
* contract size.
14+
*
15+
* @dev This library serves as an external library for the Rollup contract, splitting off the epoch proof
16+
* submission and public-input computation from RollupOperationsExtLib, which the streaming inbox
17+
* validation pushed over the deployable size limit. The library contains external functions primarily
18+
* focused on:
19+
* - Epoch proof submission and verification
20+
* - Epoch proof public input computation
21+
*/
22+
library EpochProofExtLib {
23+
function submitEpochRootProof(SubmitEpochRootProofArgs calldata _args) external {
24+
EpochProofLib.submitEpochRootProof(_args);
25+
}
26+
27+
function getEpochProofPublicInputs(
28+
uint256 _start,
29+
uint256 _end,
30+
PublicInputArgs calldata _args,
31+
ProposedHeader[] calldata _headers,
32+
bytes calldata _blobPublicInputs
33+
) external view returns (bytes32[] memory) {
34+
return EpochProofLib.getEpochProofPublicInputs(_start, _end, _args, _headers, _blobPublicInputs);
35+
}
36+
}

l1-contracts/src/core/libraries/rollup/RollupOperationsExtLib.sol

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
pragma solidity >=0.8.27;
55

66
import {Errors} from "@aztec/core/libraries/Errors.sol";
7-
import {SubmitEpochRootProofArgs, PublicInputArgs} from "@aztec/core/interfaces/IRollup.sol";
87
import {STFLib} from "@aztec/core/libraries/rollup/STFLib.sol";
98
import {Timestamp, TimeLib, Slot, Epoch} from "@aztec/core/libraries/TimeLib.sol";
109
import {BlobLib} from "@aztec-blob-lib/BlobLib.sol";
11-
import {EpochProofLib} from "./EpochProofLib.sol";
12-
import {ProposedHeader} from "@aztec/core/libraries/rollup/ProposedHeaderLib.sol";
1310
import {AttestationLib} from "@aztec/core/libraries/rollup/AttestationLib.sol";
1411
import {
1512
ProposeLib,
@@ -21,16 +18,16 @@ import {
2118
import {Signature} from "@aztec/shared/libraries/SignatureLib.sol";
2219

2320
/**
24-
* @title RollupOperationsExtLib - External Rollup Library (Proposal and Proof Verification Functions)
21+
* @title RollupOperationsExtLib - External Rollup Library (Proposal Functions)
2522
* @author Aztec Labs
2623
* @notice External library containing proposal-related functions for the Rollup contract to avoid exceeding max
2724
* contract size.
2825
*
2926
* @dev This library serves as an external library for the Rollup contract, splitting off proposal-related
30-
* functionality to keep the main contract within the maximum contract size limit. The library contains
31-
* external functions primarily focused on:
27+
* functionality to keep the main contract within the maximum contract size limit. Epoch-proof functions
28+
* live in EpochProofExtLib to keep this library itself deployable. The library contains external
29+
* functions primarily focused on:
3230
* - Checkpoint proposal submission and validation
33-
* - Epoch proof submission and verification
3431
* - Blob validation and commitment management
3532
* - Chain pruning operations
3633
*/
@@ -39,10 +36,6 @@ library RollupOperationsExtLib {
3936
using TimeLib for Slot;
4037
using AttestationLib for CommitteeAttestations;
4138

42-
function submitEpochRootProof(SubmitEpochRootProofArgs calldata _args) external {
43-
EpochProofLib.submitEpochRootProof(_args);
44-
}
45-
4639
function validateHeaderWithAttestations(
4740
ValidateHeaderArgs calldata _args,
4841
CommitteeAttestations calldata _attestations,
@@ -78,16 +71,6 @@ library RollupOperationsExtLib {
7871
STFLib.prune();
7972
}
8073

81-
function getEpochProofPublicInputs(
82-
uint256 _start,
83-
uint256 _end,
84-
PublicInputArgs calldata _args,
85-
ProposedHeader[] calldata _headers,
86-
bytes calldata _blobPublicInputs
87-
) external view returns (bytes32[] memory) {
88-
return EpochProofLib.getEpochProofPublicInputs(_start, _end, _args, _headers, _blobPublicInputs);
89-
}
90-
9174
function validateBlobs(bytes calldata _blobsInput, bool _checkBlob)
9275
external
9376
view

0 commit comments

Comments
 (0)