-
Notifications
You must be signed in to change notification settings - Fork 598
Expand file tree
/
Copy pathIRollup.sol
More file actions
239 lines (205 loc) · 8.64 KB
/
IRollup.sol
File metadata and controls
239 lines (205 loc) · 8.64 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024 Aztec Labs.
pragma solidity >=0.8.27;
import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol";
import {IVerifier} from "@aztec/core/interfaces/IVerifier.sol";
import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol";
import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol";
import {
BlockLog, CompressedTempBlockLog
} from "@aztec/core/libraries/compressed-data/BlockLog.sol";
import {StakingQueueConfig} from "@aztec/core/libraries/compressed-data/StakingQueueConfig.sol";
import {CompressedChainTips, ChainTips} from "@aztec/core/libraries/compressed-data/Tips.sol";
import {
FeeHeader, L1FeeData, ManaBaseFeeComponents
} from "@aztec/core/libraries/rollup/FeeLib.sol";
import {FeeAssetPerEthE9, EthValue, FeeAssetValue} from "@aztec/core/libraries/rollup/FeeLib.sol";
import {ProposedHeader} from "@aztec/core/libraries/rollup/ProposedHeaderLib.sol";
import {ProposeArgs} from "@aztec/core/libraries/rollup/ProposeLib.sol";
import {RewardConfig} from "@aztec/core/libraries/rollup/RewardLib.sol";
import {RewardBoostConfig} from "@aztec/core/reward-boost/RewardBooster.sol";
import {IHaveVersion} from "@aztec/governance/interfaces/IRegistry.sol";
import {IRewardDistributor} from "@aztec/governance/interfaces/IRewardDistributor.sol";
import {CommitteeAttestations} from "@aztec/shared/libraries/SignatureLib.sol";
import {Timestamp, Slot, Epoch} from "@aztec/shared/libraries/TimeMath.sol";
import {IERC20} from "@oz/token/ERC20/IERC20.sol";
struct PublicInputArgs {
bytes32 previousArchive;
bytes32 endArchive;
address proverId;
}
struct SubmitEpochRootProofArgs {
uint256 start; // inclusive
uint256 end; // inclusive
PublicInputArgs args;
bytes32[] fees;
CommitteeAttestations attestations; // attestations for the last block in epoch
bytes blobInputs;
bytes proof;
}
/**
* @notice Struct for storing flags for block header validation
* @param ignoreDA - True will ignore DA check, otherwise checks
*/
struct BlockHeaderValidationFlags {
bool ignoreDA;
}
struct GenesisState {
bytes32 vkTreeRoot;
bytes32 protocolContractTreeRoot;
bytes32 genesisArchiveRoot;
}
struct RollupConfigInput {
uint256 aztecSlotDuration;
uint256 aztecEpochDuration;
uint256 targetCommitteeSize;
uint256 aztecProofSubmissionEpochs;
uint256 slashingQuorum;
uint256 slashingRoundSize;
uint256 slashingLifetimeInRounds;
uint256 slashingExecutionDelayInRounds;
address slashingVetoer;
uint256 manaTarget;
uint256 exitDelaySeconds;
EthValue provingCostPerMana;
RewardConfig rewardConfig;
RewardBoostConfig rewardBoostConfig;
StakingQueueConfig stakingQueueConfig;
}
struct RollupConfig {
bytes32 vkTreeRoot;
bytes32 protocolContractTreeRoot;
uint32 version;
IERC20 feeAsset;
IFeeJuicePortal feeAssetPortal;
IRewardDistributor rewardDistributor;
IVerifier epochProofVerifier;
IInbox inbox;
IOutbox outbox;
}
struct RollupStore {
CompressedChainTips tips; // put first such that the struct slot structure is easy to follow for cheatcodes
mapping(uint256 blockNumber => bytes32 archive) archives;
mapping(uint256 blockNumber => CompressedTempBlockLog temp) tempBlockLogs;
RollupConfig config;
}
interface IRollupCore {
event L2BlockProposed(
uint256 indexed blockNumber, bytes32 indexed archive, bytes32[] versionedBlobHashes
);
event L2ProofVerified(uint256 indexed blockNumber, address indexed proverId);
event BlockInvalidated(uint256 indexed blockNumber);
event RewardConfigUpdated(RewardConfig rewardConfig);
event ManaTargetUpdated(uint256 indexed manaTarget);
event PrunedPending(uint256 provenBlockNumber, uint256 pendingBlockNumber);
event RewardsClaimableUpdated(bool isRewardsClaimable);
function preheatHeaders() external;
function setRewardsClaimable(bool _isRewardsClaimable) external;
function claimSequencerRewards(address _recipient) external returns (uint256);
function claimProverRewards(address _recipient, Epoch[] memory _epochs)
external
returns (uint256);
function prune() external;
function updateL1GasFeeOracle() external;
function setProvingCostPerMana(EthValue _provingCostPerMana) external;
function propose(
ProposeArgs calldata _args,
CommitteeAttestations memory _attestations,
address[] memory _signers,
bytes calldata _blobInput
) external;
function submitEpochRootProof(SubmitEpochRootProofArgs calldata _args) external;
function invalidateBadAttestation(
uint256 _blockNumber,
CommitteeAttestations memory _attestations,
address[] memory _committee,
uint256 _invalidIndex
) external;
function invalidateInsufficientAttestations(
uint256 _blockNumber,
CommitteeAttestations memory _attestations,
address[] memory _committee
) external;
function setRewardConfig(RewardConfig memory _config) external;
function updateManaTarget(uint256 _manaTarget) external;
// solhint-disable-next-line func-name-mixedcase
function L1_BLOCK_AT_GENESIS() external view returns (uint256);
}
interface IRollup is IRollupCore, IHaveVersion {
function validateHeaderWithAttestations(
ProposedHeader calldata _header,
CommitteeAttestations memory _attestations,
address[] memory _signers,
bytes32 _digest,
bytes32 _blobsHash,
BlockHeaderValidationFlags memory _flags
) external;
function canProposeAtTime(Timestamp _ts, bytes32 _archive, address _who)
external
returns (Slot, uint256);
function getTips() external view returns (ChainTips memory);
function status(uint256 _myHeaderBlockNumber)
external
view
returns (
uint256 provenBlockNumber,
bytes32 provenArchive,
uint256 pendingBlockNumber,
bytes32 pendingArchive,
bytes32 archiveOfMyBlock,
Epoch provenEpochNumber
);
function getEpochProofPublicInputs(
uint256 _start,
uint256 _end,
PublicInputArgs calldata _args,
bytes32[] calldata _fees,
bytes calldata _blobPublicInputs
) external view returns (bytes32[] memory);
function validateBlobs(bytes calldata _blobsInputs)
external
view
returns (bytes32[] memory, bytes32, bytes[] memory);
function getManaBaseFeeComponentsAt(Timestamp _timestamp, bool _inFeeAsset)
external
view
returns (ManaBaseFeeComponents memory);
function getManaBaseFeeAt(Timestamp _timestamp, bool _inFeeAsset) external view returns (uint256);
function getL1FeesAt(Timestamp _timestamp) external view returns (L1FeeData memory);
function getFeeAssetPerEth() external view returns (FeeAssetPerEthE9);
function getEpochForBlock(uint256 _blockNumber) external view returns (Epoch);
function canPruneAtTime(Timestamp _ts) external view returns (bool);
function archive() external view returns (bytes32);
function archiveAt(uint256 _blockNumber) external view returns (bytes32);
function getProvenBlockNumber() external view returns (uint256);
function getPendingBlockNumber() external view returns (uint256);
function getBlock(uint256 _blockNumber) external view returns (BlockLog memory);
function getFeeHeader(uint256 _blockNumber) external view returns (FeeHeader memory);
function getBlobCommitmentsHash(uint256 _blockNumber) external view returns (bytes32);
function getCurrentBlobCommitmentsHash() external view returns (bytes32);
function getSharesFor(address _prover) external view returns (uint256);
function getSequencerRewards(address _sequencer) external view returns (uint256);
function getCollectiveProverRewardsForEpoch(Epoch _epoch) external view returns (uint256);
function getSpecificProverRewardsForEpoch(Epoch _epoch, address _prover)
external
view
returns (uint256);
function getHasSubmitted(Epoch _epoch, uint256 _length, address _prover)
external
view
returns (bool);
function getHasClaimed(address _prover, Epoch _epoch) external view returns (bool);
function getProofSubmissionEpochs() external view returns (uint256);
function getManaTarget() external view returns (uint256);
function getManaLimit() external view returns (uint256);
function getProvingCostPerManaInEth() external view returns (EthValue);
function getProvingCostPerManaInFeeAsset() external view returns (FeeAssetValue);
function getFeeAsset() external view returns (IERC20);
function getFeeAssetPortal() external view returns (IFeeJuicePortal);
function getRewardDistributor() external view returns (IRewardDistributor);
function getBurnAddress() external view returns (address);
function getInbox() external view returns (IInbox);
function getOutbox() external view returns (IOutbox);
function getRewardConfig() external view returns (RewardConfig memory);
function getBlockReward() external view returns (uint256);
}