-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathExtRollupLib.sol
126 lines (117 loc) · 4.21 KB
/
ExtRollupLib.sol
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024 Aztec Labs.
pragma solidity >=0.8.27;
import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol";
import {IProofCommitmentEscrow} from "@aztec/core/interfaces/IProofCommitmentEscrow.sol";
import {IProofCommitmentEscrow} from "@aztec/core/interfaces/IProofCommitmentEscrow.sol";
import {BlockLog, RollupStore, SubmitEpochRootProofArgs} from "@aztec/core/interfaces/IRollup.sol";
import {IRewardDistributor} from "@aztec/governance/interfaces/IRewardDistributor.sol";
import {IERC20} from "@oz/token/ERC20/IERC20.sol";
import {DataStructures} from "./../DataStructures.sol";
import {Slot, Epoch} from "./../TimeLib.sol";
import {BlobLib} from "./BlobLib.sol";
import {
EpochProofLib,
SubmitEpochRootProofAddresses,
SubmitEpochRootProofInterimValues
} from "./EpochProofLib.sol";
import {SignedEpochProofQuote} from "./EpochProofQuoteLib.sol";
import {FeeMath, ManaBaseFeeComponents, FeeHeader, L1FeeData} from "./FeeMath.sol";
import {HeaderLib, Header} from "./HeaderLib.sol";
import {ValidationLib, ValidateHeaderArgs} from "./ValidationLib.sol";
// We are using this library such that we can more easily "link" just a larger external library
// instead of a few smaller ones.
library ExtRollupLib {
function submitEpochRootProof(
RollupStore storage _rollupStore,
SubmitEpochRootProofArgs calldata _args,
SubmitEpochRootProofInterimValues memory _interimValues,
IProofCommitmentEscrow _proofCommitmentEscrow,
IFeeJuicePortal _feeJuicePortal,
IRewardDistributor _rewardDistributor,
IERC20 _asset,
address _cuauhxicalli
) external returns (uint256) {
return EpochProofLib.submitEpochRootProof(
_rollupStore,
_args,
_interimValues,
SubmitEpochRootProofAddresses({
proofCommitmentEscrow: _proofCommitmentEscrow,
feeJuicePortal: _feeJuicePortal,
rewardDistributor: _rewardDistributor,
asset: _asset,
cuauhxicalli: _cuauhxicalli
})
);
}
function validateHeaderForSubmissionBase(
ValidateHeaderArgs memory _args,
mapping(uint256 blockNumber => BlockLog log) storage _blocks
) external view {
ValidationLib.validateHeaderForSubmissionBase(_args, _blocks);
}
function validateEpochProofRightClaimAtTime(
Slot _currentSlot,
address _currentProposer,
Epoch _epochToProve,
uint256 _posInEpoch,
SignedEpochProofQuote calldata _quote,
bytes32 _digest,
DataStructures.EpochProofClaim storage _proofClaim,
uint256 _claimDurationInL2Slots,
uint256 _proofCommitmentMinBondAmountInTst,
IProofCommitmentEscrow _proofCommitmentEscrow
) external view {
ValidationLib.validateEpochProofRightClaimAtTime(
_currentSlot,
_currentProposer,
_epochToProve,
_posInEpoch,
_quote,
_digest,
_proofClaim,
_claimDurationInL2Slots,
_proofCommitmentMinBondAmountInTst,
_proofCommitmentEscrow
);
}
function getManaBaseFeeComponentsAt(
FeeHeader storage _parentFeeHeader,
L1FeeData memory _fees,
uint256 _feeAssetPrice,
uint256 _epochDuration
) external view returns (ManaBaseFeeComponents memory) {
return
FeeMath.getManaBaseFeeComponentsAt(_parentFeeHeader, _fees, _feeAssetPrice, _epochDuration);
}
function getEpochProofPublicInputs(
RollupStore storage _rollupStore,
uint256 _epochSize,
bytes32[7] calldata _args,
bytes32[] calldata _fees,
bytes calldata _blobPublicInputs,
bytes calldata _aggregationObject
) external view returns (bytes32[] memory) {
return EpochProofLib.getEpochProofPublicInputs(
_rollupStore, _epochSize, _args, _fees, _blobPublicInputs, _aggregationObject
);
}
function validateBlobs(bytes calldata _blobsInput, bool _checkBlob)
external
view
returns (
bytes32[] memory blobHashes,
bytes32 blobsHashesCommitment,
bytes32 blobPublicInputsHash
)
{
return BlobLib.validateBlobs(_blobsInput, _checkBlob);
}
function getBlobBaseFee(address _vmAddress) external view returns (uint256) {
return BlobLib.getBlobBaseFee(_vmAddress);
}
function decodeHeader(bytes calldata _header) external pure returns (Header memory) {
return HeaderLib.decode(_header);
}
}