/// <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 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); }
/// <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); }