Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom EVM tracer - log.contract.getAddress() #13089

Closed
1 task done
naddison36 opened this issue Dec 3, 2024 · 2 comments · Fixed by paradigmxyz/revm-inspectors#244
Closed
1 task done

Custom EVM tracer - log.contract.getAddress() #13089

naddison36 opened this issue Dec 3, 2024 · 2 comments · Fixed by paradigmxyz/revm-inspectors#244
Labels
C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled

Comments

@naddison36
Copy link

naddison36 commented Dec 3, 2024

Describe the bug

log.contract.getAddress() is returning the implementation contract address instead of the proxy address

Steps to reproduce

The following RPC call against reth

{
    "jsonrpc": "2.0",
    "method": "debug_traceTransaction",
    "params": [
        "0xaa0667392bdf6c9823c3dc48a1b7074ef772f567c6b985e4ccd3f1c1c3bbb202",
        {
            "tracer": "{data: [], fault: function(log) {}, step: function(log) { if (log.op.toString().match(/LOG/)) { const topic1 = log.stack.peek(2).toString(16); const tokenAddress = toHex(log.contract.getAddress()); if (topic1 === \"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\") { this.data.push({ event: \"Transfer\", pc: log.getPC(), tokenAddress}) } } }, result: function() { return this.data; }}"
        }
    ],
    "id": 1
}

Returns

{
    "jsonrpc": "2.0",
    "result": [
        {
            "event": "Transfer",
            "pc": 12300,
            "tokenAddress": "e42c659dc09109566720ea8b2de186c2be7d94d9"
        },
        {
            "event": "Transfer",
            "pc": 12300,
            "tokenAddress": "e42c659dc09109566720ea8b2de186c2be7d94d9"
        }
    ],
    "id": 1
}

When running against a Geth node, it returns

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "event": "Transfer",
            "pc": 12300,
            "tokenAddress": "0x889edc2edab5f40e902b864ad4d7ade8e412f9b1"
        },
        {
            "event": "Transfer",
            "pc": 12300,
            "tokenAddress": "0x889edc2edab5f40e902b864ad4d7ade8e412f9b1"
        }
    ]
}

Note the token address from reth is e42c659dc09109566720ea8b2de186c2be7d94d9 while Geth is 0x889edc2edab5f40e902b864ad4d7ade8e412f9b1

0x889edc2edab5f40e902b864ad4d7ade8e412f9b1 is the proxy address
0xe42c659dc09109566720ea8b2de186c2be7d94d9 is the implementation contract

Node logs


Platform(s)

Windows (x86)

What version/commit are you on?

reth Version: 1.1.2
Commit SHA: 496bf0bf715f0a1fafc198f8d72ccd71913d1a40
Build Timestamp: 2024-11-19T10:19:28.448154090Z
Build Features: asm_keccak,jemalloc
Build Profile: maxperf

What database version are you on?

Current database version: 2
Local database version: 2

Which chain / network are you on?

Mainnet

What type of node are you running?

Archive (default)

What prune config do you use, if any?

No response

If you've built Reth from source, provide the full command you used

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@naddison36 naddison36 added C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled labels Dec 3, 2024
@mattsse
Copy link
Collaborator

mattsse commented Dec 3, 2024

@jsvisa
Copy link
Contributor

jsvisa commented Dec 3, 2024

It's definitely incorrect in the js tracer, I'll fix it later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants