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

Pre-warm intra block cache during block execution #7055

Merged
merged 50 commits into from
May 28, 2024

Conversation

LukaszRozmej
Copy link
Member

@LukaszRozmej LukaszRozmej commented May 20, 2024

Changes

  • During block processing, run the pending set of transactions in parallel using available processors to populate the read cache; for the sequential run of transactions
  • Results in up to 2x performance when processing blocks.

Types of changes

What types of changes does your code introduce?

  • New feature (a non-breaking change that adds functionality)
  • Optimization

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Test eth_call and tracing.
Test on blocks that have self-destruct (archive sync?)

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

@benaadams
Copy link
Member

@benaadams benaadams marked this pull request as ready for review May 24, 2024 18:48
Copy link
Contributor

@smartprogrammer93 smartprogrammer93 left a comment

Choose a reason for hiding this comment

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

It looks good. One thing, can we have a config that disables the prewarmer in case it results in worse perf in some machines?

@benaadams
Copy link
Member

benaadams commented May 24, 2024

Hive tests https://github.com/NethermindEth/nethermind/actions/runs/9228022573

Bunch of hive tests fail (all Paris)

Failed: 30

✖ Bad Hash on NewPayload (Syncing=true, Sidechain=true) (Paris) (nethermind)
✖ GetPayloadBodiesByHash (Empty Transactions/Withdrawals) (Paris) (nethermind)
✖ Inconsistent Finalized in ForkchoiceState (Paris) (nethermind)
✖ Inconsistent Safe in ForkchoiceState (Paris) (nethermind)
✖ Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P9 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, ReceiptsRoot, EmptyTxs=False, CanonicalReOrg=True, Invalid P8 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=False, CanonicalReOrg=True, Invalid P9 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=True, CanonicalReOrg=True, Invalid P9 (Paris) (nethermind)
✖ Invalid NewPayload, PrevRandao, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, PrevRandao, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, ReceiptsRoot, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, StateRoot, Syncing=False, EmptyTxs=True, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Timestamp, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Transaction ChainID, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Gas, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction GasPrice, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Transaction GasPrice, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction GasTipCapPrice, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Nonce, Syncing=False, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Nonce, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Nonce, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Signature, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Signature, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Signature, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid PayloadAttributes, Zero timestamp, Syncing=False (Paris) (nethermind)
✖ Invalid PayloadAttributes, Zero timestamp, Syncing=True (Paris) (nethermind)
✖ Payload Build after New Invalid Payload: Invalid StateRoot (Paris) (nethermind)
✖ PrevRandao Opcode Transactions Test, DynamicFeeTransactions (Paris) (nethermind)
✖ Re-Org Back into Canonical Chain, Depth=10, Execute Side Payload on Re-Org (Paris) (nethermind)
✖ Sidechain Reorg (Paris) (nethermind)

@LukaszRozmej LukaszRozmej requested a review from rubo as a code owner May 24, 2024 23:18
@benaadams
Copy link
Member

@benaadams
Copy link
Member

Failed: 23

✖ GetPayloadBodiesByHash (Empty Transactions/Withdrawals) (Paris) (nethermind)
✖ Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P1 (Paris) (nethermind)
✖ Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P10 (Paris) (nethermind)
✖ Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P9 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, GasLimit, EmptyTxs=False, CanonicalReOrg=False, Invalid P8 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, GasLimit, EmptyTxs=False, CanonicalReOrg=True, Invalid P8 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, GasUsed, EmptyTxs=False, CanonicalReOrg=True, Invalid P8 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=False, CanonicalReOrg=True, Invalid P9 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, StateRoot, EmptyTxs=True, CanonicalReOrg=True, Invalid P9 (Paris) (nethermind)
✖ Invalid Missing Ancestor Syncing ReOrg, Transaction GasPrice, EmptyTxs=False, CanonicalReOrg=True, Invalid P9 (Paris) (nethermind)
✖ Invalid NewPayload, Extra VersionedHashes, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Cancun) (nethermind)
✖ Invalid NewPayload, GasLimit, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, GasLimit, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Incomplete VersionedHashes, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Cancun) (nethermind)
✖ Invalid NewPayload, Number, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, ParentHash, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Gas, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Nonce, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid NewPayload, Transaction Value, Syncing=True, EmptyTxs=False, DynFeeTxs=True (Paris) (nethermind)
✖ Invalid PayloadAttributes, Parent timestamp, Syncing=False (Paris) (nethermind)
✖ Re-Org Back into Canonical Chain, Depth=5 (Paris) (nethermind)
✖ Re-Org Back to Canonical Chain From Syncing Chain (Paris) (nethermind)
✖ Transaction Re-Org, Re-Org Out (Paris) (nethermind)

@benaadams
Copy link
Member

@benaadams
Copy link
Member

Consensus hive failures are recent EIP7610 tests ethereum/EIPs#8161

Copy link
Contributor

@asdacap asdacap left a comment

Choose a reason for hiding this comment

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

Not sure about passing in PreBlockCaches in CreateResettableWorldState. But it should work fine.

@LukaszRozmej
Copy link
Member Author

Not sure about passing in PreBlockCaches in CreateResettableWorldState. But it should work fine.

I took big concern passing it there, but it is easy way I found to support default behavior without those caches and then support behavior with caches when needed.

@LukaszRozmej LukaszRozmej merged commit d1e4f48 into master May 28, 2024
68 checks passed
@LukaszRozmej LukaszRozmej deleted the optimization/pre-warm-intra-block-cache branch May 28, 2024 08:26
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.

None yet

4 participants