-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
In ssz spec, the list type must have a limit to calculate the merkle tree root. So we define a method to get the limit of the slice.
eg IndexedAttestation
, the field attesting_indices
is a slice, so it must have a method ${fieldName}_limit
pub const IndexedAttestation = struct {
// # [Modified in Electra:EIP7549] size: MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT
attesting_indices: []primitives.ValidatorIndex,
data: AttestationData,
signature: primitives.BLSSignature,
// limit for slice type from spec, the method name must be field name + "_limit"
pub fn attesting_indices_limit() u64 {
return preset.ActivePreset.get().MAX_VALIDATORS_PER_COMMITTEE;
}
};
There is a side efffect, Because call the method through reflection is comptime, so we have to add method for all Slice type field, even it's not a ssz type.
Metadata
Metadata
Assignees
Labels
No labels