/// <summary> /// Creates a deep copy of the object. /// </summary> public static BeaconState Clone(BeaconState other) { var clone = new BeaconState( other.GenesisTime, other.Slot, Fork.Clone(other.Fork), BeaconBlockHeader.Clone(other.LatestBlockHeader), other.BlockRoots.Select(x => Hash32.Clone(x)).ToArray(), other.StateRoots.Select(x => Hash32.Clone(x)).ToArray(), other.HistoricalRoots.Select(x => Hash32.Clone(x)).ToList(), Eth1Data.Clone(other.Eth1Data), other.Eth1DataVotes.Select(x => Eth1Data.Clone(x)).ToList(), other.Eth1DepositIndex, other.Validators.Select(x => Validator.Clone(x)).ToList(), other.Balances.Select(x => x).ToList(), other.RandaoMixes.Select(x => Hash32.Clone(x)).ToArray(), other.Slashings.Select(x => x).ToArray(), other.PreviousEpochAttestations.Select(x => PendingAttestation.Clone(x)).ToList(), other.CurrentEpochAttestations.Select(x => PendingAttestation.Clone(x)).ToList(), new BitArray(other.JustificationBits), Checkpoint.Clone(other.PreviousJustifiedCheckpoint), Checkpoint.Clone(other.CurrentJustifiedCheckpoint), Checkpoint.Clone(other.FinalizedCheckpoint) ); return(clone); }
public void SetDepositRoot(Hash32 depositRoot) { if (depositRoot == null) { throw new ArgumentNullException(nameof(depositRoot)); } DepositRoot = depositRoot; }
public static Checkpoint Clone(Checkpoint other) { var clone = new Checkpoint( other.Epoch, Hash32.Clone(other.Root)); return(clone); }
public static Eth1Data Clone(Eth1Data other) { var clone = new Eth1Data( Hash32.Clone(other.DepositRoot), other.DepositCount, Hash32.Clone(other.BlockHash)); return(clone); }
public static AttestationData Clone(AttestationData other) { var clone = new AttestationData( other.Slot, other.Index, Hash32.Clone(other.BeaconBlockRoot), Checkpoint.Clone(other.Source), Checkpoint.Clone(other.Target) ); return(clone); }
/// <summary> /// Creates a deep copy of the object. /// </summary> public static Crosslink Clone(Crosslink other) { var clone = new Crosslink( other.Shard, Hash32.Clone(other.ParentRoot), other.StartEpoch, other.EndEpoch, Hash32.Clone(other.DataRoot) ); return(clone); }
public Crosslink(Shard shard, Hash32 parentRoot, Epoch startEpoch, Epoch endEpoch, Hash32 dataRoot) { Shard = shard; ParentRoot = parentRoot; StartEpoch = startEpoch; EndEpoch = endEpoch; DataRoot = dataRoot; }
public AttestationData( Slot slot, CommitteeIndex index, Hash32 beaconBlockRoot, Checkpoint source, Checkpoint target) { BeaconBlockRoot = beaconBlockRoot; Source = source; Target = target; Slot = slot; Index = index; }
public BeaconBlockHeader( Slot slot, Hash32 parentRoot, Hash32 stateRoot, Hash32 bodyRoot, BlsSignature signature) { Slot = slot; ParentRoot = parentRoot; StateRoot = stateRoot; BodyRoot = bodyRoot; Signature = signature; }
/// <summary> /// Creates a deep copy of the object. /// </summary> public static BeaconBlockHeader Clone(BeaconBlockHeader other) { var clone = new BeaconBlockHeader(Hash32.Clone(other.BodyRoot)) { Slot = other.Slot, ParentRoot = Hash32.Clone(other.ParentRoot), StateRoot = Hash32.Clone(other.StateRoot), BodyRoot = Hash32.Clone(other.BodyRoot), Signature = BlsSignature.Clone(other.Signature) }; return(clone); }
public static Validator Clone(Validator other) { var clone = new Validator( BlsPublicKey.Clone(other.PublicKey), Hash32.Clone(other.WithdrawalCredentials), other.EffectiveBalance, other.ActivationEligibilityEpoch, other.ActivationEpoch, other.ExitEpoch, other.WithdrawableEpoch ); return(clone); }
public Validator( BlsPublicKey publicKey, Hash32 withdrawalCredentials, Gwei effectiveBalance, //bool slashed, Epoch activationEligibilityEpoch, Epoch activationEpoch, Epoch exitEpoch, Epoch withdrawableEpoch) { PublicKey = publicKey; WithdrawalCredentials = withdrawalCredentials; EffectiveBalance = effectiveBalance; ActivationEligibilityEpoch = activationEligibilityEpoch; ActivationEpoch = activationEpoch; ExitEpoch = exitEpoch; WithdrawableEpoch = withdrawableEpoch; }
public void SetStateRoot(Hash32 stateRoot) { StateRoot = stateRoot; }
public Checkpoint(Epoch epoch, Hash32 root) { Epoch = epoch; Root = root; }
public void SetRoot(Hash32 root) { Root = root; }
public void AddHistoricalRoot(Hash32 historicalRoot) => _historicalRoots.Add(historicalRoot);
public Eth1Data(ulong depositCount, Hash32 eth1BlockHash) : this(Hash32.Zero, depositCount, eth1BlockHash) { }
public void SetBlockRoot(Slot index, Hash32 blockRoot) => _blockRoots[(int)(ulong)index] = blockRoot;
public Eth1Data(Hash32 depositRoot, ulong depositCount, Hash32 blockHash) { DepositRoot = depositRoot; DepositCount = depositCount; BlockHash = blockHash; }
public void SetRandaoMix(Epoch randaoIndex, Hash32 mix) => _randaoMixes[(int)(ulong)randaoIndex] = mix;
public BeaconBlockHeader(Hash32 bodyRoot) : this(Slot.Zero, Hash32.Zero, Hash32.Zero, bodyRoot, new BlsSignature()) { }
public void SetStateRoot(Slot index, Hash32 stateRoot) => _stateRoots[(int)(ulong)index] = stateRoot;