Parallel exec fixes#17319
Conversation
The parallel processing workers create an maintain thier own read transactions. This work well with stage loop processing except for the case where we process unwinds and we have a shared RwTx. As at the moment unwind writes directly to the DB via this call: https://github.com/erigontech/erigon/blob/fd4e3bd33b32c2cd245a3779216f2833437214cc/execution/stagedsync/stage_execute.go#L304 This PR changes the way that transactions are handled in the parallel flow to make sure the Exec3 function alway's operates in inmem mode, and expect any changes are commited to the DB before it is called so it can see the changes. This works on the parrallel flow and I'm currenty testing the serial flow. Once I have confirmed it works for both I'll look to push this to main. Once it is there I will merge it here #17319 and get this PR to a stage where it passed all tests and QA, at which point I think we're in a good position to transition main to parallel exec by default. In the meantime I'm running tip tracking on the parallel flow I think a more straghtfowrd change from a user code perspective is to only call unwind on the DB once the SharedDomain is processed and flushed with both the unwind and the subsqent block procssing included. To do this we'll need to add the unwind change set to the SharedDomain and qery it before the db or files are accessed. I have created an issue to track this here: #17782. --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: queryfast <queryfast@outlook.com> Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: canepat <16927169+canepat@users.noreply.github.com> Co-authored-by: Michelangelo Riccobene <michelangelo.riccobene@gmail.com> Co-authored-by: antonis19 <antonis19@mail.com> Co-authored-by: antonis19 <antonis19@users.noreply.github.com> Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Co-authored-by: milen <94537774+taratorio@users.noreply.github.com> Co-authored-by: Sahil Sojitra <88416181+Sahil-4555@users.noreply.github.com> Co-authored-by: lupin012 <58134934+lupin012@users.noreply.github.com> Co-authored-by: lystopad <oleksandr.lystopad@erigon.tech> Co-authored-by: AJoX <shuraev2707@gmail.com> Co-authored-by: davecrighton <58038715+davecrighton@users.noreply.github.com> Co-authored-by: Doryu <anna.shuraeva16@gmail.com> Co-authored-by: Kewei <kewei.train@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com> Co-authored-by: Matt Joiner <anacrolix@gmail.com> Co-authored-by: Bhargava Shastry <bshastry@ethereum.org> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Coder <161350311+MamunC0der@users.noreply.github.com> Co-authored-by: Somnath <snb895@outlook.com> Co-authored-by: queryfast <113781357+queryfast@users.noreply.github.com> Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com> Co-authored-by: bloxster <40316187+bloxster@users.noreply.github.com> Co-authored-by: Bloxster <bloxster@proton.me> Co-authored-by: GarmashAlex <garmasholeksii@gmail.com> Co-authored-by: sudeepdino008 <sudeepdino008@gmail.com> Co-authored-by: Julie B. <15657735+bbjubjub2494@users.noreply.github.com> Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com> Co-authored-by: Ilya Mikheev <54912776+JkLondon@users.noreply.github.com> Co-authored-by: JkLondon <me@ilyamikheev.com>
…/erigon into parallel_exec_default
…re-org Warmup workers read branch data before the main trie has written its updated entries, then wrote that stale data into the shared WarmupCache. The next CollectUpdate would merge against the stale cached entry, producing an incorrect trie root during re-org validation with PARALLEL_EXEC=true. Fix: branchFromCacheOrDB now only reads from cache (hit path unchanged), but never writes back to it. Only the main trie path (CollectUpdate) populates the cache with authoritative data. Also re-enable SetDeferCommitmentUpdates for both serial and parallel fork validation — the previous restriction to serial-only was too conservative.
|
ops this was me not the bot. i forgot to checkout out while reviewing |
…arallel re-org" This reverts commit 6535b90.
There was a problem hiding this comment.
BlockAssembler isn't used anywhere
I have just checked this it was used by the staged sync version of the minor, it seems it got removed by the merge of your refactor. I need to check what has happened to the codebase I'll move it for the moment but I need to work out what happened with the merging process - which I'll do in another branch.
| "github.com/erigontech/erigon/execution/protocol/rules/ethash" | ||
| ) | ||
|
|
||
| type FakeMerge struct { |
There was a problem hiding this comment.
this is also not used, so this file can be removed from this PR
There was a problem hiding this comment.
This is very weird. It was needed for the Amsterdam tests to pass.
There was a problem hiding this comment.
Resolved by: 0f752b1
I'll investigate the impact by running tests on the bat-devnet-2 branch with parallel on. If there are regressions there I'll make a seperate fix.
There was a problem hiding this comment.
I think I know why you no longer need it, it is because Andrew switched the "assemble tests" to not hit the public API GetAssembledBlock but instead use a non-public API GetAssembledBlockWithReceipts
one thing I have on my list is to revert that back to hitting GetAssembledBlock but we need to do some prep work for it first - e.g. we need to transition all the tests to use the merge rules engine and AllProtocolChanges - I'm planning on doing this with Claude next week
so I would say just get rid of it for now and we can address it later
There was a problem hiding this comment.
Yes it's a bit strange, also there have been some other agents changes. I think where we are now is we need to get this merged as shrove bot is running parallel fixed, which are frankly confusing. I want to get to a branch that doesn't keep having overlapping ai merges from main, that I have to merge and then may get refactored.
I've removed this in: 0f752b1 I'll investigate the impact by running tests on the bat-devnet-2 branch with parallel on. If there are regressions there I'll make a separate fix. |
| if offSeason { | ||
| t.Skip("devnet off-season") | ||
| } | ||
| t.Skip("Osaka is already covered by TestExecutionSpecBlockchain") |
There was a problem hiding this comment.
As per the comment the agent thinks these tests are covered by the TestExecutionSpecBlockchain, so it thinks this is a duplicate.
There was a problem hiding this comment.
This was a temporary skip I have removed it: aa1d8e4
| "github.com/erigontech/erigon/execution/types" | ||
| ) | ||
|
|
||
| type ChainReaderImpl struct { |
There was a problem hiding this comment.
can we rename the file to chain_reader.go? I find it a bit confusing that it is called block_assembler.go when it only contains ChainReaderImpl
There was a problem hiding this comment.
well I need to see-insert the block assembler it has somehow gotten removed by my agent. But I don't want to re-insert it here. I can rename the file which now only contains this class.
Fixed by: 230f258
| var consolidationRequestCode = common.Hex2Bytes("3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd") | ||
| var consolidationRequestCodeHash = accounts.InternCodeHash(common.BytesToHash(crypto.Keccak256(consolidationRequestCode))) | ||
|
|
||
| func InitPraguePreDeploys(db kv.TemporalRwDB, logger log.Logger) error { |
Claude's review:Branch Review: parallel_exec_default Summary This is a large branch (~70 commits, +1433/-359 lines across 37 files) that advances parallel transaction execution support and Block Access List (BAL / EIP-7928) generation. The changes span the execution Core Changes
versionedio.go — Major rewrite of versioned I/O tracking:
intra_block_state.go — Many parallel execution correctness fixes:
versionmap.go — Validation broadened:
rw_v3.go (BufferedWriter):
RPC / Networking Fixes
Flaky Test / CI Fixes
Test Updates
Potential Concerns
|
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com> Co-authored-by: root <giulio.rebuffo@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com> Co-authored-by: root <giulio.rebuffo@gmail.com>
No description provided.