Last active
April 6, 2024 19:39
-
-
Save protolambda/db75c7faa1e94f2464787a480e5d613e to your computer and use it in GitHub Desktop.
Revisions
-
protolambda revised this gist
Jun 24, 2020 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,11 +16,11 @@ }, "BeaconBlock": { "min_size": 304, "max_size": 157656 }, "BeaconBlockBody": { "min_size": 220, "max_size": 157572 }, "BeaconBlockHeader": { "size": 112 @@ -42,7 +42,7 @@ "size": 88 }, "Eth1Block": { "size": 48 }, "Eth1Data": { "size": 72 @@ -73,15 +73,15 @@ }, "SignedBeaconBlock": { "min_size": 404, "max_size": 157756 }, "SignedBeaconBlockHeader": { "size": 208 }, "SignedVoluntaryExit": { "size": 112 }, "SigningData": { "size": 64 }, "Validator": { -
protolambda revised this gist
May 9, 2020 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,6 @@ from eth2spec.phase0 import spec from eth2spec.phase0.spec import ForkDigest, Root, Slot, Epoch ATTESTATION_SUBNET_COUNT = 64 class MetaData(Container): @@ -42,6 +41,6 @@ def get_spec_ssz_types(): }) for value in get_spec_ssz_types() } import json print(json.dumps(type_bounds)) -
protolambda created this gist
May 9, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,105 @@ { "AggregateAndProof": { "min_size": 337, "max_size": 593 }, "Attestation": { "min_size": 229, "max_size": 485 }, "AttestationData": { "size": 128 }, "AttesterSlashing": { "min_size": 464, "max_size": 33232 }, "BeaconBlock": { "min_size": 304, "max_size": 124420 }, "BeaconBlockBody": { "min_size": 220, "max_size": 124336 }, "BeaconBlockHeader": { "size": 112 }, "BeaconState": { "min_size": 2687377, "max_size": 141837542965649 }, "Checkpoint": { "size": 40 }, "Deposit": { "size": 1240 }, "DepositData": { "size": 184 }, "DepositMessage": { "size": 88 }, "Eth1Block": { "size": 8 }, "Eth1Data": { "size": 72 }, "Fork": { "size": 16 }, "ForkData": { "size": 36 }, "HistoricalBatch": { "size": 524288 }, "IndexedAttestation": { "min_size": 228, "max_size": 16612 }, "PendingAttestation": { "min_size": 149, "max_size": 405 }, "ProposerSlashing": { "size": 416 }, "SignedAggregateAndProof": { "min_size": 437, "max_size": 693 }, "SignedBeaconBlock": { "min_size": 404, "max_size": 124520 }, "SignedBeaconBlockHeader": { "size": 208 }, "SignedVoluntaryExit": { "size": 112 }, "SigningRoot": { "size": 64 }, "Validator": { "size": 121 }, "VoluntaryExit": { "size": 16 }, "MetaData": { "size": 16 }, "Status": { "size": 84 }, "Goodbye": { "size": 8 }, "BeaconBlocksByRange": { "size": 24 } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ from inspect import getmembers, isclass from eth2spec.utils.ssz.ssz_typing import Container, uint64, Bitvector from eth2spec.phase0 import spec from eth2spec.phase0.spec import ForkDigest, Root, Slot, Epoch ATTESTATION_SUBNET_COUNT = 64 class MetaData(Container): seq_number: uint64 attnets: Bitvector[ATTESTATION_SUBNET_COUNT] class Status(Container): fork_digest: ForkDigest finalized_root: Root finalized_epoch: Epoch head_root: Root head_slot: Slot class Goodbye(uint64): pass class BeaconBlocksByRange(Container): start_slot: Slot count: uint64 step: uint64 def get_spec_ssz_types(): return [ value for (_, value) in getmembers(spec, isclass) if issubclass(value, Container) and value != Container # only the subclasses, not the imported base class ] + [MetaData, Status, Goodbye, BeaconBlocksByRange] type_bounds = { value.__name__: ({ 'size': value.type_byte_length() } if value.is_fixed_byte_length() else { 'min_size': value.min_byte_length(), 'max_size': value.max_byte_length(), }) for value in get_spec_ssz_types() } print(type_bounds)