Skip to content

Conversation

@radik878
Copy link
Contributor

Changes

  • In PowForwardHeaderProvider.AssembleResponseFromLastResponseBatch() return a pooled copy via ToPooledList(newResponse.Count) while keeping LastResponseBatch as the internal cache to avoid use-after-dispose.
  • Added Cache_block_headers_with_disposal to ForwardHeaderProviderTests.cs to call GetBlockHeaders(...) twice with disposal and assert only a single underlying ISyncPeer.GetBlockHeaders(...) call occurs (cache path).

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

ForwardHeaderProviderTests.Cache_block_headers_with_disposal validates that two consecutive calls with using do not trigger a second peer header request when the cache is valid/large enough.

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.

Thank you for your contribution

@asdacap asdacap merged commit 44f7e02 into NethermindEth:master Oct 30, 2025
81 checks passed
LukaszRozmej added a commit that referenced this pull request Nov 3, 2025
* Reduce peer logging (#9591)

* Cancel timeout in NewPayload fast-path (#9597)

* Refactor JsonRpcService.ExecuteAsync (#9600)

* Refactor JsonRpcService.ExecuteAsync

* Feedback

* Add reflection cache

* Optimize DeserializeParameters

* Optimize enumeration

* Can be made static

* Remove unused using

* Use regular Dictionary

* formatting

* Optimise CREATE(2) remove redundant account creation (#9585)

* delay creation of executor account

* store nonce zero for new executor

* remove account creation

---------

Co-authored-by: Marc Harvey-Hill <[email protected]>

* Replace Task.Delay/Thread.Sleep with NUnit .After() in tests (#9576)

* Initial plan

* Convert Task.Delay and Thread.Sleep to After pattern in tests

Co-authored-by: LukaszRozmej <[email protected]>

* Fix async method signatures after removing await

Co-authored-by: LukaszRozmej <[email protected]>

* Add NSubstituteExtensions and refactor to use ReceivedBool helper

Co-authored-by: LukaszRozmej <[email protected]>

* fix

* Try avoiding exceptions

* increase Timeout

* change

* fix

* whitespace

* make Big_test Explicit

* fix negative paths

* revert one test

* Revert inappropriate After() conversions for blocking tests

Co-authored-by: asdacap <[email protected]>

* Remove redundant diagnostic messages from ReceivedCallsMatching

Co-authored-by: flcl42 <[email protected]>

* Display diagnostic message only once per test when ReceivedCallsMatching fails

Co-authored-by: LukaszRozmej <[email protected]>

* Remove diagnostic logging from ReceivedCallsMatching to avoid issues

Co-authored-by: LukaszRozmej <[email protected]>

* remove stale annotation

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: LukaszRozmej <[email protected]>
Co-authored-by: lukasz.rozmej <[email protected]>
Co-authored-by: asdacap <[email protected]>
Co-authored-by: flcl42 <[email protected]>

* Arbitrum - Refund on contract creation failure (#9610)

* extension for arbitrum on refund at contract deployment failure

* Fix eth_sumulate defaults (#9529)

* Fix

* Refactor

* Test

* Fix taiko

* Revert "Test"

This reverts commit 9eb30e0.

* Fix

* Fix gas

* Test

* Fix validate flag

* Fix taiko

* Fix gasEstimation tests

* Add more flags

* Fix tests

* Change flags

* Try fix tests

* Fix tests

* Proper nonce validation

* More fixes

* Revert

* Fix tests

* Fix types

* Add two tests

* Fix known-failing-tests

* Default type

* known failing tests

* Fix suggestions

* Fix tests

* Extra peers reporting for supported chains runs (#9612)

* Fix StatelessExecution tool build (#9613)

* Fix/pow forward header provider cache ownership (#9614)

* Fix: return copy from cache to avoid use-after-dispose

* add a test

* Update EthereumTests (#9225)

* Update tests to fix missing test jsons

* Use newer tests; add more moern legacy tests; fix transition tests; fix slnx

* Rename projects; remove Blockchain tests as it was moved to legacy fully

* Fix a csproj

* Add tests

* Add tests

* Move transaition tests to legacy too; simplify namespaces

* Fix workflow

* Fix syntax

* Fix transaction tests

* Add empty coinbase

* Add coinbase even if transaction is declined

* Fix evm slnx compilation

* Can be failing cause?

* Return blockhash tests

* Rollback coinbase set for blockchain tests

* Less tests as old one have broken format

* Rm TODO, as SuicideStorage tests are covered by state tests

* Fix

* Update to 5.0.0

* Remove redundant length==1 special-case in SliceWithZeroPadding (#9566)

* Catch index exceptions in RlpDecoders and pack it in RlpException (#9603)

* Catch index exceptions in RlpDecoders and pack it in RlpException

* Catch index exceptions in RlpDecoders and pack it in RlpException (#9604)

* Initial plan

* Update RLP decoders to inherit from base classes with exception handling

Updated all RLP decoder classes to inherit from RlpValueDecoder<T> or RlpStreamDecoder<T> instead of directly implementing interfaces. This ensures all decoders automatically get IndexOutOfRangeException and ArgumentOutOfRangeException handling, wrapping them in RlpException.

Changed decoders:
- WithdrawalDecoder, KeccakDecoder, LogEntryDecoder
- AuthorizationTupleDecoder, AccessListDecoder
- AccountDecoder, HeaderDecoder, BlockDecoder, BlockBodyDecoder
- ChainLevelDecoder, BlockInfoDecoder
- ReceiptMessageDecoder, ReceiptStorageDecoder, CompactReceiptStorageDecoder
- ReceiptArrayStorageDecoder

All decode methods renamed to DecodeInternal and marked as protected override.
All Encode/GetLength methods marked as override where needed.

Co-authored-by: LukaszRozmej <[email protected]>

* Update remaining RLP decoders across all modules

Updated RLP decoders in Consensus.Clique, Network, Consensus.AuRa, Taiko, and Xdc modules to inherit from base classes:

- Consensus.Clique: SnapshotDecoder
- Network: NetworkNodeDecoder
- Consensus.AuRa: ValidatorInfoDecoder, PendingValidatorsDecoder
- Taiko: L1OriginDecoder
- Xdc: ExtraConsensusDataDecoder, QuorumCertificateDecoder, SnapshotDecoder, TimeoutCertificateDecoder, TimeoutDecoder, VoteDecoder, XdcBlockInfoDecoder

All decoders now inherit from RlpValueDecoder<T> or RlpStreamDecoder<T> to get automatic exception handling for IndexOutOfRangeException and ArgumentOutOfRangeException.

Co-authored-by: LukaszRozmej <[email protected]>

* Mark all RLP decoder classes as sealed

Added sealed modifier to all 27 RLP decoder classes to prevent further inheritance:

- Core decoders (15): WithdrawalDecoder, KeccakDecoder, LogEntryDecoder, AccountDecoder, HeaderDecoder, BlockDecoder, BlockBodyDecoder, ChainLevelDecoder, BlockInfoDecoder, ReceiptMessageDecoder, ReceiptStorageDecoder, CompactReceiptStorageDecoder, ReceiptArrayStorageDecoder, AuthorizationTupleDecoder, AccessListDecoder

- Consensus decoders (3): SnapshotDecoder (Clique), ValidatorInfoDecoder (AuRa), PendingValidatorsDecoder (AuRa)

- Network decoder (1): NetworkNodeDecoder

- Taiko decoder (1): L1OriginDecoder

- Xdc decoders (7): ExtraConsensusDataDecoder, QuorumCertificateDecoder, SnapshotDecoder, TimeoutCertificateDecoder, TimeoutDecoder, VoteDecoder, XdcBlockInfoDecoder

These classes are not inherited from and marking them as sealed provides better performance and clearer design intent.

Co-authored-by: LukaszRozmej <[email protected]>

* Update remaining RLP decoders: BasicStreamDecoder, TxDecoder, and OptimismReceiptMessageDecoder

Updated the last remaining decoder implementations to inherit from base classes:

- BasicStreamDecoder.cs: Updated 6 primitive type decoders (ByteStreamDecoder, ShortStreamDecoder, UShortStreamDecoder, IntStreamDecoder, UIntStreamDecoder, ULongStreamDecoder) to inherit from RlpStreamDecoder<T> and marked as sealed

- TxDecoder.cs: Updated TxDecoder<T> base class to inherit from RlpValueDecoder<T> (not sealed as it has subclasses: TxDecoder, SystemTxDecoder, GeneratedTxDecoder)

- OptimismReceiptMessageDecoder.cs: Updated OptimismReceiptMessageDecoder to inherit from RlpStreamDecoder<TxReceipt> (not sealed as it has subclass OptimismReceiptTrieDecoder)

All decoders now have automatic exception handling for IndexOutOfRangeException and ArgumentOutOfRangeException.

Co-authored-by: LukaszRozmej <[email protected]>

* Fix TxDecoder: Add back Rlp Encode method for test compatibility

Added the `Rlp Encode(T item, RlpBehaviors)` method that was removed during refactoring. This method is used by tests and provides a convenient way to encode transactions to Rlp without manually creating a RlpStream.

The method internally uses the override Encode method to ensure exception handling is still applied.

Co-authored-by: LukaszRozmej <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: LukaszRozmej <[email protected]>

* fix build

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: LukaszRozmej <[email protected]>

* Add more logging in MultiSyncModeSelector (#9616)

* Add more logging

* fix for seq

* feat: Add configurable EIP-2935 ring buffer size (#9611)

* Blockchain Engine Tests support (#9394)

* initial commit

* fix normal blockchain tests

* tidy

* restore disposes

* comment out BALs

* fix var declaration

* don't set basefeepergas if null

* use network from genesis in blockchain test

* update blockchain test base

* add tracer to blockchain tests runner

* tidy

* tidy

* add genesis processing timeout

* check for null head block

* try undo some changes

* detect failure to process genesis

* check removal is error

* add back checks for genesis spec

* only add noenginerequeststracker in tests

* comment sealed block check

* try remove timeout

* only configure merge for engine tests

* fix merge module init

* add back timeout and remove sealer

* await new payloads

* use reflection for engine rpc method calling

---------

Co-authored-by: Marc Harvey-Hill <[email protected]>

* use zero address when from address not specified in rpc calls (#9578)

* use zero address for null values

* small test

* fix proof rpc

* fix test and add more changes

* Allow serving snap requests for more than 128 blocks (#9602)

* Initial plan

* Add SnapServingMaxDepth configuration and update LastNStateRootTracker

Co-authored-by: tanishqjasoria <[email protected]>

* Add clarifying comments for configuration changes

Co-authored-by: tanishqjasoria <[email protected]>

* Get reorgDepth from config instead of hardcoding in test

Co-authored-by: LukaszRozmej <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: tanishqjasoria <[email protected]>
Co-authored-by: Tanishq Jasoria <[email protected]>
Co-authored-by: LukaszRozmej <[email protected]>

* Remove console log from FileTestsSource (#9622)

Removed console log for loading test file.

* Correct docs value for Blocks.BlockProductionMaxTxKilobytes (#9620)

* Update OP Superchain chains (#9629)

Co-authored-by: emlautarom1 <[email protected]>

* Auto-update fast sync settings (#9628)

Co-authored-by: rubo <[email protected]>

* feat: write AckMessage directly to IByteBuffer without temp array (#9623)

* Optimize Ripemd (#9627)

---------

Co-authored-by: Ben {chmark} Adams <[email protected]>
Co-authored-by: Marc <[email protected]>
Co-authored-by: Marc Harvey-Hill <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: LukaszRozmej <[email protected]>
Co-authored-by: asdacap <[email protected]>
Co-authored-by: flcl42 <[email protected]>
Co-authored-by: Stavros Vlachakis <[email protected]>
Co-authored-by: Nikita Mescheryakov <[email protected]>
Co-authored-by: Ruben Buniatyan <[email protected]>
Co-authored-by: radik878 <[email protected]>
Co-authored-by: Alexey Osipov <[email protected]>
Co-authored-by: GarmashAlex <[email protected]>
Co-authored-by: Daniil Ankushin <[email protected]>
Co-authored-by: Tanishq Jasoria <[email protected]>
Co-authored-by: tanishqjasoria <[email protected]>
Co-authored-by: core-repository-dispatch-app[bot] <173070810+core-repository-dispatch-app[bot]@users.noreply.github.com>
Co-authored-by: emlautarom1 <[email protected]>
Co-authored-by: VolodymyrBg <[email protected]>
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.

3 participants