ValidatorStatus field serialization as int instead of List of int

This commit is contained in:
mratsim 2018-12-06 16:54:07 +01:00 committed by Mamy Ratsimbazafy
parent 92de51c315
commit d6f0b24c16
2 changed files with 6175 additions and 4600 deletions

File diff suppressed because it is too large Load Diff

View File

@ -319,6 +319,11 @@ def toStrShardComs(shard_comms: List[List[ShardAndCommittee]]) -> str:
# #
# ################################################################ # ################################################################
## Try to deal with enums - otherwise for "ValidatorStatus.Active" you get [1], instead of 1
def yaml_ValidatorStatus(dumper, data):
return dumper.represent_data(data.value)
yaml.add_representer(ValidatorStatus, yaml_ValidatorStatus)
if __name__ == '__main__': if __name__ == '__main__':
import sys, random import sys, random
@ -355,4 +360,4 @@ if __name__ == '__main__':
# yaml.dump(test_cases, sys.stdout) # yaml.dump(test_cases, sys.stdout)
with open('test_vector_shuffling.yml', 'w') as outfile: with open('test_vector_shuffling.yml', 'w') as outfile:
yaml.dump(metadata, outfile, default_flow_style=False) # Dump at top level yaml.dump(metadata, outfile, default_flow_style=False) # Dump at top level
yaml.dump({'test_cases': test_cases}, outfile) yaml.dump({'test_cases': test_cases}, outfile, default_flow_style=False)