public void Attester_slashing_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)); IndexedAttestation indexedAttestation1 = new IndexedAttestation( new ValidatorIndex[3], data, TestSig1); IndexedAttestation indexedAttestation2 = new IndexedAttestation( new ValidatorIndex[5], data, TestSig1); AttesterSlashing container = new AttesterSlashing(indexedAttestation1, indexedAttestation2); Span <byte> encoded = new byte[Ssz.AttesterSlashingLength(container)]; Ssz.Encode(encoded, container); AttesterSlashing?decoded = Ssz.DecodeAttesterSlashing(encoded); Assert.AreEqual(container, decoded); Merkle.Ize(out UInt256 root, container); }
public void Attester_slashing_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); IndexedAttestation indexedAttestation1 = new IndexedAttestation(); indexedAttestation1.AttestingIndices = new ValidatorIndex[3]; indexedAttestation1.Data = data; indexedAttestation1.Signature = BlsSignature.TestSig1; IndexedAttestation indexedAttestation2 = new IndexedAttestation(); indexedAttestation2.AttestingIndices = new ValidatorIndex[5]; indexedAttestation2.Data = data; indexedAttestation2.Signature = BlsSignature.TestSig1; AttesterSlashing container = new AttesterSlashing(); container.Attestation1 = indexedAttestation1; container.Attestation2 = indexedAttestation2; Span <byte> encoded = new byte[AttesterSlashing.SszLength(container)]; Ssz.Encode(encoded, container); AttesterSlashing?decoded = Ssz.DecodeAttesterSlashing(encoded); Assert.AreEqual(container, decoded); Merkle.Ize(out UInt256 root, container); }