-
Notifications
You must be signed in to change notification settings - Fork 593
Expand file tree
/
Copy pathIValidatorSelection.sol
More file actions
63 lines (51 loc) · 2.33 KB
/
IValidatorSelection.sol
File metadata and controls
63 lines (51 loc) · 2.33 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
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024 Aztec Labs.
pragma solidity >=0.8.27;
import {Timestamp, Slot, Epoch} from "@aztec/core/libraries/TimeLib.sol";
/**
* @notice The data structure for an epoch
* @param committee - The attesters for the epoch
* @param sampleSeed - The seed used to sample the attesters of the epoch
* @param nextSeed - The seed used to influence the NEXT epoch
*/
struct EpochData {
address[] committee;
uint256 sampleSeed;
uint256 nextSeed;
}
struct ValidatorSelectionStorage {
// A mapping to snapshots of the validator set
mapping(Epoch => EpochData) epochs;
// The last stored randao value, same value as `seed` in the last inserted epoch
uint256 lastSeed;
uint256 targetCommitteeSize;
}
interface IValidatorSelectionCore {
function setupEpoch() external;
}
interface IValidatorSelection is IValidatorSelectionCore {
// Likely changing to optimize in Pleistarchus
function getCurrentProposer() external returns (address);
function getProposerAt(Timestamp _ts) external returns (address);
// Non view as uses transient storage
function getCurrentEpochCommittee() external returns (address[] memory);
function getCommitteeAt(Timestamp _ts) external returns (address[] memory);
function getEpochCommittee(Epoch _epoch) external returns (address[] memory);
// Stable
function getCurrentEpoch() external view returns (Epoch);
function getCurrentSlot() external view returns (Slot);
// Consider removing below this point
function getTimestampForSlot(Slot _slotNumber) external view returns (Timestamp);
// Likely removal of these to replace with a size and indiviual getter
// Get the current epoch committee
function getAttesters() external view returns (address[] memory);
function getSampleSeedAt(Timestamp _ts) external view returns (uint256);
function getCurrentSampleSeed() external view returns (uint256);
function getEpochAt(Timestamp _ts) external view returns (Epoch);
function getSlotAt(Timestamp _ts) external view returns (Slot);
function getEpochAtSlot(Slot _slotNumber) external view returns (Epoch);
function getGenesisTime() external view returns (Timestamp);
function getSlotDuration() external view returns (uint256);
function getEpochDuration() external view returns (uint256);
function getTargetCommitteeSize() external view returns (uint256);
}