Пример #1
0
        public static void Ize(out UInt256 root, VoluntaryExit container)
        {
            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.Epoch);
            merkleizer.Feed(container.ValidatorIndex);
            merkleizer.CalculateRoot(out root);
        }
Пример #2
0
        public static void Ize(out UInt256 root, HistoricalBatch container)
        {
            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.BlockRoots);
            merkleizer.Feed(container.StateRoots);
            merkleizer.CalculateRoot(out root);
        }
Пример #3
0
        public static void Ize(out UInt256 root, SignedVoluntaryExit container)
        {
            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.Message);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #4
0
        public static void Ize(out UInt256 root, Checkpoint container)
        {
            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.Epoch);
            merkleizer.Feed(container.Root);
            merkleizer.CalculateRoot(out root);
        }
Пример #5
0
        public static void Ize(out UInt256 root, SignedBeaconBlockHeader container)
        {
            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.Message);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #6
0
        public static void Ize(out UInt256 root, DepositMessage container)
        {
            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.PublicKey);
            merkleizer.Feed(container.WithdrawalCredentials);
            merkleizer.Feed(container.Amount);
            merkleizer.CalculateRoot(out root);
        }
Пример #7
0
        public static void Ize(out UInt256 root, ProposerSlashing container)
        {
            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.ProposerIndex);
            merkleizer.Feed(container.SignedHeader1);
            merkleizer.Feed(container.SignedHeader2);
            merkleizer.CalculateRoot(out root);
        }
Пример #8
0
        public static void Ize(out UInt256 root, Fork container)
        {
            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.PreviousVersion);
            merkleizer.Feed(container.CurrentVersion);
            merkleizer.Feed(container.Epoch);
            merkleizer.CalculateRoot(out root);
        }
Пример #9
0
        public static void Ize(out UInt256 root, IndexedAttestation container)
        {
            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.AttestingIndices, Attestation.MaxValidatorsPerCommittee);
            merkleizer.Feed(container.Data);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #10
0
        public static void Ize(out UInt256 root, BeaconBlockHeader container)
        {
            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.Slot);
            merkleizer.Feed(container.ParentRoot);
            merkleizer.Feed(container.StateRoot);
            merkleizer.Feed(container.BodyRoot);
            merkleizer.CalculateRoot(out root);
        }
Пример #11
0
        public static void Ize(out UInt256 root, AttestationData container)
        {
            Merkleizer merkleizer = new Merkleizer(3);

            merkleizer.Feed(container.Slot);
            merkleizer.Feed(container.CommitteeIndex);
            merkleizer.Feed(container.BeaconBlockRoot);
            merkleizer.Feed(container.Source);
            merkleizer.Feed(container.Target);
            merkleizer.CalculateRoot(out root);
        }
Пример #12
0
        public static void Ize(out UInt256 root, BeaconBlock container)
        {
            Merkleizer merkleizer = new Merkleizer(3);

            merkleizer.Feed(container.Slot);
            merkleizer.Feed(container.ParentRoot);
            merkleizer.Feed(container.StateRoot);
            merkleizer.Feed(container.Body);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #13
0
        public static void Ize(out UInt256 root, HistoricalBatch?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.BlockRoots);
            merkleizer.Feed(container.StateRoots);
            merkleizer.CalculateRoot(out root);
        }
Пример #14
0
        public static void Ize(out UInt256 root, Checkpoint?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.Value.Epoch);
            merkleizer.Feed(container.Value.Root);
            merkleizer.CalculateRoot(out root);
        }
Пример #15
0
        public static void Ize(out UInt256 root, Deposit?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.Proof);
            merkleizer.Feed(container.Data);
            merkleizer.CalculateRoot(out root);
        }
Пример #16
0
        public static void Ize(out UInt256 root, AttesterSlashing?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(1);

            merkleizer.Feed(container.Attestation1);
            merkleizer.Feed(container.Attestation2);
            merkleizer.CalculateRoot(out root);
        }
Пример #17
0
        public static void Ize(out UInt256 root, Eth1Data?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.DepositRoot);
            merkleizer.Feed(container.DepositCount);
            merkleizer.Feed(container.BlockHash);
            merkleizer.CalculateRoot(out root);
        }
Пример #18
0
        public static void Ize(out UInt256 root, Fork?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.Value.PreviousVersion);
            merkleizer.Feed(container.Value.CurrentVersion);
            merkleizer.Feed(container.Value.Epoch);
            merkleizer.CalculateRoot(out root);
        }
Пример #19
0
        public static void Ize(out UInt256 root, ProposerSlashing?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.ProposerIndex);
            merkleizer.Feed(container.Header1);
            merkleizer.Feed(container.Header2);
            merkleizer.CalculateRoot(out root);
        }
Пример #20
0
        public static void Ize(out UInt256 root, Attestation?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.FeedBits(container.AggregationBits, (Attestation.MaxValidatorsPerCommittee + 255) / 256);
            merkleizer.Feed(container.Data);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #21
0
        public static void Ize(out UInt256 root, VoluntaryExit?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.Epoch);
            merkleizer.Feed(container.ValidatorIndex);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #22
0
        public static void Ize(out UInt256 root, IndexedAttestation?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.AttestingIndices.ToArray(), Ssz.MaxValidatorsPerCommittee);
            merkleizer.Feed(container.Data);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #23
0
        public static void Ize(out UInt256 root, PendingAttestation?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.FeedBits(container.AggregationBits, (Attestation.MaxValidatorsPerCommittee + 255) / 256);
            merkleizer.Feed(container.Data);
            merkleizer.Feed(container.InclusionDelay);
            merkleizer.Feed(container.ProposerIndex);
            merkleizer.CalculateRoot(out root);
        }
Пример #24
0
        public static void Ize(out UInt256 root, DepositData?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(2);

            merkleizer.Feed(container.PublicKey);
            merkleizer.Feed(container.WithdrawalCredentials);
            merkleizer.Feed(container.Amount);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #25
0
        public static void Ize(out UInt256 root, IList <DepositData> value)
        {
            Merkleizer merkleizer = new Merkleizer(0);

            merkleizer.Feed(value, Ssz.MaximumDepositContracts);
            merkleizer.CalculateRoot(out root);
        }
Пример #26
0
        public static void Ize(out UInt256 root, BeaconBlockHeader?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(3);

            merkleizer.Feed(container.Slot);
            merkleizer.Feed(container.ParentRoot);
            merkleizer.Feed(container.StateRoot);
            merkleizer.Feed(container.BodyRoot);
            merkleizer.Feed(container.Signature);
            merkleizer.CalculateRoot(out root);
        }
Пример #27
0
        public static void Ize(out UInt256 root, AttestationData?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(3);

            merkleizer.Feed(container.Slot);
            merkleizer.Feed(container.CommitteeIndex);
            merkleizer.Feed(container.BeaconBlockRoot);
            merkleizer.Feed(container.Source);
            merkleizer.Feed(container.Target);
            merkleizer.CalculateRoot(out root);
        }
Пример #28
0
        public static void Ize(out UInt256 root, BeaconBlockBody container)
        {
            Merkleizer merkleizer = new Merkleizer(3);

            merkleizer.Feed(container.RandaoReversal);
            merkleizer.Feed(container.Eth1Data);
            merkleizer.Feed(container.Graffiti);
            merkleizer.Feed(container.ProposerSlashings, BeaconBlock.MaxProposerSlashings);
            merkleizer.Feed(container.AttesterSlashings, BeaconBlock.MaxAttesterSlashings);
            merkleizer.Feed(container.Attestations, BeaconBlock.MaxAttestations);
            merkleizer.Feed(container.Deposits, BeaconBlock.MaxDeposits);
            merkleizer.Feed(container.VoluntaryExits, BeaconBlock.MaxVoluntaryExits);
            merkleizer.CalculateRoot(out root);
        }
Пример #29
0
        public static void Ize(out UInt256 root, BeaconBlockBody?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(3);

            merkleizer.Feed(container.RandaoReveal);
            merkleizer.Feed(container.Eth1Data);
            merkleizer.Feed(container.Graffiti);
            merkleizer.Feed(container.ProposerSlashings, Ssz.MaxProposerSlashings);
            merkleizer.Feed(container.AttesterSlashings, Ssz.MaxAttesterSlashings);
            merkleizer.Feed(container.Attestations, Ssz.MaxAttestations);
            merkleizer.Feed(container.Deposits, Ssz.MaxDeposits);
            merkleizer.Feed(container.VoluntaryExits, Ssz.MaxVoluntaryExits);
            merkleizer.CalculateRoot(out root);
        }
Пример #30
0
        public static void Ize(out UInt256 root, Validator?container)
        {
            if (container is null)
            {
                root = RootOfNull;
                return;
            }

            Merkleizer merkleizer = new Merkleizer(3);

            merkleizer.Feed(container.PublicKey);
            merkleizer.Feed(container.WithdrawalCredentials);
            merkleizer.Feed(container.EffectiveBalance);
            merkleizer.Feed(container.Slashed);
            merkleizer.Feed(container.ActivationEligibilityEpoch);
            merkleizer.Feed(container.ActivationEpoch);
            merkleizer.Feed(container.ExitEpoch);
            merkleizer.Feed(container.WithdrawableEpoch);
            merkleizer.CalculateRoot(out root);
        }