Skip to content

Conversation

jwasinger
Copy link
Contributor

@jwasinger jwasinger commented Jul 7, 2025

changes:

  • Introduce SyncTarget method on the debug API, reusing the same code path as the --synctarget flag.
  • rename FullSyncTester -> SyncOverride to better reflect its purpose.
  • SyncOverride is now a member on Ethereum. Move it into the eth package to prevent a cyclical import (eth->catalyst->eth).

@jwasinger
Copy link
Contributor Author

depends on #32149 being merged first.

@jwasinger jwasinger force-pushed the debug-sync-target branch from a34a0e0 to cc7bc75 Compare July 8, 2025 08:15
@jwasinger jwasinger changed the title all: introduce debug_syncTarget all: add debug_syncTarget as an API method Jul 8, 2025
@rjl493456442
Copy link
Member

Originally this feature is only used for development purpose, which assumes there is no CL attached.
If we want to provide it to users, we need to make sure the race between the engine API and this one
is properly handled.

@jwasinger
Copy link
Contributor Author

My understanding is that there is the expectation that this is used during an adverse network event where the CL can't track the right chain, and that users (us mostly) would be expected to disconnect the CL and manually set the sync target to keep up with whatever we deem the correct chain to be.

@jwasinger
Copy link
Contributor Author

But we could also expand the scope of this to play safely with the engine API. I'm not sure atm what that will entail.

rjl493456442 added a commit that referenced this pull request Jul 28, 2025
@rjl493456442
Copy link
Member

Close it in favor of #32177

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 <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: maskpp <[email protected]>
Co-authored-by: Delweng <[email protected]>
Co-authored-by: Gary Rong <[email protected]>
Co-authored-by: Micke <[email protected]>
Co-authored-by: Felix Lange <[email protected]>
Co-authored-by: gzeon <[email protected]>
Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: nthumann <[email protected]>
Co-authored-by: Galoretka <[email protected]>
Co-authored-by: ericxtheodore <[email protected]>
Co-authored-by: Tomás Andróil <[email protected]>
Co-authored-by: kashitaka <[email protected]>
howjmay pushed a commit to iotaledger/go-ethereum that referenced this pull request Aug 27, 2025
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
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.

2 participants