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

Only sleep during prepare if node is validating #1857

Closed

Conversation

piersy
Copy link
Contributor

@piersy piersy commented Feb 24, 2022

Description

This change mitigates the problem of low gas estimates #1856, by ensuring that non validating nodes do not wait till the next block is due when engine.Prepare is called. This results in non validating nodes having an up to date pending block( I.E a pending block with a number 1 greater than the last inserted block). For some reason validating nodes produce the correct gas estimate even when they have an old pending block (I.E a pending block with the same number as the last inserted block).

Tested

I have tested this locally using mycelo to start a network with 1 validator and then starting up a full node that connects to that network. Without the fix the tests here repeatedly show a low gas estimate for the first few gas estimation calls made against the pending block. With the fix I have not been able to elicit an incorrect gas estimate (although it is definitely possible because block insertion and pending block creation are not part of a single atomic operation). Prior to the fix I observed from the logs that gas estimates using the latest and pending block would execute against a block with the same number, after the fix I observed from the logs that gas estimates with the pending block executed against a block with number one greater than gas estimates with the latest block.

Related issues

-Mitigates #1856

@piersy piersy requested a review from a team as a code owner February 24, 2022 18:31
@piersy piersy requested review from hbandura and nategraf and removed request for a team February 24, 2022 18:31
@piersy
Copy link
Contributor Author

piersy commented Feb 24, 2022

Coverage from tests in ./e2e_test/... for ./consensus/istanbul/... at commit 600431b

coverage: 51.2% of statements across all listed packages
coverage:  64.1% of statements in consensus/istanbul
coverage:  51.3% of statements in consensus/istanbul/backend
coverage:   0.0% of statements in consensus/istanbul/backend/backendtest
coverage:  45.0% of statements in consensus/istanbul/backend/internal/db
coverage:  42.5% of statements in consensus/istanbul/backend/internal/enodes
coverage:  24.3% of statements in consensus/istanbul/backend/internal/replica
coverage:  71.8% of statements in consensus/istanbul/core
coverage:   0.0% of statements in consensus/istanbul/proxy
coverage:  75.3% of statements in consensus/istanbul/uptime
coverage: 100.0% of statements in consensus/istanbul/uptime/store
coverage:  51.8% of statements in consensus/istanbul/validator
coverage:  79.2% of statements in consensus/istanbul/validator/random
CommentID: 91e403c12a

@piersy
Copy link
Contributor Author

piersy commented Feb 25, 2022

I think I have a fix for this problem now

@piersy piersy closed this Feb 25, 2022
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.

1 participant