-
Notifications
You must be signed in to change notification settings - Fork 23
feat: type spec tests #581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Zacholme7
wants to merge
26
commits into
sigp:unstable
Choose a base branch
from
Zacholme7:type-spec-tests-unstable
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or 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
Co-authored-by: Copilot <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Addressed
#39
Proposed Changes
This sets up a register/loader based approach for the spec tests where each test implements the
SpecTest
trait so that we able to properly load in the correct input json files and have a simple way to setup and run each test fileThis nearly completes the type spec tests that are relevant to our implementation. These tests are all pretty straightforwards and I dont anticipate any errors with the remaining ones so we may want to just remove them or finish them up if time permitting.
I would say the main use for these is to test our SSZ encoding/decoding, which we can now confirm is spec compliant. There really may even be an argument that we should only include the ssz encoding/decoding and consider what we can scrap.
Change summary
common/ssv_types/src
just deal with de-serializing the types for the spec testsspec_tests/src/types
are all of the spec tests and they follow the same pattern. Have a struct for parsing in the data that implement theSpecTest
trait for a clean interface to run the test and get its typespec_tests/src/utils
just contains some extra de-serializers that are neededspec_tests/src/lib.rs
is the core brain for loading and running the tests. A test gets registers in theTEST_LOADERES
which makes it so that therun_tests
function can properly extract the correct files to load in for each test variantNote: We need
allow(dead_code)
at the top oflib.rs
as this code is just used for testing so clippy marks it as un-used when it is actually used. Ive done a walkthrough and manually checked the usage of everything