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

Replay blocks and generate state without sig verification #4943

Merged
merged 10 commits into from Feb 26, 2020

Conversation

terencechain
Copy link
Member

@terencechain terencechain commented Feb 25, 2020

As profiling shows, the biggest bottle neck to regenerate a historical state is 1.) randao signature verification 2.) proposer signature verification.

Given these are historical blocks in the DB, a node should be sure the saved blocks are fully verified. This PR added ExecuteStateTransitionStateGen to enable a cleaner way to replay historical blocks without skip slot cache dependency and extra signature verifications

@terencechain terencechain added Enhancement New feature or request Ready For Review A pull request ready for code review labels Feb 25, 2020
@terencechain terencechain self-assigned this Feb 25, 2020
@codecov
Copy link

codecov bot commented Feb 25, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@03c47e1). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff            @@
##             master   #4943   +/-   ##
========================================
  Coverage          ?   57.3%           
========================================
  Files             ?     265           
  Lines             ?   19800           
  Branches          ?       0           
========================================
  Hits              ?   11347           
  Misses            ?    6849           
  Partials          ?    1604

// ExecuteStateTransitionStateGen applies state transition on input historical state and block for state gen usages.
// There's no signature verification involved given state gen only works with stored block and state in DB.
// If the objects are already in stored in DB, one can omit redundant signature checks and ssz hashing calculations.
// WARNING: This method should not be used for new block.
Copy link
Member

Choose a reason for hiding this comment

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

Can this be private? This warning makes me a bit nervous since it is not enforced

Copy link
Member Author

Choose a reason for hiding this comment

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

Great point. I have moved it to stategen package and made it private

@@ -268,6 +273,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
disableStrictAttestationPubsubVerificationFlag,
disableUpdateHeadPerAttestation,
enableByteMempool,
enableStateGenSigVerify,
Copy link
Member

Choose a reason for hiding this comment

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

Add to e2e flags?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call

@rauljordan rauljordan merged commit b1231f3 into master Feb 26, 2020
@delete-merged-branch delete-merged-branch bot deleted the state-transition-without-sig-checks branch February 26, 2020 16:40
cryptomental pushed a commit to cryptomental/prysm that referenced this pull request Feb 28, 2020
…abs#4943)

* New file

* Add transition_stategen.go

* Update ProcessBlockForStateRoot

* Feature flags

* Fixed tests

* Gaz

* Make them private

* E2e flags

* Gazelle

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants