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

client: improve new payload and fcu block executions #2880

Merged
merged 7 commits into from
Jul 14, 2023

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Jul 12, 2023

fix and optimize the block execution for engine's new payload and fcUs, supersedes #2787

  • chain head was being used for getting vmHead instead of the actual vm head
  • optimize and correct checks if the parent(s) have been executed (track and use executedBlocks )
  • recursively find parents would only find just 1 parent, vmHead hash should have been used as its used to find parents till vmHead
  • add executedBlocks map in engine for easy figuring out what has been executed (rather than checking stateRoot in state manager because a bad block can be formed with previously executed stateRoot which would of course be declared valid) ,
  • and better pruning of executedBlocks and remoteBlocks based on finalized and vm head
  • skip block executions if too many blocks (including parents) are pending to be executed for new payload or if the VmExecution s already busy - and return optimistic SYNCING response which would be resolved later to valids or invalids
  • make sure that running flag is switched to false even if run(..) of VmExecution fails

A branch of this (devnet 7 compatible) seems to be working fine on devnet-7

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Merging #2880 (63c7aca) into master (88b5402) will increase coverage by 0.91%.
The diff coverage is 76.62%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.62% <ø> (ø)
blockchain 92.58% <ø> (ø)
client 87.19% <76.62%> (?)
common 97.13% <ø> (ø)
ethash ?
evm 69.86% <ø> (ø)
rlp ?
statemanager 85.16% <ø> (ø)
trie ?
tx 95.96% <ø> (ø)
util 87.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


const result = await this.vm.runBlock({ clearCache, ...opts })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the diff here and below is because of the putting the code inside try catch

@@ -271,168 +279,170 @@ export class VMExecution extends Execution {
if (this.running || !this.started || this.config.shutdown) return 0
this.running = true

// run inside a lock so as to not be entangle with runWithoutSetHead or setHead
return this.runWithLock<number>(async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the diff here is because of the try catch added so that this.running can be turned to false in the finally section

Copy link
Member

Choose a reason for hiding this comment

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

👍

@holgerd77
Copy link
Member

Wanted to review, is this ready? 🙂

@holgerd77
Copy link
Member

(and could we merge on positive review?)

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Did a somewhat rough review commit-by-commit, I think this is very much the type of work though which strongly „proves itself“ just by using it in practical scenarios without too much side effects.

Will approve and merge.

@holgerd77 holgerd77 merged commit 5c8a340 into master Jul 14, 2023
@holgerd77 holgerd77 deleted the fix-findparents-engine branch July 14, 2023 10:32
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.

2 participants