Skip to content

Citrea fixes#1

Open
ercecan wants to merge 25 commits intov0.18.1-branchfrom
citrea-fixes
Open

Citrea fixes#1
ercecan wants to merge 25 commits intov0.18.1-branchfrom
citrea-fixes

Conversation

@ercecan
Copy link
Member

@ercecan ercecan commented Dec 8, 2025

No description provided.

mattsse and others added 25 commits December 8, 2025 12:39
closes #292

we previously didn't set the error field for the exit function

(cherry picked from commit 6c7e358)
Closes paradigmxyz/revm-inspectors#294 while
retaining fix for paradigmxyz/reth#13089

The idea is that in steps (aka logs) we want `contract.address` to
always be the address of contract which storage is accessed
(`target_address`). However, when dealing with delegatecall frames,
`contract.address` should be set to the `bytecode_address` as it is
marking the destination of delegatecall.

This means we can't just forward `active_call().contract` to steps
anymore and need to re-construct the `Contract` value manually

(cherry picked from commit da1b9ee)
ref paradigmxyz/reth#13089

we should return the original bytes here

(cherry picked from commit 17a7b51)
fix gas accounting for call opcodes

cc @sslivkoff @rakita

(cherry picked from commit 13d515a)
(cherry picked from commit 1303994)
(cherry picked from commit 477a770)
(cherry picked from commit 221aead)
The Geth trace builder incorrectly sets the same `returnData` value for
all opcode steps in a trace,
using the final call output instead of the step-specific return data
buffer state.

## Expected Behavior

Each opcode step should display the return data buffer state
at that specific point in execution.

## Actual Behavior

All opcode steps show the same returnData value - the final output of
the entire
call.

For example, in a Fibonacci contract call that returns 1, every single
opcode
step shows:
"returnData":
"0x0000000000000000000000000000000000000000000000000000000000000001"

(cherry picked from commit 2a4ae16)
… (#363)

Closes paradigmxyz/revm-inspectors#350
Closes paradigmxyz/revm-inspectors#349

- Fixes `isPrecompiled` built-in to work correctly. Before we were
incorrectly checking `precompiles_registered` flag which caused the fn
to never be injected. Added test for it as well
- Adds `slice` built-in and a test for it

(cherry picked from commit 6f2ecd1)
…e (#336)

Currently the revm-inspectors js tracer acts differently from the geth
implementation where the `getCost()` function returns the cumulative
amount of cost for each step instead of the individual opcode cost. I
added a simple function that will store the previous spent value and
then use that in the next step to calculate the currect opcode cost.

(cherry picked from commit d596fc0)
Ref paradigmxyz/reth#18904
Closes paradigmxyz/revm-inspectors#364

Changes js objects to be created via
`JsObject::with_object_proto(ctx.intrinsics())` instead of
`JsObject::default()` as suggested in
boa-dev/boa#4460 (comment) thus
making sure helpers like `hasOwnProperty` are accessible.

Changes `JsValue -> f64` conversion to happen via `to_numeric_number` so
that bigints can also be used as input values for `slice` functions

(cherry picked from commit 7124ebd)
closes paradigmxyz/reth#18942

we should not set this if code is disabled in the config

(cherry picked from commit 8736651)
The disableCode flag was not being respected in diff mode for the
PreStateTracer. When disableCode was set to true, code was correctly
filtered from the pre state but was still appearing in the post state.

This fix ensures that when disableCode is true, the code field is set to
None for both pre and post states in diff mode, matching the expected
behavior from Geth.

Added test coverage to verify the fix works correctly in both cases
(disableCode=true and disableCode=false).

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
(cherry picked from commit 998801f)
Geth will convert the empty bytes to null, and omit it in the response,
I think we should align with it, the empty nulls seems meanless.

Below is the differ of the tx:
https://etherscan.io/tx/0x337749b7c19859b2d773868b60e82a06ae008db9a80d41db76d7020d976a72e7

> left is geth, right is reth

<img width="1446" height="190" alt="image"
src="https://github.com/user-attachments/assets/65049603-c967-4c9c-8c7f-7b4496c902e5"
/>

(cherry picked from commit 922eb33)
as_str could panic if the opcode is unknown

(cherry picked from commit 7aafabf)
…(#377)

Closes #376

- Don't insert selfdestructed accounts in post state
- Added tests to verify behavior for London and Cancun

(cherry picked from commit e159a65)
This aims at resolving issues mentioned in #382 , typically this one :
<img width="1818" height="694" alt="image"
src="https://github.com/user-attachments/assets/51b82944-c711-421b-8479-05095ae9bbce"
/>

To fix this , what i did was :
- Keep track of addresses that are marked as Create and were truly empty
in the database snapshot. Only these addresses are filtered from the
prestate diff so prefunded contract deployments remain visible.

- Introduce account_was_empty helper to avoid re-computing the emptiness
check and add a regression test
(prestate_diff_keeps_prefunded_created_accounts) that covers a prefunded
creation vs. a true empty-address creation.

cc @mattsse  Please check it out if it resolves

should close this one paradigmxyz/reth#19703

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
(cherry picked from commit fd4cf14)
Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved, but no need to merge this pr


/// Registers the precompiles in the JS context
fn register_precompiles<CTX: ContextTr<Journal: JournalExt>>(&mut self, context: &mut CTX) {
if !self.precompiles_registered {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incredible

eyusufatik added a commit to chainwayxyz/citrea that referenced this pull request Dec 9, 2025
# Description
Updates revm-inspectors with fixes to multiple tracers, mainly the
prestate tracer.

Since `revm-inspectors` couldn't be updated, we created a fork at
https://github.com/chainwayxyz/revm-inspectors/ and applied all fix PRs
after v0.18.1 on the v0.18.1 tag. The changes can be reviewed here:
chainwayxyz/revm-inspectors#1
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.