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.
This makes us generates proper SSZ deserialization on preset minimal for all types
preset mainnet is not OK yet.
I've kept the obsolete fields names in the macro that implicitly declare some fields as TypeWithMaxLen.
I did try removing them a branch:
And try to not depend on them by using distinct seq:
But both branches triggered several regressions on the already passing SSZ tests.
So that will be done in later PRs.
I feel like the SSZ code has become quite hard to debug (see #557 (comment))
Note that some are not needed anymore with Nim v1 and actually any change should start by disabling it as the code won't compile otherwise: https://github.com/status-im/nim-beacon-chain/blob/6f2d980bff28153672ae79ba5c9f3ff091848b58/beacon_chain/ssz.nim#L85-L94
I wonder if a macro that select according to the nested types would not be simpler than the recursive dependently-typed templates collection that we have now, and also easier to debug as a
toStrLit
call would display the full serialization/deserialization code. It may also be faster to compile as the current code is probably quite taxing on semcheck.