Esempio n. 1
0
        public void Pending_attestation_there_and_back()
        {
            AttestationData data = new AttestationData();

            data.Slot            = new Slot(1);
            data.CommitteeIndex  = new CommitteeIndex(2);
            data.BeaconBlockRoot = Sha256.OfAnEmptyString;
            data.Source          = new Checkpoint(new Epoch(1), Sha256.OfAnEmptyString);
            data.Target          = new Checkpoint(new Epoch(2), Sha256.OfAnEmptyString);

            PendingAttestation container = new PendingAttestation();

            container.AggregationBits = new byte[3];
            container.Data            = data;
            container.InclusionDelay  = new Slot(7);
            container.ProposerIndex   = new ValidatorIndex(13);

            Span <byte> encoded = new byte[PendingAttestation.SszLength(container)];

            Ssz.Encode(encoded, container);
            PendingAttestation?decoded = Ssz.DecodePendingAttestation(encoded);

            Assert.AreEqual(container, decoded);

            Merkle.Ize(out UInt256 root, container);
        }
Esempio n. 2
0
        public void Pending_attestation_there_and_back()
        {
            AttestationData data = new AttestationData(
                new Slot(1),
                new CommitteeIndex(2),
                Sha256.RootOfAnEmptyString,
                new Checkpoint(new Epoch(1), Sha256.RootOfAnEmptyString),
                new Checkpoint(new Epoch(2), Sha256.RootOfAnEmptyString));

            PendingAttestation container = new PendingAttestation(
                new BitArray(new byte[3]),
                data,
                new Slot(7),
                new ValidatorIndex(13));

            Span <byte> encoded = new byte[Ssz.PendingAttestationLength(container)];

            Ssz.Encode(encoded, container);
            PendingAttestation?decoded = Ssz.DecodePendingAttestation(encoded);

            decoded.ShouldBe(container);

            Merkle.Ize(out UInt256 root, container);
        }