Add pools supporting sync committees: - naive sync aggregation pool - observed sync contributions pool - observed sync contributors pool - observed sync aggregators pool Add SSZ types and tests related to sync committee signatures. Co-authored-by: Michael Sproul <michael@sigmaprime.io> Co-authored-by: realbigsean <seananderson33@gmail.com>
		
			
				
	
	
		
			91 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env python3
 | 
						|
 | 
						|
# The purpose of this script is to compare a list of file names that were accessed during testing
 | 
						|
# against all the file names in the eth2.0-spec-tests repository. It then checks to see which files
 | 
						|
# were not accessed and returns an error if any non-intentionally-ignored files are detected.
 | 
						|
#
 | 
						|
# The ultimate goal is to detect any accidentally-missed spec tests.
 | 
						|
 | 
						|
import os
 | 
						|
import sys
 | 
						|
 | 
						|
# First argument should the path to a file which contains a list of accessed file names.
 | 
						|
accessed_files_filename = sys.argv[1]
 | 
						|
 | 
						|
# Second argument should be the path to the eth2.0-spec-tests directory.
 | 
						|
tests_dir_filename = sys.argv[2]
 | 
						|
 | 
						|
# If any of the file names found in the eth2.0-spec-tests directory *starts with* one of the
 | 
						|
# following strings, we will assume they are to be ignored (i.e., we are purposefully *not* running
 | 
						|
# the spec tests).
 | 
						|
excluded_paths = [
 | 
						|
    # Configs from future phases
 | 
						|
    "tests/mainnet/config/custody_game.yaml",
 | 
						|
    "tests/mainnet/config/sharding.yaml",
 | 
						|
    "tests/mainnet/config/merge.yaml",
 | 
						|
    "tests/minimal/config/custody_game.yaml",
 | 
						|
    "tests/minimal/config/sharding.yaml",
 | 
						|
    "tests/minimal/config/merge.yaml",
 | 
						|
    # Merge tests
 | 
						|
    "tests/minimal/merge",
 | 
						|
    "tests/mainnet/merge",
 | 
						|
    # Eth1Block
 | 
						|
    #
 | 
						|
    # Intentionally omitted, as per https://github.com/sigp/lighthouse/issues/1835
 | 
						|
    "tests/minimal/phase0/ssz_static/Eth1Block/",
 | 
						|
    "tests/mainnet/phase0/ssz_static/Eth1Block/",
 | 
						|
    "tests/minimal/altair/ssz_static/Eth1Block/",
 | 
						|
    "tests/mainnet/altair/ssz_static/Eth1Block/",
 | 
						|
    # LightClientStore
 | 
						|
    "tests/minimal/altair/ssz_static/LightClientStore",
 | 
						|
    "tests/mainnet/altair/ssz_static/LightClientStore",
 | 
						|
    # LightClientUpdate
 | 
						|
    "tests/minimal/altair/ssz_static/LightClientUpdate",
 | 
						|
    "tests/mainnet/altair/ssz_static/LightClientUpdate",
 | 
						|
    # LightClientSnapshot
 | 
						|
    "tests/minimal/altair/ssz_static/LightClientSnapshot",
 | 
						|
    "tests/mainnet/altair/ssz_static/LightClientSnapshot",
 | 
						|
    # Fork choice
 | 
						|
    "tests/mainnet/phase0/fork_choice",
 | 
						|
    "tests/minimal/phase0/fork_choice",
 | 
						|
    "tests/mainnet/altair/fork_choice",
 | 
						|
    "tests/minimal/altair/fork_choice",
 | 
						|
]
 | 
						|
 | 
						|
def normalize_path(path):
 | 
						|
	return path.split("eth2.0-spec-tests/", )[1]
 | 
						|
 | 
						|
# Determine the list of filenames which were accessed during tests.
 | 
						|
passed = set()
 | 
						|
for line in open(accessed_files_filename, 'r').readlines():
 | 
						|
    file = normalize_path(line.strip().strip('"'))
 | 
						|
    passed.add(file)
 | 
						|
 | 
						|
missed = set()
 | 
						|
accessed_files = 0
 | 
						|
excluded_files = 0
 | 
						|
 | 
						|
# Iterate all files in the tests directory, ensure that all files were either accessed
 | 
						|
# or intentionally missed.
 | 
						|
for root, dirs, files in os.walk(tests_dir_filename):
 | 
						|
   for name in files:
 | 
						|
      name = normalize_path(os.path.join(root, name))
 | 
						|
      if name not in passed:
 | 
						|
          excluded = False
 | 
						|
          for excluded_path in excluded_paths:
 | 
						|
              if name.startswith(excluded_path):
 | 
						|
                  excluded = True
 | 
						|
                  break
 | 
						|
          if excluded:
 | 
						|
              excluded_files += 1
 | 
						|
          else:
 | 
						|
              print(name)
 | 
						|
              missed.add(name)
 | 
						|
      else:
 | 
						|
          accessed_files += 1
 | 
						|
 | 
						|
# Exit with an error if there were any files missed.
 | 
						|
assert len(missed) == 0, "{} missed files".format(len(missed))
 | 
						|
 | 
						|
print("Accessed {} files ({} intentionally excluded)".format(accessed_files, excluded_files))
 |