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

Fix #3267 #3367

Merged
merged 8 commits into from
Feb 13, 2022
Merged

Fix #3267 #3367

merged 8 commits into from
Feb 13, 2022

Conversation

cheatfate
Copy link
Contributor

Enable bellatrix blocks support.
Refactor publishBlock algorithm for json block deserialization.

@github-actions
Copy link

github-actions bot commented Feb 9, 2022

Unit Test Results

     12 files  ±0     821 suites  ±0   33m 37s ⏱️ - 1m 32s
1 671 tests ±0  1 625 ✔️ ±0    46 💤 ±0  0 ±0 
9 755 runs  ±0  9 655 ✔️ ±0  100 💤 ±0  0 ±0 

Results for commit b379a87. ± Comparison against base commit b4eb150.

♻️ This comment has been updated with latest results.

writer.endRecord()

## RestPublishedBeaconBlockBody
proc readValue*(reader: var JsonReader[RestJson],
value: var RestPublishedBeaconBlockBody) {.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this new approach based on field members? the approach where we first read the header and use the slot number to enforce a "correct" body seems more accurate (and it matches the algorithm we use for loading SSZ)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publishBlock call do not accept any other encoding except application/json. So we can't reuse slot number approach here like we made for SSZ. Also it will decode json using single pass. Before this PR we have used N passes (depends on number of forks).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright - we'll see for how long we can sustain this strategy - a body is not guaranteed to change between forks, so at some point it might lead to ambiguity - the slot is the only sure way of telling what type is expected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that i have removed slot check and i can actually restore it, but after deserialization. The specification is not very clear here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's probably a good idea to have it here, yes - the block would sooner or later be thrown out anyway (because it will not match the fork of the state), but it'll be easier to diagnose errors if they're caught here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants