Ejemplo n.º 1
0
 public Checkpoint(Epoch epoch, Hash32 root)
 {
     Epoch = epoch;
     Root  = root;
 }
Ejemplo n.º 2
0
 public void SetSlashings(Epoch slashingsIndex, Gwei amount) => _slashings[(int)(ulong)slashingsIndex] += amount;
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 public void SetRandaoMix(Epoch randaoIndex, Hash32 mix) => _randaoMixes[(int)(ulong)randaoIndex] = mix;
Ejemplo n.º 5
0
 public void SetExitEpoch(Epoch exitEpoch) => ExitEpoch = exitEpoch;
Ejemplo n.º 6
0
 public void SetWithdrawableEpoch(Epoch withdrawableEpoch) => WithdrawableEpoch = withdrawableEpoch;
Ejemplo n.º 7
0
 public void SetEligible(Epoch activationEligibilityEpoch) => ActivationEligibilityEpoch = activationEligibilityEpoch;
Ejemplo n.º 8
0
 public void SetActive(Epoch activationEpoch) => ActivationEpoch = activationEpoch;