-
Notifications
You must be signed in to change notification settings - Fork 21.1k
cmd, eth, internal: introduce debug_sync #32177
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
Merged
Merged
+219
−132
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rjl493456442
commented
Jul 9, 2025
@@ -45,9 +45,6 @@ func (d *Downloader) fetchHeadersByHash(p *peerConnection, hash common.Hash, amo | |||
defer timeoutTimer.Stop() | |||
|
|||
select { | |||
case <-d.cancelCh: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary, otherwise this API will be useless if downloader finishes a sync cycle (cancel channel will be closed)
MariusVanDerWijden
approved these changes
Jul 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
This was referenced Jul 28, 2025
calbera
added a commit
to berachain/bera-geth
that referenced
this pull request
Jul 30, 2025
* core/types: minimize this invalid intermediate state (ethereum#32241) * core/rawdb: downgrade log level in chain freezer (ethereum#32253) * triedb/pathdb: use binary.append to eliminate the tmp scratch slice (ethereum#32250) `binary.AppendUvarint` offers better performance than using append directly, because it avoids unnecessary memory allocation and copying. In our case, it can increase the performance by +35.8% for the `blockWriter.append` function: ``` benchmark old ns/op new ns/op delta BenchmarkBlockWriterAppend-8 5.97 3.83 -35.80% ``` --------- Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * p2p/rlpx: optimize XOR operation using bitutil.XORBytes (ethereum#32217) Replace manual byte-by-byte XOR implementation with the optimized bitutil.XORBytes function. This improves performance by using word-sized operations on supported architectures while maintaining the same functionality. The optimized version processes data in bulk rather than one byte at a time --------- Co-authored-by: Felix Lange <fjl@twurst.com> * eth/gasestimator: fix potential overflow (ethereum#32255) Improve binary search, preventing the potential overflow in certain L2 cases * triedb/pathdb: fix an deadlock in history indexer (ethereum#32260) Seems the `signal.result` was not sent back in shorten case, this will cause a deadlock. --------- Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> * eth/protocols/snap: add healing and syncing metrics (ethereum#32258) Adds the heal time and snap sync time to grafana --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> * core: replace the empty fmt.Errorf with errors.New (ethereum#32274) The `errors.new` function does not require string formatting, so its performance is better than that of `fmt.Errorf`. * eth/catalyst: fix error message in ExecuteStatelessPayloadV4 (ethereum#32269) Correct the error message in the ExecuteStatelessPayloadV4 function to reference newPayloadV4 and the Prague fork, instead of incorrectly referencing newPayloadV3 and Cancun. This improves clarity during debugging and aligns the error message with the actual function and fork being validated. No logic is changed. --------- Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * cmd, eth, internal: introduce debug_sync (ethereum#32177) Alternative implementation of ethereum#32159 * all: replace fmt.Errorf with errors.New (ethereum#32286) The errors.new function does not require string formatting, so its performance is better than that of fmt.Errorf. * downloader: fix typos, grammar and formatting (ethereum#32288) * ethclient/simulated: Fix flaky rollback test (ethereum#32280) This PR addresses a flakiness in the rollback test discussed in ethereum#32252 I found `nonce` collision caused transactions occasionally fail to send. I tried to change error message in the failed test like: ``` if err = client.SendTransaction(ctx, signedTx); err != nil { t.Fatalf("failed to send transaction: %v, nonce: %d", err, signedTx.Nonce()) } ``` and I occasionally got test failure with this message: ``` === CONT TestFlakyFunction/Run_#100 rollback_test.go:44: failed to send transaction: already known, nonce: 0 --- FAIL: TestFlakyFunction/Run_#100 (0.07s) ``` Although `nonces` are obtained via `PendingNonceAt`, we observed that, in rare cases (approximately 1 in 1000), two transactions from the same sender end up with the same nonce. This likely happens because `tx0` has not yet propagated to the transaction pool before `tx1` requests its nonce. When the test succeeds, `tx0` and `tx1` have nonces `0` and `1`, respectively. However, in rare failures, both transactions end up with nonce `0`. We modified the test to explicitly assign nonces to each transaction. By controlling the nonce values manually, we eliminated the race condition and ensured consistent behavior. After several thousand runs, the flakiness was no longer reproducible in my local environment. Reduced internal polling interval in `pendingStateHasTx()` to speed up test execution without impacting stability. It reduces test time for `TestTransactionRollbackBehavior` from about 7 seconds to 2 seconds. * core/state: preallocate capacity for logs list (ethereum#32291) Improvement: preallocate capacity for `logs` at first to avoid reallocating multi times. * core/state: improve PrettyPrint function (ethereum#32293) --------- Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: maskpp <maskpp266@gmail.com> Co-authored-by: Delweng <delweng@gmail.com> Co-authored-by: Gary Rong <garyrong0905@gmail.com> Co-authored-by: Micke <155267459+reallesee@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: gzeon <h@arry.io> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: nthumann <nthumanna@gmail.com> Co-authored-by: Galoretka <galoretochka@gmail.com> Co-authored-by: ericxtheodore <ericxtheodore@outlook.com> Co-authored-by: Tomás Andróil <tomasandroil@gmail.com> Co-authored-by: kashitaka <takao.w9st.kashima@xica.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Alternative implementation of #32159