Skip to content
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

Ssz fixes #566

Merged
merged 6 commits into from
Nov 19, 2019
Merged

Ssz fixes #566

merged 6 commits into from
Nov 19, 2019

Conversation

mratsim
Copy link
Contributor

@mratsim mratsim commented Nov 18, 2019

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:

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))

  • Lots of templates and auto indirection
  • Error messages with typedesc param is worse than with generics
  • int/int64/static int64 issues with large constants
  • Workarounds for Nim bugs in dependent type/generic/static resolution.

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.

@mratsim mratsim changed the base branch from master to devel November 18, 2019 17:18
@mratsim mratsim merged commit bb0979f into devel Nov 19, 2019
@delete-merged-branch delete-merged-branch bot deleted the ssz-fixes branch November 19, 2019 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant