feat: Introduce SSZ model into base types#3196
Conversation
6d23c40 to
e739f5e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #3196 +/- ##
===================================================
+ Coverage 93.31% 93.39% +0.08%
===================================================
Files 624 624
Lines 36994 37014 +20
Branches 3384 3386 +2
===================================================
+ Hits 34521 34570 +49
+ Misses 1693 1671 -22
+ Partials 780 773 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
marioevz
left a comment
There was a problem hiding this comment.
Overall LGTM.
I just added two minor comments in the entire PR.
I think sane next steps would be to start modifying existing models to add SSZ functionality where required, but without enabling it at first, just so we can verify using hasher that the fixtures before and after are exactly the same.
After that we can start modifying the test fixtures in order to add SSZ variants to the engine API execution payloads where possible.
Then we can start modifying the test consumers to use them.
| amount: Uint64 | ||
|
|
||
|
|
||
| class ExecutionPayload(SszModel): |
There was a problem hiding this comment.
I'm assuming something like this will replace the existing models that are generated for the test fixtures, e.g.
One question is whether we can keep the format of having a single model that declares future-fork fields as None | Type, and then None is set by previous forks where this field does not appear so it's omitted from the JSON output. How would this work with SszModel? Ideally we should keep one model to which we keep appending optional fields for future forks.
There was a problem hiding this comment.
This would not be possible with the current design as it stands rn as it is structurally not supported by SSZ to have no fields per se(bcoz of ssz being positional.)
However, that being said, I'm looking into it a bit more to find a solution to this
The single-model format itself looks preservable.I'm working out the cleanest shape for that and will follow up tommorow
|
Hey directionally, that would make sense. |
eedc105 to
b928d90
Compare
Description
This PR introduces the sszmodel as a descendant of the camelmodel. Its major work is to introduce a Pydantic model which has ssz inbuilt and can transform its members into remarkable-ready ssz-friendly types.
An extension of pr is to add the randomisation machinery for the ssz types as a port from the SSZ Static from here
The code for randomisation and the ssz static vector generation can later be moved to a different pr,however putting it here just for initial visibility.
Related Issues or PRs
#2645
Checklist
<type>(<area>): <title>, where<type>and<area>come from an appropriateCute Animal Picture