Git Product home page Git Product logo

Comments (7)

jsvisa avatar jsvisa commented on September 13, 2024 2

@mattsse @ZzPoLariszZ I think bluealloy/revm#1746 will fix the first issue. I found the refund and value missing only happened in transactions which were before the cancun upgrade, the old ones were correct, eg 0x9aac76c9ed191da631b5e70c8824f2ad106a0f5147d57c611ed64653734dd85f

And for the second issue:

The from field is also incorrect, which should be same as

I think this may be another issue, maybe related to the delegatecall, will dig into it later.

from reth.

ZzPoLariszZ avatar ZzPoLariszZ commented on September 13, 2024

Reason

The tracers field of inspector after this line: https://github.com/paradigmxyz/reth/blob/main/crates/rpc/rpc/src/debug.rs#L701

did not update the selfdestruct_refund_target and selfdestruct_transferred_value fields after the EVM executions.

traces: CallTraceArena {
        arena: [
            CallTraceNode {
                parent: None,
                children: [],
                idx: 0,
                trace: CallTrace {
                    depth: 0,
                    success: true,
                    caller: 0xd9046c5d48ac38926978fc6193ae481e39c19810,
                    address: 0x44d139f02b5819b4a12777a89706b33065311dbd,
                    maybe_precompile: None,
                    selfdestruct_refund_target: None,
                    selfdestruct_transferred_value: None,
                    kind: Call,
                    value: 0,
                    data: 0x83197ef0,
                    output: 0x,
                    gas_used: 5195,
                    gas_limit: 8936,
                    status: SelfDestruct,
                    steps: [],
                    decoded: DecodedCallTrace {
                        label: None,
                        return_data: None,
                        call_data: None,
                    },
                },
                logs: [],
                ordering: [],
            },
        ],
    },

May need to modify revm 🤔

from reth.

mattsse avatar mattsse commented on September 13, 2024

hmm, this is odd,

it looks like this is never called?
https://github.com/paradigmxyz/evm-inspectors/blob/2c49c7cd81ee78faa5d58d5a6eac77cb8b05bb2b/src/tracing/mod.rs#L658-L661

I wonder if this has something to do with this being the root call or something else is wrong here:

https://github.com/paradigmxyz/evm-inspectors/blob/2c49c7cd81ee78faa5d58d5a6eac77cb8b05bb2b/src/tracing/builder/geth.rs#L128-L132

from reth.

ZzPoLariszZ avatar ZzPoLariszZ commented on September 13, 2024

I think this call is never called.

hmm, this is odd,

it looks like this is never called? https://github.com/paradigmxyz/evm-inspectors/blob/2c49c7cd81ee78faa5d58d5a6eac77cb8b05bb2b/src/tracing/mod.rs#L658-L661

Dealing with root call should be correct since it can correctly process its derived selfdestruct call like pushing into calls and handling the from address. I still believe that it is the inspector and revm problem, selfdestruct_refund_target and selfdestruct_transferred_value fields are not correctely updated (still None) after the EVM executions. Therefore, when root call deals with to and value fields in its derived selfdestruct call, two fields are missing.

I wonder if this has something to do with this being the root call or something else is wrong here:

https://github.com/paradigmxyz/evm-inspectors/blob/2c49c7cd81ee78faa5d58d5a6eac77cb8b05bb2b/src/tracing/builder/geth.rs#L128-L132

from reth.

ZzPoLariszZ avatar ZzPoLariszZ commented on September 13, 2024

This problem also happens when the SELFDESTRUCT can be derived from a DELEGATECALL

Example to Reproduce

curl http://localhost:8545 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"debug_traceTransaction","params":["0xece7c7e45ff6a500a272676969cbdf6c4d5095484b7ea6d211eb3c4fb9f4544f", {"tracer": "callTracer"}], "id":1,"jsonrpc":"2.0"}'

From Reth

-- skip --
           {'calls': [{'calls': [{'from': '0x0a252663dbcc0b073063d6420a40319e438cfa59',
                                  'gas': '0x0',
                                  'gasUsed': '0x0',
                                  'input': '0x',
                                  'type': 'SELFDESTRUCT'}],
                       'from': '0xf0ef973bb461c54a4fd452c598da4ec5f696b9c2',
                       'gas': '0x29422',
                       'gasUsed': '0x14a8',
                       'input': '0x928dd2a7',
                       'to': '0x0a252663dbcc0b073063d6420a40319e438cfa59',
                       'type': 'DELEGATECALL',
                       'value': '0x0'}],
            'from': '0x0a252663dbcc0b073063d6420a40319e438cfa59',
            'gas': '0x29f1e',
            'gasUsed': '0x154b',
            'input': '0x928dd2a7',
            'to': '0xf0ef973bb461c54a4fd452c598da4ec5f696b9c2',
            'type': 'CALL',
            'value': '0x0'}],
-- skip --

From Etherscan and QuickNode

-- skip --
           {'calls': [{'calls': [{'from': '0xf0ef973bb461c54a4fd452c598da4ec5f696b9c2',
                                  'gas': '0x0',
                                  'gasUsed': '0x0',
                                  'input': '0x',
                                  'to': '0x0000000000000000000000000000000000000000',
                                  'type': 'SELFDESTRUCT',
                                  'value': '0x0'}],
                       'from': '0xf0ef973bb461c54a4fd452c598da4ec5f696b9c2',
                       'gas': '0x29422',
                       'gasUsed': '0x14a8',
                       'input': '0x928dd2a7',
                       'to': '0x0a252663dbcc0b073063d6420a40319e438cfa59',
                       'type': 'DELEGATECALL',
                       'value': '0x0'}],
            'from': '0x0a252663dbcc0b073063d6420a40319e438cfa59',
            'gas': '0x29f1e',
            'gasUsed': '0x154b',
            'input': '0x928dd2a7',
            'to': '0xf0ef973bb461c54a4fd452c598da4ec5f696b9c2',
            'type': 'CALL',
            'value': '0x0'}],
-- skip --

The to and value fields are missing in the SELFDESTRUCT call frame.

The from field is also incorrect, which should be same as

  • the from field in the parent DELEGATECALL call frame, or
  • the to field in the parent CALL call frame.

from reth.

ZzPoLariszZ avatar ZzPoLariszZ commented on September 13, 2024

For the DELEGATECALL related, should we open another issue or just keep this issue open? @rakita

from reth.

rakita avatar rakita commented on September 13, 2024

For the DELEGATECALL related, should we open another issue or just keep this issue open? @rakita

Can you test if delegatecall is fixed with selfdestruct fix. Not saying it is, but maybe they are related.

from reth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.