How to use the eth2spec.phase0.spec function in eth2spec

To help you get started, we’ve selected a few eth2spec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethereum / trinity / scripts / test_transition.py View on Github external
def pyspec_transition(pre_state, pre_block):
    yaml = YAML(typ='base')
    loaded = yaml.load(Path('min.config.bak'))
    config_data = dict()
    for k, v in loaded.items():
        if v.startswith("0x"):
            config_data[k] = bytes.fromhex(v[2:])
        else:
            config_data[k] = int(v)

    spec.apply_constants_preset(config_data)

    spec_pre_state = decoder.translate_value(pre_state, spec.BeaconState)
    spec_pre_block = decoder.translate_value(pre_block, spec.BeaconBlock)

    spec_post_block = spec.state_transition(
        spec_pre_state, spec_pre_block, False
    )
    return spec_post_block

eth2spec

Eth2 spec, provided as Python package for tooling and testing

CC0-1.0
Latest version published 3 years ago

Package Health Score

63 / 100
Full package analysis

Similar packages