Improve txpool loop synchronization around background resets.
This change:
- adds an explicit termination channel to signal pool shutdown
- tracks forced-reset intent and a waiter channel inside the reset loop
- ensures reset waiters are notified on completion or on pool termination
- allows an explicit sync request path to trigger an additional reset round when needed
Scope is limited to internal txpool concurrency control in core/txpool/txpool.go, with no protocol or RPC behavior change.
* bug fix for using same config object
* update
* change log level to trace on ispochswtich
---------
Co-authored-by: liam.lai <liam.lai@babylonchain.io>
Partial backport of ethereum/go-ethereum PR #27841, limited to txpool wrapper removal.
- Migrate txpool interfaces/call sites from `*txpool.Transaction` to `*types.Transaction`
- Update eth/miner/contracts paths and related tests accordingly
- No intended behavior change
Blob sidecar validation/handling changes from upstream are not included here.
Introduce txpool.PendingFilter and migrate Pending(...) signatures from positional params to a typed struct.
- Add core/txpool.PendingFilter with MinTip/BaseFee fields for cheap call-site filtering
- Update txpool subpool interface and all call sites in eth/miner to pass the filter struct
- Keep behavior unchanged for empty filter (equivalent to previous nil,nil usage)
- Refresh legacypool tests to use the new API shape
This is a refactor-only change intended to improve API clarity and future extensibility without changing consensus or RPC semantics.
Switch LazyTransaction gas caps from *big.Int to *uint256.Int and convert once at pending retrieval time.
In miner ordering, keep fee comparisons on uint256 and precompute TRC21 gas price in uint256 form to avoid repeated big-int conversions in heap comparisons.
Also update affected tests and call sites in legacypool/worker/helper paths.
Compatibility: LazyTransaction exported field types changed (GasFeeCap/GasTipCap).
Introduce dynamic-fee pre-filtering in txpool pending retrieval to reduce
allocations and downstream processing work during mining and tx propagation.
What changed:
- Change the `Pending` API from `Pending(enforceTips bool)` to
`Pending(minTip *uint256.Int, baseFee *uint256.Int)` in txpool interfaces.
- Implement pre-filtering in `legacypool.Pending` by comparing effective tip
against the provided `minTip/baseFee` for non-local, non-special txs.
- Update call sites to the new API:
- miner work assembly (`miner/worker.go`)
- tx sync (`eth/sync.go`)
- pool transaction retrieval (`eth/api_backend.go`)
- protocol/test interfaces (`eth/protocol.go`, `eth/helper_test.go`).
Tests:
- Add targeted coverage for pending filtering semantics in
`core/txpool/legacypool/legacypool_test.go`, including:
- minTip threshold boundary behavior
- baseFee-aware effective tip filtering
- local/special transaction exemption behavior
- dynamic-fee boundary behavior when baseFee is nil.
Impact:
- Preserves existing behavior while making pending selection cheaper for
downstream consumers.
- Improves confidence in edge-case behavior through dedicated tests.
Synchronize miner gas tip updates across subsystems when RPC updates gas price.
- update eth miner API to apply gas tip changes to both txpool and miner
- add miner/worker SetGasTip path and initialize worker tip from config
- adjust bind util test to use params.GWei over base fee
Ref: #28933
Package a single XDC binary for all networks and remove binary-switching logic from the CI/CD flow.
Changes:
- cicd/Dockerfile: build once and copy only /usr/bin/XDC
- cicd/entry.sh: validate NETWORK and remove runtime relink
- Makefile: make XDC-devnet-local depend on XDC; remove constants file swap
- common/constants: delete duplicated constants.go.{testnet,devnet,local}
Impact:
- network differences are now driven by runtime config, not separate binaries
Miner configuration is unified under [Eth.Miner] (GasCeil/GasPrice/Etherbase/ExtraData), replacing legacy top-level [Eth] miner keys.
Operational impact: existing config files using [Eth].GasPrice/[Eth].Etherbase/[Eth].ExtraData must be migrated before upgrade.
Behavior update: gasprice=0 remains valid; only negative gas prices are sanitized at startup.
Default change: XDCGenesisGasLimit is reduced to 42,000,000 and now feeds miner default GasCeil (including default --miner-gaslimit), so nodes relying on defaults should review capacity expectations.
Replace the quick-test target to run `go run build/ci.go test -short -failfast`.
Remove the `--quick` flag and package-filter path from `build/ci.go`, so test selection relies on Go's built-in short mode instead of custom package exclusion.
This keeps quick-test behavior aligned with tests guarded by `testing.Short()` and avoids maintaining bespoke skip logic in CI tooling.
* refactor(txpool): remove wrapper type #27841
Partial backport of ethereum/go-ethereum PR #27841, limited to txpool wrapper removal.
- Migrate txpool interfaces/call sites from `*txpool.Transaction` to `*types.Transaction`
- Update eth/miner/contracts paths and related tests accordingly
- No intended behavior change
Blob sidecar validation/handling changes from upstream are not included here.
* refactor(core/txpool): migrate tx subscription to SubscribeTransactions #28243
Replace the old SubscribeNewTxsEvent-style plumbing with the new
SubscribeTransactions(ch, reorgs) interface across txpool, eth protocol
manager, API backend, miner worker, and test helpers.
Key changes:
- Extend txpool/subpool tx subscription interface with a reorgs flag
- Route eth tx announcement path to reorgs=false (new tx announcements only)
- Route API/miner subscriptions to reorgs=true
- Move subscription-scope cleanup to TxPool.Close()
- Add Gas field to LazyTransaction in legacy pending view
Note:
LegacyPool currently cannot strictly separate newly seen and resurrected txs,
so the reorgs flag is accepted for API compatibility and future blob-subpool
integration.
Fix flaky countdown reset tests by performing an explicit second Reset before validating the second timeout window, and using a boundary-safe time check.
Observed failure:
--- FAIL: TestCountdownShouldReset (14.00s)
countdown_test.go:53: Correctly reset the countdown once
countdown_test.go:72: Countdown did not reset correctly second time
This is a follow-up to #29520, and a preparatory PR to a more thorough
change in the journalling system.
This PR hides the journal-implementation details away, so that the
statedb invokes methods like `JournalCreate`, instead of explicitly
appending journal-events in a list. This means that it's up to the
journal whether to implement it as a sequence of events or
aggregate/merge events.
This PR also makes it so that management of valid snapshots is moved
inside the journal, exposed via the methods `Snapshot() int` and
`RevertToSnapshot(revid int, s *StateDB)`.
JournalSetCode journals the setting of code: it is implicit that the
previous values were "no code" and emptyCodeHash. Therefore, we can
simplify the setCode journal.
The self-destruct journalling is a bit strange: we allow the
selfdestruct operation to be journalled several times. This makes it so
that we also are forced to store whether the account was already
destructed.
What we can do instead, is to only journal the first destruction, and
after that only journal balance-changes, but not journal the
selfdestruct itself.
This simplifies the journalling, so that internals about state
management does not leak into the journal-API.
Preimages were, for some reason, integrated into the journal management,
despite not being a consensus-critical data structure. This PR undoes
that.
---------
Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Add backward-compatible XDPoSConfig JSON decoding for the legacy key
"foudationWalletAddr" introduced before PR #2063 renamed it to
"foundationWalletAddr".
Without this compatibility layer, old on-disk chain configs are decoded with a
zero FoundationWalletAddr, causing XDPoSConfigEqual mismatch and startup rewind
("mismatching XDPoS not equal in database").
This patch:
- Implements custom UnmarshalJSON for XDPoSConfig that reads both keys.
- Prefers foundationWalletAddr when both keys are present.
- Keeps existing behavior for all other fields.
- Adds regression tests for legacy-key decoding and precedence.
Validation:
- go test ./params/...
Currently our state journal tracks each storage update to a contract, having the ability to revert those changes to the previously set value.
For the very first modification however, it behaves a bit wonky. Reverting the update doesn't actually remove the dirty-ness of the slot, rather leaves it as "change this slot to it's original value". This can cause issues down the line with for example write witnesses needing to gather an unneeded proof.
This PR modifies the storageChange journal entry to not only track the previous value of a slot, but also whether there was any previous value at all set in the current execution context. In essence, the PR changes the semantic of storageChange so it does not simply track storage changes, rather it tracks dirty storage changes, an important distinction for being able to cleanly revert the journal item.
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Introduce a new simulated backend implementation under ethclient/simulated and migrate bind-facing wrappers/tests to use it.
Key changes:
- Add the new backend entry points and behavior in ethclient/simulated, including chain control helpers used by tests (commit/rollback/fork/time adjustment).
- Update legacy bind wrappers in accounts/abi/bind/backends to delegate to the new simulated backend while preserving old APIs.
- Align bind v2/backend and utility tests to the new simulated backend client surface and transaction flow.
- Refresh abigen/bind tests and shared interfaces impacted by the backend migration.
Compatibility notes:
- Keep backward-compatible wrapper constructors for existing contract test code.
- Preserve legacy transaction paths in tests while supporting EIP-1559-aware flows where applicable.
Validation:
- Verified affected packages compile and pass tests.
- Verified repository-wide go test ./... passes after follow-up compatibility fixes.
* chore: enable reward, penalty and dynamic gas on devnet
* update number to 3420000 for devnet
---------
Co-authored-by: liam.lai <liam.lai@babylonchain.io>
The upstream libray has removed the assembly-based implementation of
keccak. We need to maintain our own library to avoid a peformance
regression.
---------
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: lightclient <lightclient@protonmail.com>