-
Notifications
You must be signed in to change notification settings - Fork 597
Expand file tree
/
Copy pathRollup.sol
More file actions
750 lines (672 loc) · 22.3 KB
/
Rollup.sol
File metadata and controls
750 lines (672 loc) · 22.3 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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024 Aztec Labs.
pragma solidity >=0.8.27;
import {
IRollup,
IHaveVersion,
ChainTips,
PublicInputArgs,
L1FeeData,
ManaBaseFeeComponents,
FeeAssetPerEthE9,
BlockHeaderValidationFlags,
FeeHeader,
RollupConfigInput
} from "@aztec/core/interfaces/IRollup.sol";
import {
IStaking, AttesterConfig, Exit, AttesterView, Status
} from "@aztec/core/interfaces/IStaking.sol";
import {IValidatorSelection, IEmperor} from "@aztec/core/interfaces/IValidatorSelection.sol";
import {IVerifier} from "@aztec/core/interfaces/IVerifier.sol";
import {TempBlockLog, BlockLog} from "@aztec/core/libraries/compressed-data/BlockLog.sol";
import {
FeeLib, FeeHeaderLib, FeeAssetValue, PriceLib
} from "@aztec/core/libraries/rollup/FeeLib.sol";
import {ProposedHeader} from "@aztec/core/libraries/rollup/ProposedHeaderLib.sol";
import {StakingLib} from "@aztec/core/libraries/rollup/StakingLib.sol";
import {GSE} from "@aztec/governance/GSE.sol";
import {IRewardDistributor} from "@aztec/governance/interfaces/IRewardDistributor.sol";
import {
CompressedSlot,
CompressedTimestamp,
CompressedTimeMath
} from "@aztec/shared/libraries/CompressedTimeMath.sol";
import {ChainTipsLib, CompressedChainTips} from "./libraries/compressed-data/Tips.sol";
import {ProposeLib, ValidateHeaderArgs} from "./libraries/rollup/ProposeLib.sol";
import {RewardLib, RewardConfig} from "./libraries/rollup/RewardLib.sol";
import {
RollupCore,
GenesisState,
IFeeJuicePortal,
IERC20,
TimeLib,
Slot,
Epoch,
Timestamp,
Errors,
CommitteeAttestations,
ExtRollupLib,
ExtRollupLib2,
EthValue,
STFLib,
RollupStore,
IInbox,
IOutbox
} from "./RollupCore.sol";
/**
* @title Rollup
* @author Aztec Labs
* @notice A wrapper contract around the RollupCore which provides additional view functions
* which are not needed by the rollup itself to function, but makes it easy to reason
* about the state of the rollup and test it.
*/
contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
using TimeLib for Timestamp;
using TimeLib for Slot;
using TimeLib for Epoch;
using PriceLib for EthValue;
using CompressedTimeMath for CompressedSlot;
using CompressedTimeMath for CompressedTimestamp;
using ChainTipsLib for CompressedChainTips;
constructor(
IERC20 _feeAsset,
IERC20 _stakingAsset,
GSE _gse,
IVerifier _epochProofVerifier,
address _governance,
GenesisState memory _genesisState,
RollupConfigInput memory _config
)
RollupCore(
_feeAsset,
_stakingAsset,
_gse,
_epochProofVerifier,
_governance,
_genesisState,
_config
)
{}
/**
* @notice Validate a header for submission
*
* @dev This is a convenience function that can be used by the sequencer to validate a "partial" header
*
* @param _header - The header to validate
* @param _attestations - The attestations to validate
* @param _digest - The digest to validate
* @param _blobsHash - The blobs hash for this block
* @param _flags - The flags to validate
*/
function validateHeaderWithAttestations(
ProposedHeader calldata _header,
CommitteeAttestations memory _attestations,
address[] calldata _signers,
bytes32 _digest,
bytes32 _blobsHash,
BlockHeaderValidationFlags memory _flags
) external override(IRollup) {
Timestamp currentTime = Timestamp.wrap(block.timestamp);
ExtRollupLib.validateHeaderWithAttestations(
ValidateHeaderArgs({
header: _header,
digest: _digest,
manaBaseFee: getManaBaseFeeAt(currentTime, true),
blobsHashesCommitment: _blobsHash,
flags: _flags
}),
_attestations,
_signers
);
}
/**
* @notice Get the validator set for the current epoch
* @return The validator set for the current epoch
*/
function getCurrentEpochCommittee()
external
override(IValidatorSelection)
returns (address[] memory)
{
return getEpochCommittee(getCurrentEpoch());
}
/**
* @notice Get the committee for a given timestamp
*
* @param _ts - The timestamp to get the committee for
*
* @return The committee for the given timestamp
*/
function getCommitteeAt(Timestamp _ts)
external
override(IValidatorSelection)
returns (address[] memory)
{
return getEpochCommittee(getEpochAt(_ts));
}
/**
* @notice Get the committee commitment a the given timestamp
*
* @param _ts - The timestamp to get the committee for
*
* @return The committee commitment for the given timestamp
* @return The committee size for the given timestamp
*/
function getCommitteeCommitmentAt(Timestamp _ts)
external
override(IValidatorSelection)
returns (bytes32, uint256)
{
return ExtRollupLib2.getCommitteeCommitmentAt(getEpochAt(_ts));
}
/**
* @notice Get the proposer for the current slot
*
* @dev Calls `getCurrentProposer(uint256)` with the current timestamp
*
* @return The address of the proposer
*/
function getCurrentProposer() external override(IEmperor) returns (address) {
return getProposerAt(Timestamp.wrap(block.timestamp));
}
/**
* @notice Check if msg.sender can propose at a given time
*
* @param _ts - The timestamp to check
* @param _archive - The archive to check (should be the latest archive)
* @param _who - The address to check
*
* @return uint256 - The slot at the given timestamp
* @return uint256 - The block number at the given timestamp
*/
function canProposeAtTime(Timestamp _ts, bytes32 _archive, address _who)
external
override(IRollup)
returns (Slot, uint256)
{
return ExtRollupLib2.canProposeAtTime(_ts, _archive, _who);
}
function getTargetCommitteeSize() external view override(IValidatorSelection) returns (uint256) {
return ExtRollupLib2.getTargetCommitteeSize();
}
function getGenesisTime() external view override(IValidatorSelection) returns (Timestamp) {
return Timestamp.wrap(TimeLib.getStorage().genesisTime);
}
function getSlotDuration() external view override(IValidatorSelection) returns (uint256) {
return TimeLib.getStorage().slotDuration;
}
function getEpochDuration() external view override(IValidatorSelection) returns (uint256) {
return TimeLib.getStorage().epochDuration;
}
function getProofSubmissionEpochs() external view override(IRollup) returns (uint256) {
return TimeLib.getStorage().proofSubmissionEpochs;
}
function getSlasher() external view override(IStaking) returns (address) {
return StakingLib.getStorage().slasher;
}
function getStakingAsset() external view override(IStaking) returns (IERC20) {
return StakingLib.getStorage().stakingAsset;
}
function getMinimumStake() external view override(IStaking) returns (uint256) {
return StakingLib.getStorage().gse.MINIMUM_STAKE();
}
function getDepositAmount() external view override(IStaking) returns (uint256) {
return StakingLib.getStorage().gse.DEPOSIT_AMOUNT();
}
function getExitDelay() external view override(IStaking) returns (Timestamp) {
return StakingLib.getStorage().exitDelay.decompress();
}
function getGSE() external view override(IStaking) returns (GSE) {
return StakingLib.getStorage().gse;
}
function getManaTarget() external view override(IRollup) returns (uint256) {
return FeeLib.getManaTarget();
}
function getManaLimit() external view override(IRollup) returns (uint256) {
return FeeLib.getManaLimit();
}
function getTips() external view override(IRollup) returns (ChainTips memory) {
return ChainTipsLib.decompress(STFLib.getStorage().tips);
}
function status(uint256 _myHeaderBlockNumber)
external
view
override(IRollup)
returns (
uint256 provenBlockNumber,
bytes32 provenArchive,
uint256 pendingBlockNumber,
bytes32 pendingArchive,
bytes32 archiveOfMyBlock,
Epoch provenEpochNumber
)
{
RollupStore storage rollupStore = STFLib.getStorage();
ChainTips memory tips = ChainTipsLib.decompress(rollupStore.tips);
return (
tips.provenBlockNumber,
rollupStore.archives[tips.provenBlockNumber],
tips.pendingBlockNumber,
rollupStore.archives[tips.pendingBlockNumber],
archiveAt(_myHeaderBlockNumber),
getEpochForBlock(tips.provenBlockNumber)
);
}
/**
* @notice Returns the computed public inputs for the given epoch proof.
*
* @dev Useful for debugging and testing. Allows submitter to compare their
* own public inputs used for generating the proof vs the ones assembled
* by this contract when verifying it.
*
* @param _start - The start of the epoch (inclusive)
* @param _end - The end of the epoch (inclusive)
* @param _args - Array of public inputs to the proof (previousArchive, endArchive, endTimestamp, outHash, proverId)
* @param _fees - Array of recipient-value pairs with fees to be distributed for the epoch
*/
function getEpochProofPublicInputs(
uint256 _start,
uint256 _end,
PublicInputArgs calldata _args,
bytes32[] calldata _fees,
bytes calldata _blobPublicInputs
) external view override(IRollup) returns (bytes32[] memory) {
return ExtRollupLib.getEpochProofPublicInputs(_start, _end, _args, _fees, _blobPublicInputs);
}
/**
* @notice Validate blob transactions against given inputs.
* @dev Only exists here for gas estimation.
*/
function validateBlobs(bytes calldata _blobsInput)
external
view
override(IRollup)
returns (bytes32[] memory, bytes32, bytes[] memory)
{
return ExtRollupLib.validateBlobs(_blobsInput, checkBlob);
}
/**
* @notice Get the current archive root
*
* @return bytes32 - The current archive root
*/
function archive() external view override(IRollup) returns (bytes32) {
RollupStore storage rollupStore = STFLib.getStorage();
return rollupStore.archives[rollupStore.tips.getPendingBlockNumber()];
}
function getProvenBlockNumber() external view override(IRollup) returns (uint256) {
return STFLib.getStorage().tips.getProvenBlockNumber();
}
function getPendingBlockNumber() external view override(IRollup) returns (uint256) {
return STFLib.getStorage().tips.getPendingBlockNumber();
}
function getBlock(uint256 _blockNumber) external view override(IRollup) returns (BlockLog memory) {
RollupStore storage rollupStore = STFLib.getStorage();
uint256 pendingBlockNumber = rollupStore.tips.getPendingBlockNumber();
require(
_blockNumber <= pendingBlockNumber,
Errors.Rollup__InvalidBlockNumber(pendingBlockNumber, _blockNumber)
);
// If the block is outside of the temp stored, will return default values (0)
// for all that would have been in temp.
TempBlockLog memory tempBlockLog;
if (!STFLib.isTempStale(_blockNumber)) {
tempBlockLog = STFLib.getTempBlockLog(_blockNumber);
}
return BlockLog({
archive: rollupStore.archives[_blockNumber],
headerHash: tempBlockLog.headerHash,
blobCommitmentsHash: tempBlockLog.blobCommitmentsHash,
attestationsHash: tempBlockLog.attestationsHash,
payloadDigest: tempBlockLog.payloadDigest,
slotNumber: tempBlockLog.slotNumber,
feeHeader: tempBlockLog.feeHeader
});
}
function getFeeHeader(uint256 _blockNumber)
external
view
override(IRollup)
returns (FeeHeader memory)
{
return FeeHeaderLib.decompress(STFLib.getFeeHeader(_blockNumber));
}
function getBlobCommitmentsHash(uint256 _blockNumber)
external
view
override(IRollup)
returns (bytes32)
{
return STFLib.getBlobCommitmentsHash(_blockNumber);
}
function getCurrentBlobCommitmentsHash() external view override(IRollup) returns (bytes32) {
RollupStore storage rollupStore = STFLib.getStorage();
return STFLib.getBlobCommitmentsHash(rollupStore.tips.getPendingBlockNumber());
}
function getConfig(address _attester)
external
view
override(IStaking)
returns (AttesterConfig memory)
{
return StakingLib.getConfig(_attester);
}
function getExit(address _attester) external view override(IStaking) returns (Exit memory) {
return StakingLib.getExit(_attester);
}
function getStatus(address _attester) external view override(IStaking) returns (Status) {
return StakingLib.getStatus(_attester);
}
function getAttesterView(address _attester)
external
view
override(IStaking)
returns (AttesterView memory)
{
return StakingLib.getAttesterView(_attester);
}
function getSharesFor(address _prover) external view override(IRollup) returns (uint256) {
return RewardLib.getSharesFor(_prover);
}
/**
* @notice Get the sample seed for a given timestamp
*
* @param _ts - The timestamp to get the sample seed for
*
* @return The sample seed for the given timestamp
*/
function getSampleSeedAt(Timestamp _ts)
external
view
override(IValidatorSelection)
returns (uint256)
{
return ExtRollupLib2.getSampleSeedAt(getEpochAt(_ts));
}
/**
* @notice Get the sample seed for the current epoch
*
* @return The sample seed for the current epoch
*/
function getCurrentSampleSeed() external view override(IValidatorSelection) returns (uint256) {
return ExtRollupLib2.getSampleSeedAt(getCurrentEpoch());
}
/**
* @notice Get the attester set
*
* @dev Consider removing this to replace with a `size` and individual getter.
*
* @return The validator set
*/
function getAttesters() external view override(IValidatorSelection) returns (address[] memory) {
return StakingLib.getAttestersAtTime(Timestamp.wrap(block.timestamp));
}
/**
* @notice Get the current slot number
*
* @return The current slot number
*/
function getCurrentSlot() external view override(IEmperor) returns (Slot) {
return Timestamp.wrap(block.timestamp).slotFromTimestamp();
}
/**
* @notice Get the timestamp for a given slot
*
* @param _slotNumber - The slot number to get the timestamp for
*
* @return The timestamp for the given slot
*/
function getTimestampForSlot(Slot _slotNumber)
external
view
override(IValidatorSelection)
returns (Timestamp)
{
return _slotNumber.toTimestamp();
}
/**
* @notice Computes the slot at a specific time
*
* @param _ts - The timestamp to compute the slot for
*
* @return The computed slot
*/
function getSlotAt(Timestamp _ts) external view override(IValidatorSelection) returns (Slot) {
return _ts.slotFromTimestamp();
}
/**
* @notice Computes the epoch at a specific slot
*
* @param _slotNumber - The slot number to compute the epoch for
*
* @return The computed epoch
*/
function getEpochAtSlot(Slot _slotNumber)
external
view
override(IValidatorSelection)
returns (Epoch)
{
return _slotNumber.epochFromSlot();
}
function getSequencerRewards(address _sequencer)
external
view
override(IRollup)
returns (uint256)
{
return RewardLib.getSequencerRewards(_sequencer);
}
function getCollectiveProverRewardsForEpoch(Epoch _epoch)
external
view
override(IRollup)
returns (uint256)
{
return RewardLib.getCollectiveProverRewardsForEpoch(_epoch);
}
/**
* @notice Get the rewards for a specific prover for a given epoch
* BEWARE! If the epoch is not past its deadline, this value is the "current" value
* and could change if a provers proves a longer series of blocks.
*
* @param _epoch - The epoch to get the rewards for
* @param _prover - The prover to get the rewards for
*
* @return The rewards for the specific prover for the given epoch
*/
function getSpecificProverRewardsForEpoch(Epoch _epoch, address _prover)
external
view
override(IRollup)
returns (uint256)
{
return RewardLib.getSpecificProverRewardsForEpoch(_epoch, _prover);
}
function getHasSubmitted(Epoch _epoch, uint256 _length, address _prover)
external
view
override(IRollup)
returns (bool)
{
return RewardLib.getHasSubmitted(_epoch, _length, _prover);
}
function getHasClaimed(address _prover, Epoch _epoch)
external
view
override(IRollup)
returns (bool)
{
return RewardLib.getHasClaimed(_prover, _epoch);
}
function getProvingCostPerManaInEth() external view override(IRollup) returns (EthValue) {
return FeeLib.getProvingCostPerMana();
}
function getProvingCostPerManaInFeeAsset()
external
view
override(IRollup)
returns (FeeAssetValue)
{
return FeeLib.getProvingCostPerMana().toFeeAsset(getFeeAssetPerEth());
}
function getVersion() external view override(IHaveVersion) returns (uint256) {
return STFLib.getStorage().config.version;
}
function getInbox() external view override(IRollup) returns (IInbox) {
return STFLib.getStorage().config.inbox;
}
function getOutbox() external view override(IRollup) returns (IOutbox) {
return STFLib.getStorage().config.outbox;
}
function getFeeAsset() external view override(IRollup) returns (IERC20) {
return STFLib.getStorage().config.feeAsset;
}
function getFeeAssetPortal() external view override(IRollup) returns (IFeeJuicePortal) {
return STFLib.getStorage().config.feeAssetPortal;
}
function getRewardDistributor() external view override(IRollup) returns (IRewardDistributor) {
return RewardLib.getStorage().config.rewardDistributor;
}
function getL1FeesAt(Timestamp _timestamp)
external
view
override(IRollup)
returns (L1FeeData memory)
{
return FeeLib.getL1FeesAt(_timestamp);
}
function canPruneAtTime(Timestamp _ts) external view override(IRollup) returns (bool) {
return STFLib.canPruneAtTime(_ts);
}
function getRewardConfig() external view override(IRollup) returns (RewardConfig memory) {
return RewardLib.getStorage().config;
}
function getBlockReward() external view override(IRollup) returns (uint256) {
return RewardLib.getBlockReward();
}
function getBurnAddress() external pure override(IRollup) returns (address) {
return RewardLib.BURN_ADDRESS;
}
/**
* @notice Get the validator set for a given epoch
*
* @dev Consider removing this to replace with a `size` and individual getter.
*
* @param _epoch The epoch number to get the validator set for
*
* @return The validator set for the given epoch
*/
function getEpochCommittee(Epoch _epoch)
public
override(IValidatorSelection)
returns (address[] memory)
{
return ExtRollupLib2.getCommitteeAt(_epoch);
}
/**
* @notice Get the proposer for the slot at a specific timestamp
*
* @dev This function is very useful for off-chain usage, as it easily allow a client to
* determine who will be the proposer at the NEXT ethereum block.
* Should not be trusted when moving beyond the current epoch, since changes to the
* validator set might not be reflected when we actually reach that epoch (more changes
* might have happened).
*
* @dev The proposer is selected from the validator set of the current epoch.
*
* @dev Should only be access on-chain if epoch is setup, otherwise very expensive.
*
* @dev A return value of address(0) means that the proposer is "open" and can be anyone.
*
* @dev If the current epoch is the first epoch, returns address(0)
* If the current epoch is setup, we will return the proposer for the current slot
* If the current epoch is not setup, we will perform a sample as if it was (gas heavy)
*
* @return The address of the proposer
*/
function getProposerAt(Timestamp _ts) public override(IValidatorSelection) returns (address) {
return ExtRollupLib2.getProposerAt(_ts.slotFromTimestamp());
}
/**
* @notice Get the attester at an index
*
* @param _index - The index to get the attester for
*
* @return The attester at the index
*/
function getAttesterAtIndex(uint256 _index) public view override(IStaking) returns (address) {
return StakingLib.getAttesterAtIndex(_index);
}
/**
* @notice Gets the mana base fee
*
* @param _inFeeAsset - Whether to return the fee in the fee asset or ETH
*
* @return The mana base fee
*/
function getManaBaseFeeAt(Timestamp _timestamp, bool _inFeeAsset)
public
view
override(IRollup)
returns (uint256)
{
return FeeLib.summedBaseFee(getManaBaseFeeComponentsAt(_timestamp, _inFeeAsset));
}
function getManaBaseFeeComponentsAt(Timestamp _timestamp, bool _inFeeAsset)
public
view
override(IRollup)
returns (ManaBaseFeeComponents memory)
{
return ProposeLib.getManaBaseFeeComponentsAt(_timestamp, _inFeeAsset);
}
/**
* @notice Gets the fee asset price as fee_asset / eth with 1e9 precision
*
* @return The fee asset price
*/
function getFeeAssetPerEth() public view override(IRollup) returns (FeeAssetPerEthE9) {
return FeeLib.getFeeAssetPerEthAtBlock(STFLib.getStorage().tips.getPendingBlockNumber());
}
function getEpochForBlock(uint256 _blockNumber) public view override(IRollup) returns (Epoch) {
return STFLib.getEpochForBlock(_blockNumber);
}
/**
* @notice Get the archive root of a specific block
*
* @param _blockNumber - The block number to get the archive root of
*
* @return bytes32 - The archive root of the block
*/
function archiveAt(uint256 _blockNumber) public view override(IRollup) returns (bytes32) {
RollupStore storage rollupStore = STFLib.getStorage();
return _blockNumber <= rollupStore.tips.getPendingBlockNumber()
? rollupStore.archives[_blockNumber]
: bytes32(0);
}
/**
* @notice Computes the epoch at a specific time
*
* @param _ts - The timestamp to compute the epoch for
*
* @return The computed epoch
*/
function getEpochAt(Timestamp _ts) public view override(IValidatorSelection) returns (Epoch) {
return _ts.epochFromTimestamp();
}
/**
* @notice Get the current epoch number
*
* @return The current epoch number
*/
function getCurrentEpoch() public view override(IValidatorSelection) returns (Epoch) {
return Timestamp.wrap(block.timestamp).epochFromTimestamp();
}
function getNextFlushableEpoch() public view override(IStaking) returns (Epoch) {
return StakingLib.getNextFlushableEpoch();
}
function getEntryQueueLength() public view override(IStaking) returns (uint256) {
return StakingLib.getEntryQueueLength();
}
}