Ejemplo n.º 1
0
        public void Deposit_there_and_back()
        {
            DepositData data = new DepositData(
                TestKey1,
                Sha256.Bytes32OfAnEmptyString,
                Gwei.One,
                TestSig1);

            Bytes32[] proof = Enumerable.Repeat(Bytes32.Zero, Ssz.DepositContractTreeDepth + 1).ToArray();
            proof[7] = Sha256.Bytes32OfAnEmptyString;
            Deposit container = new Deposit(proof, data);

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

            Ssz.Encode(encoded, container);
            Deposit?decoded = Ssz.DecodeDeposit(encoded);

            Assert.AreEqual(container, decoded);

            Merkle.Ize(out UInt256 root, container);
        }
Ejemplo n.º 2
0
        public void Deposit_there_and_back()
        {
            DepositData data = new DepositData();

            data.PublicKey             = BlsPublicKey.TestKey1;
            data.WithdrawalCredentials = Sha256.OfAnEmptyString;
            data.Amount    = Gwei.One;
            data.Signature = BlsSignature.TestSig1;

            Deposit container = new Deposit();

            container.Data     = data;
            container.Proof[7] = Sha256.OfAnEmptyString;

            Span <byte> encoded = new byte[Deposit.SszLength];

            Ssz.Encode(encoded, container);
            Deposit?decoded = Ssz.DecodeDeposit(encoded);

            Assert.AreEqual(container, decoded);

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