public void Eth1_data_there_and_back() { Eth1Data container = new Eth1Data( Sha256.RootOfAnEmptyString, 1, Sha256.Bytes32OfAnEmptyString); Span <byte> encoded = new byte[Ssz.Eth1DataLength]; Ssz.Encode(encoded, container); Eth1Data decoded = Ssz.DecodeEth1Data(encoded); Assert.AreEqual(container, decoded); Merkle.Ize(out UInt256 root, container); }
public void Eth1_data_there_and_back() { Eth1Data container = new Eth1Data(); container.BlockHash = Sha256.OfAnEmptyString; container.DepositCount = 1; container.DepositRoot = Sha256.OfAnEmptyString; Span <byte> encoded = new byte[Eth1Data.SszLength]; Ssz.Encode(encoded, container); Eth1Data decoded = Ssz.DecodeEth1Data(encoded); Assert.AreEqual(container, decoded); Merkle.Ize(out UInt256 root, container); }
public void BasicEth1DataDecode() { // Arrange string hex = "1212121212121212121212121212121212121212121212121212121212121212" + "4000000000000000" + "3434343434343434343434343434343434343434343434343434343434343434"; byte[] bytes = Bytes.FromHexString(hex); // Act Eth1Data eth1Data = Ssz.DecodeEth1Data(bytes); // Assert eth1Data.DepositRoot.AsSpan().ToArray().ShouldBe(Enumerable.Repeat((byte)0x12, 32).ToArray()); eth1Data.DepositCount.ShouldBe(64uL); eth1Data.BlockHash.AsSpan().ToArray().ShouldBe(Enumerable.Repeat((byte)0x34, 32).ToArray()); }