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

Execution service 2: separate execution from validation #1536

Merged
merged 89 commits into from
Jul 10, 2023

Conversation

tsahee
Copy link
Contributor

@tsahee tsahee commented Mar 24, 2023

Block recorder is becomes function of execution client.
Heavy rewrite of block-validators to support new architecture, really simplifying them along the way.

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Mar 24, 2023
@tsahee tsahee marked this pull request as draft March 24, 2023 17:22
@tsahee
Copy link
Contributor Author

tsahee commented Mar 24, 2023

made this draft to avoid accidental merging.

@tsahee tsahee changed the title Execution separate 2: separate execution from validation Execution service 2: separate execution from validation Mar 24, 2023
@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Merging #1536 (329611e) into master (154a17d) will decrease coverage by 3.73%.
The diff coverage is 56.02%.

❗ Current head 329611e differs from pull request most recent head 2fea784. Consider uploading reports for the commit 2fea784 to get more accurate results

@@            Coverage Diff             @@
##           master    #1536      +/-   ##
==========================================
- Coverage   54.49%   50.76%   -3.73%     
==========================================
  Files         221      270      +49     
  Lines       33099    31704    -1395     
  Branches        0      555     +555     
==========================================
- Hits        18036    16095    -1941     
- Misses      12906    13382     +476     
- Partials     2157     2227      +70     

Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

I have a couple of minor comments and this has a merge conflict now, but it's looking good!

staker/block_validator.go Outdated Show resolved Hide resolved
if v.recordSentA < countUint64 {
v.recordSentA = countUint64
}
v.validatedA = countUint64
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't these all need to be atomic writes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, because we're write-holding the reorg-lock. There are comments but I'll make them a little clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, because we're write-holding the reorg-lock. There are comments but I'll make them a little clearer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add comments to created(), recordSent(), and validated() indicating that they need the reorg lock read-held. Right now Validated(t *testing.T) is called in a test without the lock, but we don't seem to enable the race detector for that test so we should be good.

if err != nil {
if errors.Is(err, ErrGlobalStateNotInChain) && s.fatalErr != nil {
fatal := fmt.Errorf("latest staked not in chain: %w", err)
s.fatalErr <- fatal
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this fatal error might prevent the node from performing a reorg it needs to do to correct its invalid state (because it shuts down before it's able to reorg). Perhaps this should only be fatal if the stakedInfo's inbox accumulator matches the inbox tracker's record, otherwise just return an error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's about this.
We've already read the batch for this data and it's quite old (feed messages won't get us "caught up")
Most chances are there was some weird one-off error in calculating state that we can't really recover from.
I think being very noisy with this error is worth having to go through manual hoops in case it is recoverable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense. I guess if someone is error-looping on this they could always just disable the staker for a bit until the reorg happens.

Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM

@PlasmaPower PlasmaPower merged commit 7bba01f into master Jul 10, 2023
@PlasmaPower PlasmaPower deleted the execution-separate-over-valiation branch July 10, 2023 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants