Last active
March 12, 2019 13:54
-
-
Save djrtwo/91b68809d108bad0a1e673c889241cf4 to your computer and use it in GitHub Desktop.
stub for state tests
This file contains 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 characters
import yaml | |
from sanity_check import ( | |
create_genesis_state, | |
test_empty_block_transition, | |
) | |
def generate_yaml_test(pre_state, blocks, post_state, config, fields, root=False): | |
pass | |
# if config is empty: | |
# config = default config | |
# output config | |
# output serialized pre-state | |
# output blocks | |
# output subset of test_fields | |
# if len(fields) == 0: | |
# output entire state | |
# else: | |
# for field in fields: | |
# output resulting field | |
# if root, output root | |
def test_generator_wrapper(test_fn, start_state, config, fields, root=False): | |
blocks, post_state = test_fn(start_state) | |
generate_yaml_test(start_state, blocks, post_state, config, fields) | |
def generate_genesis_tests(): | |
genesis_state = create_genesis_state(num_validators=100) | |
test_generator_wrapper(test_empty_block_transition, genesis_state, {}, ['slot']) | |
if __name__ == '__main__': | |
generate_genesis_tests() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment