Skip to content

Change IPrecompile to use Result<byte[]> allowing to return errors from precompiles#9561

Merged
LukaszRozmej merged 24 commits into
masterfrom
feature/precompile-errors-test
Nov 10, 2025
Merged

Change IPrecompile to use Result<byte[]> allowing to return errors from precompiles#9561
LukaszRozmej merged 24 commits into
masterfrom
feature/precompile-errors-test

Conversation

@flcl42

@flcl42 flcl42 commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

Allows to bubble up errors from precompiles in RPC - like Geth or Besu.

Changes

  • Change Precompiles interface
  • Allow to return errors from precompiles
  • bubble those errors in eth_call
  • Put some sensible errors into precompiles

Types of changes

What types of changes does your code introduce?

  • New feature (a non-breaking change that adds functionality)

Testing

Requires testing

  • Yes

If yes, did you write tests?

  • Yes
  • No

Documentation

Requires documentation update

  • No

Requires explanation in Release Notes

  • No

@flcl42 flcl42 force-pushed the feature/precompile-errors-test branch 2 times, most recently from 704b982 to f1b75f5 Compare October 27, 2025 08:40
@flcl42 flcl42 changed the base branch from master to feature/precompile-errors October 27, 2025 08:44
@flcl42 flcl42 changed the base branch from feature/precompile-errors to master October 27, 2025 08:45
@flcl42 flcl42 force-pushed the feature/precompile-errors-test branch from 8603416 to 9cd3989 Compare October 27, 2025 09:18
@LukaszRozmej LukaszRozmej changed the base branch from master to feature/precompile-errors November 7, 2025 11:27
@LukaszRozmej LukaszRozmej changed the base branch from feature/precompile-errors to master November 7, 2025 11:31
@LukaszRozmej LukaszRozmej changed the title [IGNORE]Feature/precompile errors test Change IPrecompile to use Result<byte[]> allowing to return errors from precompiles Nov 7, 2025
…errors-test

# Conflicts:
#	src/Nethermind/Nethermind.Evm.Precompiles/BN254.cs
#	src/Nethermind/Nethermind.Evm.Precompiles/BN254AddPrecompile.cs
#	src/Nethermind/Nethermind.Evm.Precompiles/BN254MulPrecompile.cs
#	src/Nethermind/Nethermind.Evm.Precompiles/BN254PairingPrecompile.cs
#	src/Nethermind/Nethermind.Evm.Precompiles/Ripemd160Precompile.cs
#	src/Nethermind/Nethermind.JsonRpc/JsonRpcService.cs
#	src/Nethermind/Nethermind.Precompiles.Benchmark/PrecompileBenchmarkBase.cs
@LukaszRozmej LukaszRozmej marked this pull request as ready for review November 7, 2025 12:24
Comment thread src/Nethermind/Nethermind.Evm.Precompiles/Bls/BlsExtensions.cs Outdated
@flcl42

flcl42 commented Nov 10, 2025

Copy link
Copy Markdown
Contributor Author

Comment thread src/Nethermind/Nethermind.Evm.Precompiles/Bls/BlsExtensions.cs Outdated
Comment thread src/Nethermind/Nethermind.Evm.Precompiles/Bls/G1AddPrecompile.cs Outdated
Comment thread src/Nethermind/Nethermind.Evm.Precompiles/Bls/G2AddPrecompile.cs Outdated
Comment thread src/Nethermind/Nethermind.Evm.Precompiles/Bls/MapFp2ToG2Precompile.cs Outdated
Comment thread src/Nethermind/Nethermind.Evm.Precompiles/Bls/PairingCheckPrecompile.cs Outdated
Comment thread src/Nethermind/Nethermind.Evm.Precompiles/Bls/G1AddPrecompile.cs Outdated
@LukaszRozmej LukaszRozmej merged commit c8224af into master Nov 10, 2025
80 checks passed
@LukaszRozmej LukaszRozmej deleted the feature/precompile-errors-test branch November 10, 2025 10:47
kamilchodola added a commit that referenced this pull request Nov 13, 2025
* Change IPrecompile to use Result<byte[]> allowing to return errors from precompiles (#9561)

* Change IPrecompile to use Result<byte[]>

* whitespace

* fix benchmark

* fix tests

* Move back DataGasCost to simple long

* Some fixes

* fixes

* refactor

* expose precompile error from EVM

* ModExpPrecompile should fail on run not on DataGasCost

* fixes

* Fix tests and bubble up precompile errors

* fix build

* Another try

* Error(2)

* Choose substate error

* fixes

* Simplify handling errors

* fix PairingCheckPrecompile

* Add syntatic suggar, while preserving lazy evaluation

* fix

---------

Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com>

* Update outdated link (#9654)

* Feature/xdc prevent finalized reorg (#9655)

* override in blocktree

* fix

* unittest

* format

* fix

* Fix

* remove test

* cleanup

* Do not insert block if invalid fork

* format

* review comments

* format

* Update src/Nethermind/Nethermind.Xdc/XdcBlockTree.cs

Co-authored-by: Lukasz Rozmej <lukasz.rozmej@gmail.com>

---------

Co-authored-by: Lukasz Rozmej <lukasz.rozmej@gmail.com>

* fix: DynamicCallWithInput to skip value for DELEGATECALL/STATICCALL (#9672)

* fix: DynamicCallWithInput to skip value for DELEGATECALL/STATICCALL

* update test

* Route ColumnDb.Remove through Set(null) to use wrapper semantics (#9636)

* Changes for test blockchain (#9680)

* test blockchain changes

* format

* Improve diag Docker container (#9635)

* Fix bump-version action and adds reviewers as default (#9557)

* feat: add reviewers to the bump-version action

* feat: use checkout action

* Fix free disk space check for non existent directories (HealthChecks) (#9666)

* Create non existent db directory to get drive info

* Add db folder to ignored to pass tests

* Update OP Superchain chains (#9675)

Co-authored-by: emlautarom1 <emlautarom1@users.noreply.github.com>
Co-authored-by: Lautaro Emanuel <31224949+emlautarom1@users.noreply.github.com>

* Remove Nethermind.Analytics (#9683)

* Feature/block production blob limit (#9686)

* Introduce BlockProductionBlobLimit to limit number of blobs picked when producing block

* Add MaxBlobCount calculation tests

* whitespace

* Rename

* Update src/Nethermind/Nethermind.Config/IBlocksConfig.cs

Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>

---------

Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>

* Fix resource leak in HttpJsonRpcSubmitter (#9687)

Update HttpJsonRpcSubmitter.cs

* Remove unused BlockFilter.StartBlockNumber and simplify CreateBlockFilter (#9630)

* Remove unused BlockFilter.StartBlockNumber and simplify CreateBlockFilter

* fix ci

* formatting

* Revert "Improve Block related caching (#9571)" (#9688)

* Revert "Improve Block related caching (#9571)"

This reverts commit fe8adcc.

* merge fix

* Update Dockerfiles (#9689)

Co-authored-by: rubo <rubo@users.noreply.github.com>

* Fix Chainspec for Taiko-Hoodi (#9699)

fix transition for taiko-hoodi

* Xdc : Add XdcTestBlockchain for Module testing (#9596)

* start

* more dependencies

* build

* rename

* voting

* vote task

* bit of refactor

* invoke block produced

dont seal

* refactor context

* format

* timeout missing

* block producer

* format

* basic incomplete setup

* test

* block production test

* format

* merge cleanup

* merged

* use the constant

* use timestamp from attributes

* Merged

* Merged fix

* cleanup

* fixes

* cleanup

* commit cert before vote

propose in background

* merge and refactor

* rename

* format

* comment

* refactor to continuous loop

* remove TCM

* Format

* fix

* draft implmentation

* cleanup

* handle regenesis block in XdcTestBlockchain

* refactor to inherit from TestBlockchain

* register FromXdcContainer

* handle _fromContainer from base

* attempt rotating signers

* test fix

* test fix

* test and container setup fix

* decoder fix

* bug fixes

* init QC

* test xdc sealer rotation

* bug fixes and working now

* Format

* Update packages.lock.json

* remove

* total difficulty fix

* format

* override in blocktree

* fix

* unittest

* format

* fix build issues

* fix

* Fix

* remove test

* fixes

* format

* cleanup

* undo merge and cleanup usings

* add custom genesis builder for xdc

* format whitespaces

* Do not insert block if invalid fork

* format

* reorg test

* revert block processor

* revert cloning of header in PrepareBlockForProcessing

* reorgs tests working

* fix bad db

* fix seal validator

* fix

* format

* implement add block without commiting qc and generate extra keys for testing

* fix and refactor

* optional params

* fix

* one fix and a bit of refactor

* reorg test

* rename

* return block instead

* reorg test

* fixes

* dont set author

* 10 seconds per add block

* test blockchain changes

* format

* fixes for hotstuff module

* fix test block producer

* fixes for epoch master calculation

* format

* rename

* rollback QC test blockchain order

* snapshotmanager tests fixed

* format

* cleanup

* remove TestBlockchainTester

* cleanup

* small fix in header validator test

---------

Co-authored-by: ak88 <anders.holmbjerg@hotmail.com>
Co-authored-by: cicr99 <kr1000a@gmail.com>

* XDC - Snapshot Manager refactor (#9695)

refactor of snapshot manager

* Xdc : Port BlockInfoValidator Module Tests  (#9650)

* start

* more dependencies

* build

* rename

* voting

* vote task

* bit of refactor

* invoke block produced

dont seal

* refactor context

* format

* timeout missing

* block producer

* format

* basic incomplete setup

* test

* block production test

* format

* merge cleanup

* merged

* use the constant

* use timestamp from attributes

* Merged

* Merged fix

* cleanup

* fixes

* cleanup

* commit cert before vote

propose in background

* merge and refactor

* rename

* format

* comment

* refactor to continuous loop

* remove TCM

* Format

* fix

* draft implmentation

* cleanup

* handle regenesis block in XdcTestBlockchain

* refactor to inherit from TestBlockchain

* register FromXdcContainer

* handle _fromContainer from base

* attempt rotating signers

* test fix

* test fix

* test and container setup fix

* decoder fix

* bug fixes

* init QC

* test xdc sealer rotation

* bug fixes and working now

* Format

* Update packages.lock.json

* remove

* draft impl of blockinfo validator tests

* total difficulty fix

* format

* override in blocktree

* fix

* unittest

* format

* fix build issues

* fix

* Fix

* remove test

* fixes

* format

* cleanup

* undo merge and cleanup usings

* add custom genesis builder for xdc

* format whitespaces

* Do not insert block if invalid fork

* format

* reorg test

* revert block processor

* revert cloning of header in PrepareBlockForProcessing

* reorgs tests working

* fix bad db

* fix seal validator

* fix

* format

* implement add block without commiting qc and generate extra keys for testing

* fix and refactor

* optional params

* fix

* one fix and a bit of refactor

* reorg test

* rename

* return block instead

* reorg test

* fixes

* fix failing test

* dont set author

* 10 seconds per add block

* test blockchain changes

* format

* ws fixes

* fixes for hotstuff module

* fix test block producer

* fixes for epoch master calculation

* format

* rename

* rollback QC test blockchain order

* CLEANUP

* remove unused

---------

Co-authored-by: ak88 <anders.holmbjerg@hotmail.com>
Co-authored-by: cicr99 <kr1000a@gmail.com>

* Unit tests for commit in XDC QC manager (#9700)

unittests

* Xdc : Port HeaderValidator Module Tests  (#9617)

* start

* more dependencies

* build

* rename

* voting

* vote task

* bit of refactor

* invoke block produced

dont seal

* refactor context

* format

* timeout missing

* block producer

* format

* basic incomplete setup

* test

* block production test

* format

* merge cleanup

* merged

* use the constant

* use timestamp from attributes

* Merged

* Merged fix

* cleanup

* fixes

* cleanup

* commit cert before vote

propose in background

* merge and refactor

* rename

* format

* comment

* refactor to continuous loop

* remove TCM

* Format

* fix

* draft implmentation

* cleanup

* handle regenesis block in XdcTestBlockchain

* refactor to inherit from TestBlockchain

* register FromXdcContainer

* handle _fromContainer from base

* attempt rotating signers

* test fix

* test fix

* test and container setup fix

* draft port of some HeaderValidatorTests

* fix build issue

* extra tests

* decoder fix

* handle merge issues

* bug fixes

* init QC

* test xdc sealer rotation

* bug fixes and working now

* Format

* Update packages.lock.json

* remove

* fix build issues

* more build fixes

* total difficulty fix

* format

* override in blocktree

* fix

* unittest

* format

* fix build issues

* fix

* Fix

* remove test

* fixes

* format

* cleanup

* undo merge and cleanup usings

* add custom genesis builder for xdc

* format whitespaces

* Do not insert block if invalid fork

* format

* reorg test

* revert block processor

* revert cloning of header in PrepareBlockForProcessing

* reorgs tests working

* fix bad db

* fix seal validator

* fix

* format

* implement add block without commiting qc and generate extra keys for testing

* fix and refactor

* optional params

* fix

* one fix and a bit of refactor

* reorg test

* rename

* return block instead

* minor changes and fixes

* reorg test

* fixes

* bring back cache field in sealValidator

* dont set author

* 10 seconds per add block

* test blockchain changes

* format

* ws fixes

* fixes for hotstuff module

* fix test block producer

* fixes for epoch master calculation

* format

* rename

* rollback QC test blockchain order

* cleanup

---------

Co-authored-by: ak88 <anders.holmbjerg@hotmail.com>
Co-authored-by: cicr99 <kr1000a@gmail.com>

* Update base-sepolia testnet matrix (#9705)

chore: update base-sepolia testnet matrix

* Comment out Linea in workflows (#9706)

chore: comment linea on our workflows

---------

Co-authored-by: Alexey Osipov <me@flcl.me>
Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com>
Co-authored-by: Jaye Turner <jayeturnerjatu@gmail.com>
Co-authored-by: ak88 <anders@nethermind.io>
Co-authored-by: Snezhkko <snezhkodaria38@gmail.com>
Co-authored-by: radik878 <radikpadik76@gmail.com>
Co-authored-by: Ruben Buniatyan <rubo@users.noreply.github.com>
Co-authored-by: Marcos Antonio Maceo <35319980+stdevMac@users.noreply.github.com>
Co-authored-by: Damian Orzechowski <114909782+damian-orzechowski@users.noreply.github.com>
Co-authored-by: core-repository-dispatch-app[bot] <173070810+core-repository-dispatch-app[bot]@users.noreply.github.com>
Co-authored-by: emlautarom1 <emlautarom1@users.noreply.github.com>
Co-authored-by: Lautaro Emanuel <31224949+emlautarom1@users.noreply.github.com>
Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>
Co-authored-by: maradini77 <140460067+maradini77@users.noreply.github.com>
Co-authored-by: GarmashAlex <garmasholeksii@gmail.com>
Co-authored-by: Ben {chmark} Adams <thundercat@illyriad.co.uk>
Co-authored-by: Diptanshu Kakwani <dipkakwani@gmail.com>
Co-authored-by: Ayman Bouchareb <Ayman.bouchareb@outlook.fr>
Co-authored-by: ak88 <anders.holmbjerg@hotmail.com>
Co-authored-by: cicr99 <kr1000a@gmail.com>
Co-authored-by: Carmen Irene Cabrera Rodríguez <49727740+cicr99@users.noreply.github.com>
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.

4 participants