public Checkpoint(Epoch epoch, Hash32 root) { Epoch = epoch; Root = root; }
public void SetSlashings(Epoch slashingsIndex, Gwei amount) => _slashings[(int)(ulong)slashingsIndex] += amount;
public BeaconState(ulong genesisTime, ulong eth1DepositIndex, Eth1Data eth1Data, BeaconBlockHeader latestBlockHeader, Slot slotsPerHistoricalRoot, Epoch epochsPerHistoricalVector, Epoch epochsPerSlashingsVector, int justificationBitsLength) { GenesisTime = genesisTime; Eth1DepositIndex = eth1DepositIndex; _eth1DataVotes = new List <Eth1Data>(); Eth1Data = eth1Data; LatestBlockHeader = latestBlockHeader; _validators = new List <Validator>(); _balances = new List <Gwei>(); _blockRoots = Enumerable.Repeat(Hash32.Zero, (int)(ulong)slotsPerHistoricalRoot).ToArray(); _stateRoots = Enumerable.Repeat(Hash32.Zero, (int)(ulong)slotsPerHistoricalRoot).ToArray(); _historicalRoots = new List <Hash32>(); _randaoMixes = Enumerable.Repeat(Hash32.Zero, (int)(ulong)epochsPerHistoricalVector).ToArray(); _slashings = Enumerable.Repeat(Gwei.Zero, (int)(ulong)epochsPerSlashingsVector).ToArray(); _previousEpochAttestations = new List <PendingAttestation>(); _currentEpochAttestations = new List <PendingAttestation>(); JustificationBits = new BitArray(justificationBitsLength); Fork = new Fork(new ForkVersion(), new ForkVersion(), Epoch.Zero); CurrentJustifiedCheckpoint = new Checkpoint(new Epoch(0), Hash32.Zero); PreviousJustifiedCheckpoint = new Checkpoint(new Epoch(0), Hash32.Zero); FinalizedCheckpoint = new Checkpoint(new Epoch(0), Hash32.Zero); //_previousCrosslinks = Enumerable.Repeat(new Crosslink(Shard.Zero), (int)(ulong)shardCount).ToArray(); //_currentCrosslinks = Enumerable.Repeat(new Crosslink(Shard.Zero), (int)(ulong)shardCount).ToArray(); //_currentCrosslinks = Enumerable.Range(0, (int)(ulong)shardCount).Select(x => new Crosslink(new Shard((ulong)x))).ToArray(); }
public void SetRandaoMix(Epoch randaoIndex, Hash32 mix) => _randaoMixes[(int)(ulong)randaoIndex] = mix;
public void SetExitEpoch(Epoch exitEpoch) => ExitEpoch = exitEpoch;
public void SetWithdrawableEpoch(Epoch withdrawableEpoch) => WithdrawableEpoch = withdrawableEpoch;
public void SetEligible(Epoch activationEligibilityEpoch) => ActivationEligibilityEpoch = activationEligibilityEpoch;
public void SetActive(Epoch activationEpoch) => ActivationEpoch = activationEpoch;