def _load_and_parse_test_suites( tests_path: Path, test_type: TestType[HandlerType], test_handler: TestHandler[Input, Output], config_type: ConfigType, fork_type: ForkType, ) -> Iterable[TestSuite]: test_handler_path = _build_test_handler_path(tests_path, test_type, test_handler, config_type, fork_type) test_suite_descriptors = _discover_test_suite_from(test_handler_path) if config_type.has_config(): config_path = tests_path / Path(config_type.name) / Path( config_type.path) config = load_config_at_path(config_path) override_lengths(config) else: config = None for descriptor in test_suite_descriptors: yield TestSuite( descriptor.name, _parse_test_cases(config, test_handler, descriptor.test_case_descriptors), )
def _main(): config_type = Minimal config = _load_config(config_type) override_lengths(config) key_set = load_yaml_at(KEY_DIR / KEY_SET_FILE) pubkeys, privkeys, withdrawal_credentials = create_keypair_and_mock_withdraw_credentials( config, key_set) keymap = {pubkey: privkey for pubkey, privkey in zip(pubkeys, privkeys)} deposits, _ = create_mock_deposits_and_root(pubkeys, keymap, config, withdrawal_credentials) eth1_block_hash = b"\x42" * 32 # NOTE: this timestamp is a placeholder eth1_timestamp = 10000 state = initialize_beacon_state_from_eth1( eth1_block_hash=eth1_block_hash, eth1_timestamp=eth1_timestamp, deposits=deposits, config=config, ) genesis_time = int(time.time()) print(f"creating genesis at time {genesis_time}") genesis_state = state.copy(genesis_time=genesis_time) print(genesis_state.hash_tree_root.hex()) genesis_file_path = RESOURCE_DIR / GENESIS_FILE output_file = open(genesis_file_path, "wb") output_file.write(ssz.encode(genesis_state)) output_file.close() print(f"genesis is saved in {genesis_file_path}")
def generate_genesis_config( config_profile: Literal["minimal", "mainnet"], genesis_time: Optional[Timestamp] = None, ) -> Dict[str, Any]: eth2_config = _get_eth2_config(config_profile) override_lengths(eth2_config) validator_count = eth2_config.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT validator_key_pairs = create_key_pairs_for(validator_count) deposits = create_genesis_deposits_from( validator_key_pairs, withdrawal_credentials_provider=mk_withdrawal_credentials_from( eth2_config.BLS_WITHDRAWAL_PREFIX.to_bytes(1, byteorder="little") ), amount_provider=lambda _public_key: eth2_config.MAX_EFFECTIVE_BALANCE, ) eth1_block_hash = ZERO_HASH32 eth1_timestamp = eth2_config.MIN_GENESIS_TIME initial_state = initialize_beacon_state_from_eth1( eth1_block_hash=eth1_block_hash, eth1_timestamp=Timestamp(eth1_timestamp), deposits=deposits, config=eth2_config, ) if genesis_time: initial_state.set("genesis_time", genesis_time) return { "eth2_config": eth2_config.to_formatted_dict(), "genesis_validator_key_pairs": mk_genesis_key_map( validator_key_pairs, initial_state ), "genesis_state": to_formatted_dict(initial_state), }
def main(): logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s: %(message)s') override_lengths(MINIMAL_SERENITY_CONFIG) with open('state_15.ssz', 'rb') as f: pre_state_encoded = f.read() pre_state = ssz.decode(pre_state_encoded, sedes=BeaconState) with open('block_16.ssz', 'rb') as f: block_encoded = f.read() pre_block = ssz.decode(block_encoded, sedes=BeaconBlock) trinity_post = trinity_transition(pre_state, pre_block) pyspec_post = pyspec_transition(pre_state, pre_block) for index in range(len(pyspec_post.balances)): assert trinity_post.balances[index] == pyspec_post.balances[index] if trinity_post.balances[index] == pyspec_post.balances[index]: continue print(f"trinity balances[{index}]: \t" f"{trinity_post.balances[index].to_bytes(8, 'big').hex()}") print(f"pyspec balances[{index}]: \t" f"{pyspec_post.balances[index].to_bytes(8, 'big').hex()}") print(f"trinity: {trinity_post.current_crosslinks[7]}") print(f"pyspec: {pyspec_post.current_crosslinks[7]}")
def generate_genesis_state(cls, get_genesis_time: Callable[[], Timestamp], network_dir: Path, keymap: Dict[BLSPubkey, int], clients: Tuple[Client, ...]) -> None: logger = cls.get_logger() state_machine_class = XiaoLongBaoStateMachine # NOTE: see https://github.com/ethereum/trinity/issues/786 override_lengths(XiaoLongBaoStateMachine.config) # Since create_mock_genesis takes a long time, update the real genesis_time later dummy_time = Timestamp(int(time.time())) state, _ = create_mock_genesis( pubkeys=cast( Sequence[BLSPubkey], keymap.keys(), ), config=state_machine_class.config, keymap=keymap, genesis_block_class=state_machine_class.block_class, genesis_time=dummy_time, ) genesis_time = get_genesis_time() logger.info( "Genesis time will be %s from now", humanize_seconds(genesis_time - int(time.time())), ) state = state.copy(genesis_time=genesis_time, ) # The output here can be trusted, so use unsafe mode for performance yaml = YAML(typ='unsafe') with open(network_dir / GENESIS_FILE, "w") as f: yaml.dump(to_formatted_dict(state), f) # Distribute genesis file to clients for client in clients: with open(client.client_dir / GENESIS_FILE, "w") as f: yaml.dump(to_formatted_dict(state), f)
def from_genesis_config(cls, config_profile: str) -> 'BeaconChainConfig': """ Construct an instance of ``cls`` reading the genesis configuration data under the local data directory. """ if config_profile == "mainnet": beacon_chain_class = BeaconChain else: beacon_chain_class = SkeletonLakeChain try: with open(_get_eth2_genesis_config_file_path( config_profile)) as config_file: genesis_config = json.load(config_file) except FileNotFoundError as e: raise Exception("unable to load genesis config: %s", e) eth2_config = Eth2Config.from_formatted_dict( genesis_config["eth2_config"]) # NOTE: have to ``override_lengths`` before we can parse the ``BeaconState`` override_lengths(eth2_config) genesis_state = from_formatted_dict(genesis_config["genesis_state"], BeaconState) genesis_validator_key_map = load_genesis_key_map( genesis_config["genesis_validator_key_pairs"]) return cls(genesis_state, eth2_config, genesis_validator_key_map, beacon_chain_class=beacon_chain_class)
def genesis_config_with_validators( config_profile: Literal["minimal", "mainnet"], genesis_time: Timestamp = None) -> Dict[str, Any]: eth2_config = _get_eth2_config(config_profile) override_lengths(eth2_config) validator_count = eth2_config.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT validator_key_pairs = create_key_pairs_for(validator_count) deposits = create_genesis_deposits_from( validator_key_pairs, withdrawal_credentials_provider=mk_withdrawal_credentials_from( eth2_config.BLS_WITHDRAWAL_PREFIX), amount_provider=lambda _public_key: eth2_config.MAX_EFFECTIVE_BALANCE, ) eth1_block_hash = ZERO_HASH32 eth1_timestamp = eth2_config.MIN_GENESIS_TIME genesis_state = initialize_beacon_state_from_eth1( eth1_block_hash=eth1_block_hash, eth1_timestamp=Timestamp(eth1_timestamp), deposits=deposits, config=eth2_config, ) if genesis_time: genesis_state = genesis_state.set("genesis_time", genesis_time) key_pairs = mk_genesis_key_map(validator_key_pairs, genesis_state) return _create_genesis_config(config_profile, eth2_config, genesis_state, key_pairs)
def _create( cls, model_class: Type[BaseBeaconChain], *args: Any, **kwargs: Any ) -> BaseBeaconChain: """ Create a BeaconChain according to the factory definition. NOTE: clients of this class may provide a ``branch`` keyword in the ``kwargs`` to construct a chain with a ``Collection[BaseSignedBeaconBlock]``. This ``branch`` is NOT assumed to have been constructed according to the full set of validity rules, e.g. lacking a proper signature so the ``perform_validation`` option to ``import_block`` is disabled. """ override_lengths(cls.config) if "num_validators" in kwargs: num_validators = kwargs["num_validators"] else: num_validators = cls.num_validators if kwargs["genesis_state"] is None: keymap = mk_keymap_of_size(num_validators) genesis_state, genesis_block = create_mock_genesis( config=cls.config, pubkeys=tuple(keymap.keys()), keymap=keymap, genesis_block_class=SerenityBeaconBlock, genesis_time=Timestamp(int(time.time())), ) elif kwargs["genesis_block"] is None: genesis_state = kwargs["genesis_state"] genesis_block = get_genesis_block( genesis_state.hash_tree_root, SerenityBeaconBlock ) else: genesis_state = kwargs["genesis_state"] genesis_block = kwargs["genesis_block"] db = kwargs.pop("db", AtomicDB()) genesis_config = model_class.get_genesis_state_machine_class().config chain = model_class.from_genesis( base_db=db, genesis_state=genesis_state, genesis_block=genesis_block, genesis_config=genesis_config, ) if kwargs["branch"] is not None: branch = kwargs["branch"] for block in branch: if block.is_genesis: continue # NOTE: ideally we use the ``import_block`` method # on ``chain`` but for the time being we skip some # validation corresponding to assumptions made in clients of # this class. A future refactoring should use the external API. chain.chaindb.persist_block( block, SerenitySignedBeaconBlock, HigherSlotScoring() ) return chain
def parse_shuffling_test_case(test_case, handler, index, config): override_lengths(config) return ShufflingTestCase( handler=handler, index=index, seed=decode_hex(test_case['seed']), count=test_case['count'], shuffled=tuple(test_case['shuffled']), )
async def test_json_rpc_http_server(aiohttp_raw_server, aiohttp_client, event_bus, base_db, ipc_path): manager = DBManager(base_db) with manager.run(ipc_path): # Set chaindb override_lengths(SERENITY_CONFIG) db = DBClient.connect(ipc_path) genesis_config = SERENITY_CONFIG chaindb = AsyncBeaconChainDB(db, genesis_config) fork_choice_scoring = HigherSlotScoring() genesis_state, genesis_block = create_mock_genesis( pubkeys=(), config=SERENITY_CONFIG, keymap=dict(), genesis_block_class=BeaconBlock, genesis_time=0, ) chaindb.persist_state(genesis_state) chaindb.persist_block( SignedBeaconBlock.create(message=genesis_block), SignedBeaconBlock, fork_choice_scoring, ) try: rpc = RPCServer(initialize_beacon_modules(chaindb, event_bus), chaindb, event_bus) raw_server = await aiohttp_raw_server( RPCHandler.handle(rpc.execute)) client = await aiohttp_client(raw_server) request_id = 1 request_data = { "jsonrpc": "2.0", "method": "beacon_head", "params": [], "id": request_id, } response = await client.post("/", json=request_data) response_data = await response.json() assert response_data["id"] == request_id result = response_data["result"] assert result["slot"] == 0 assert decode_hex( result["block_root"]) == genesis_block.hash_tree_root assert decode_hex( result["state_root"]) == genesis_state.hash_tree_root except KeyboardInterrupt: pass finally: await raw_server.close() db.close()
def genesis_config_with_default_state( config_profile: Literal["minimal", "mainnet"], genesis_time: Timestamp = None) -> Dict[str, Any]: eth2_config = _get_eth2_config(config_profile) override_lengths(eth2_config) genesis_state = BeaconState.create(config=eth2_config) if genesis_time: genesis_state = genesis_state.set("genesis_time", genesis_time) return _create_genesis_config(config_profile, eth2_config, genesis_state, ())
def parse_genesis_validity_test_case(test_case, handler, index, config): override_lengths(config) bls_setting = get_bls_setting(test_case) genesis = from_formatted_dict(test_case['genesis'], BeaconState) is_valid = test_case['is_valid'] return GenesisValidityTestCase( handler=handler, index=index, bls_setting=bls_setting, description=test_case['description'], genesis=genesis, is_valid=is_valid, )
def update_genesis_config_with_time(config: Dict[str, Any], genesis_time: Timestamp) -> Dict[str, Any]: config_profile = config["profile"] eth2_config = _get_eth2_config(config_profile) override_lengths(eth2_config) existing_state = from_formatted_dict(config["genesis_state"], BeaconState) genesis_state = existing_state.set("genesis_time", genesis_time) updates = { "genesis_state_root": encode_hex(genesis_state.hash_tree_root), "genesis_state": to_formatted_dict(genesis_state), } return {**config, **updates}
def parse_test_suite( test_type: TestType[HandlerType], test_handler: TestHandler[Input, Output], config_type: Optional[ConfigType], ) -> TestSuite: project_root_dir = _find_project_root_dir(TESTS_ROOT_PATH) tests_path = project_root_dir / TESTS_ROOT_PATH / TESTS_PATH if config_type: config_path = project_root_dir / config_type.path config = load_config_at_path(config_path) override_lengths(config) else: config = None return _load_test_suite(tests_path, test_type, test_handler, config_type, config)
def main(): parser = argparse.ArgumentParser() parser.add_argument("-ssz", type=str, required=True) parser.add_argument("-config", type=str, required=True) args = parser.parse_args() config_path = Path(args.config) minimal_config = load_config_at_path(config_path) override_lengths(minimal_config) with open(args.ssz, "rb") as f: encoded = f.read() state = ssz.decode(encoded, sedes=BeaconState) yaml = YAML(typ="unsafe") yaml.dump(to_formatted_dict(state), sys.stdout)
def genesis_config_from_state_file( config_profile: Literal["minimal", "mainnet"], genesis_state_path: Path, genesis_time: Timestamp = None, ) -> Dict[str, Any]: eth2_config = _get_eth2_config(config_profile) override_lengths(eth2_config) with open(genesis_state_path, "rb") as genesis_state_file: genesis_state = BeaconState.deserialize(genesis_state_file.read()) if genesis_time: genesis_state = genesis_state.set("genesis_time", genesis_time) return _create_genesis_config(config_profile, eth2_config, genesis_state, ())
def main_validator() -> None: logger = _setup_logging() parser = parse_cli_args() arguments = parser.parse_args() trinity_config = load_trinity_config_from_parser_args( parser, arguments, APP_IDENTIFIER_VALIDATOR_CLIENT, (ValidatorClientAppConfig,) ) # NOTE: we do not want the rest of the functionality in # ``trinity.bootstrap.ensure_data_dir_is_initialized create_dir_if_missing(trinity_config.data_dir) validator_client_app_config = trinity_config.get_app_config( ValidatorClientAppConfig ) root_dir = validator_client_app_config.root_dir create_dir_if_missing(root_dir) try: genesis_config = _load_genesis_config_at( validator_client_app_config.genesis_config_path ) except FileNotFoundError: genesis_time = Timestamp(int(time.time())) genesis_config = generate_genesis_config("minimal", genesis_time) eth2_config = Eth2Config.from_formatted_dict(genesis_config["eth2_config"]) override_lengths(eth2_config) key_pairs = load_genesis_key_map(genesis_config["genesis_validator_key_pairs"]) genesis_state = from_formatted_dict(genesis_config["genesis_state"], BeaconState) slots_per_epoch = Slot(eth2_config.SLOTS_PER_EPOCH) seconds_per_slot = eth2_config.SECONDS_PER_SLOT genesis_time = genesis_state.genesis_time config = Config( key_pairs=key_pairs, root_data_dir=root_dir, slots_per_epoch=slots_per_epoch, seconds_per_slot=seconds_per_slot, genesis_time=genesis_time, ) # NOTE: we deviate from the multiprocess-driven Component-based # application machinery here until said machinery is more stable # with respect to boot, shutdown and general concurrent control. trio.run(arguments.func, logger, config, arguments)
def _main(): config_type = Minimal config = _load_config(config_type) override_lengths(config) key_set = load_yaml_at(KEY_DIR / KEY_SET_FILE) pubkeys = () privkeys = () withdrawal_credentials = () keymap = {} for key_pair in key_set: pubkey = decode_hex(key_pair["pubkey"]) privkey = int.from_bytes(decode_hex(key_pair["privkey"]), "big") withdrawal_credential = ( config.BLS_WITHDRAWAL_PREFIX.to_bytes(1, byteorder="big") + hash_eth2(pubkey)[1:]) pubkeys += (pubkey, ) privkeys += (privkey, ) withdrawal_credentials += (withdrawal_credential, ) keymap[pubkey] = privkey deposits, _ = create_mock_deposits_and_root(pubkeys, keymap, config, withdrawal_credentials) eth1_block_hash = b"\x42" * 32 # NOTE: this timestamp is a placeholder eth1_timestamp = 10000 state = initialize_beacon_state_from_eth1( eth1_block_hash=eth1_block_hash, eth1_timestamp=eth1_timestamp, deposits=deposits, config=config, ) genesis_time = int(time.time()) print(f"creating genesis at time {genesis_time}") genesis_state = state.copy(genesis_time=genesis_time) print(genesis_state.hash_tree_root.hex()) genesis_file_path = RESOURCE_DIR / GENESIS_FILE output_file = open(genesis_file_path, "wb") output_file.write(ssz.encode(genesis_state)) output_file.close() print(f"genesis is saved in {genesis_file_path}")
def from_genesis_config(cls) -> 'BeaconChainConfig': """ Construct an instance of ``cls`` reading the genesis configuration data under the local data directory. """ with open(_get_eth2_genesis_config_file_path()) as config_file: config = json.load(config_file) genesis_eth2_config = deserialize_eth2_config( config["eth2_config"]) # NOTE: have to ``override_lengths`` before we can parse the ``BeaconState`` override_lengths(genesis_eth2_config) genesis_state = from_formatted_dict(config["genesis_state"], BeaconState) genesis_validator_key_map = load_genesis_key_map( config["genesis_validator_key_pairs"]) return cls(genesis_state, genesis_eth2_config, genesis_validator_key_map)
def parse_sanity_test_case(test_case, handler, index, config): override_lengths(config) bls_setting = get_bls_setting(test_case) pre, post, is_valid = get_states(test_case, BeaconState) blocks = get_blocks(test_case, BeaconBlock) slots = get_slots(test_case) return SanityTestCase( handler=handler, index=index, bls_setting=bls_setting, description=test_case['description'], pre=pre, post=post, is_valid=is_valid, slots=slots, blocks=blocks, )
def parse_operation_test_case(test_case, handler, index, config): config = config._replace(MAX_TRANSFERS=1, ) override_lengths(config) bls_setting = get_bls_setting(test_case) pre, post, is_valid = get_states(test_case, BeaconState) operation_class, _ = handler_to_processing_call_map[handler] operation = get_operation_or_header(test_case, operation_class, handler) return OperationCase( handler=handler, index=index, bls_setting=bls_setting, description=test_case['description'], pre=pre, operation=operation, post=post, is_valid=is_valid, )
def parse_genesis_initialization_test_case(test_case, handler, index, config): override_lengths(config) bls_setting = get_bls_setting(test_case) eth1_block_hash = decode_hex(test_case['eth1_block_hash']) eth1_timestamp = test_case['eth1_timestamp'] state = from_formatted_dict(test_case['state'], BeaconState) deposits = get_deposits(test_case, Deposit) return GenesisInitializationTestCase( handler=handler, index=index, bls_setting=bls_setting, description=test_case['description'], eth1_block_hash=eth1_block_hash, eth1_timestamp=eth1_timestamp, state=state, deposits=deposits, )
def from_genesis_config(cls) -> 'BeaconChainConfig': """ Construct an instance of ``cls`` reading the genesis configuration data under the local data directory. """ try: with open(_get_eth2_genesis_config_file_path()) as config_file: genesis_config = json.load(config_file) except FileNotFoundError: genesis_config = generate_genesis_config("minimal") eth2_config = Eth2Config.from_formatted_dict(genesis_config["eth2_config"]) # NOTE: have to ``override_lengths`` before we can parse the ``BeaconState`` override_lengths(eth2_config) genesis_state = from_formatted_dict(genesis_config["genesis_state"], BeaconState) genesis_validator_key_map = load_genesis_key_map( genesis_config["genesis_validator_key_pairs"] ) return cls(genesis_state, eth2_config, genesis_validator_key_map)
def _main(): config_type = Minimal config = _load_config(config_type) override_lengths(config) key_set = load_yaml_at(ROOT_DIR / KEY_SET_FILE) pubkeys = () privkeys = () withdrawal_credentials = () keymap = {} for key_pair in key_set: pubkey = key_pair["pubkey"].to_bytes(48, byteorder="big") privkey = key_pair["privkey"] withdrawal_credential = ( config.BLS_WITHDRAWAL_PREFIX.to_bytes(1, byteorder="big") + hash_eth2(pubkey)[1:]) pubkeys += (pubkey, ) privkeys += (privkey, ) withdrawal_credentials += (withdrawal_credential, ) keymap[pubkey] = privkey deposits, _ = create_mock_deposits_and_root(pubkeys, keymap, config, withdrawal_credentials) eth1_block_hash = b"\x42" * 32 # NOTE: this timestamp is a placeholder eth1_timestamp = 10000 state = initialize_beacon_state_from_eth1( eth1_block_hash=eth1_block_hash, eth1_timestamp=eth1_timestamp, deposits=deposits, config=config, ) genesis_time = int(time.time()) print(f"creating genesis at time {genesis_time}") genesis_state = state.copy(genesis_time=genesis_time) print(genesis_state.hash_tree_root.hex())
def from_genesis(cls, base_db: AtomicDatabaseAPI, genesis_state: BeaconState) -> "BeaconChain": for starting_slot, state_machine_class in cls._sm_configuration: if starting_slot == GENESIS_SLOT: signed_block_class = state_machine_class.signed_block_class fork_choice_class = state_machine_class.fork_choice_class config = state_machine_class.config # NOTE: important this happens as soon as it can... override_lengths(config) break else: raise Exception("state machine configuration missing genesis era") assert genesis_state.slot == GENESIS_SLOT chain_db = BeaconChainDB.from_genesis(base_db, genesis_state, signed_block_class, config) block_sink = ChainDBBlockSink(chain_db) fork_choice = fork_choice_class.from_genesis(genesis_state, config, block_sink) return cls(chain_db, fork_choice)
def from_parser_args(cls, args: argparse.Namespace, trinity_config: TrinityConfig) -> "BaseAppConfig": """ Initialize from the namespace object produced by an ``argparse.ArgumentParser`` and the :class:`~trinity.config.TrinityConfig` """ # NOTE: ``args.network`` has a default so check for an override in # the ``network_config`` first... if args.network_config: network_config = _load_eth2_network_from_yaml(args.network_config) network_name = "custom network" else: network_config = _load_predefined_eth2_network(args.network) network_name = args.network # NOTE: required for SSZ types to work correctly... override_lengths(network_config) p2p_maddr = args.p2p_maddr bootstrap_nodes = args.bootstrap_maddrs preferred_nodes = args.preferred_maddrs validator_api_port = args.validator_api_port genesis_state_ssz = args.genesis_state_ssz _resolve_node_key(trinity_config, args.nodekey_seed) return cls( trinity_config, network_name, network_config, p2p_maddr, validator_api_port, bootstrap_nodes, preferred_nodes, genesis_state_ssz, )
def _create(cls, model_class: Type[BaseBeaconChain], *args: Any, **kwargs: Any) -> BaseBeaconChain: override_lengths(cls.config) keymap = mk_keymap_of_size(cls.num_validators) genesis_state, genesis_block = create_mock_genesis( config=cls.config, pubkeys=tuple(keymap.keys()), keymap=keymap, genesis_block_class=SerenityBeaconBlock, genesis_time=Timestamp(int(time.time())), ) db = kwargs.pop("db", AtomicDB()) chain = model_class.from_genesis( base_db=db, genesis_state=genesis_state, genesis_block=genesis_block, genesis_config=Eth2GenesisConfig( model_class.get_genesis_state_machine_class().config), ) return chain
def override_ssz_lengths(config): override_lengths(config)
from ssz.tools import ( from_formatted_dict, ) from eth2.beacon.state_machines.forks.skeleton_lake.config import ( MINIMAL_SERENITY_CONFIG) from eth2.beacon.tools.misc.ssz_vector import ( override_lengths, ) from eth2.beacon.types.states import ( BeaconState, ) from eth_utils import humanize_hash logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) override_lengths(MINIMAL_SERENITY_CONFIG) if TYPE_CHECKING: from ruamel.yaml.compat import StreamTextType # noqa: F401 class KeyFileNotFound(FileNotFoundError): pass def extract_genesis_state_from_stream( stream: Union[Path, "StreamTextType"]) -> BeaconState: yaml = YAML(typ="unsafe") genesis_json = yaml.load(stream) state = from_formatted_dict(genesis_json, BeaconState) return state
def override_ssz_lengths(): override_lengths(XIAO_LONG_BAO_CONFIG)