Ejemplo n.º 1
0
        public static int SszLength(BeaconBlockBody?container)
        {
            if (container is null)
            {
                return(0);
            }

            int result = SszDynamicOffset;

            result += ProposerSlashing.SszLength * (container.ProposerSlashings?.Length ?? 0);
            result += Deposit.SszLength * (container.Deposits?.Length ?? 0);
            result += VoluntaryExit.SszLength * (container.VoluntaryExits?.Length ?? 0);

            result += sizeof(uint) * (container.AttesterSlashings?.Length ?? 0);
            if (!(container.AttesterSlashings is null))
            {
                for (int i = 0; i < container.AttesterSlashings.Length; i++)
                {
                    result += AttesterSlashing.SszLength(container.AttesterSlashings[i]);
                }
            }

            result += sizeof(uint) * (container.Attestations?.Length ?? 0);
            if (!(container.Attestations is null))
            {
                for (int i = 0; i < container.Attestations.Length; i++)
                {
                    result += Attestation.SszLength(container.Attestations[i]);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static int SszLength(AttesterSlashing container)
        {
            if (container == null)
            {
                return(0);
            }

            return(2 * sizeof(uint) +
                   IndexedAttestation.SszLength(container.Attestation1) +
                   IndexedAttestation.SszLength(container.Attestation2));
        }
Ejemplo n.º 3
0
        public static int SszLength(BeaconBlockBody container)
        {
            int result = SszDynamicOffset;

            result += ProposerSlashing.SszLength * container.ProposerSlashings.Length;
            result += Deposit.SszLength * container.Deposits.Length;
            result += VoluntaryExit.SszLength * container.VoluntaryExits.Length;

            result += sizeof(uint) * container.AttesterSlashings.Length;
            for (int i = 0; i < container.AttesterSlashings.Length; i++)
            {
                result += AttesterSlashing.SszLength(container.AttesterSlashings[i]);
            }

            result += sizeof(uint) * container.Attestations.Length;
            for (int i = 0; i < container.Attestations.Length; i++)
            {
                result += Attestation.SszLength(container.Attestations[i]);
            }

            return(result);
        }
Ejemplo n.º 4
0
 public bool Equals(AttesterSlashing other)
 {
     return(Equals(Attestation1, other.Attestation1) &&
            Equals(Attestation2, other.Attestation2));
 }