Skip to content

Prestate Tracer reported incorrect nonce for address being created #28439

@noel2004

Description

@noel2004

System information

Geth version: Above 12.0, with debug API enabled in RPC

Expected behaviour

For a deployment tx. While calling debug_tracedTransaction with prestate tracer being specified, since the contract at 0x0b96fec58064f3407ca8336426054d0352a48567 is beging deployed so the nonce in prestate for this address should be 0. Or there should be no any entry for this address (according to some discussion for the creation

Actual behaviour

prestate tracer reported 0x0b96fec58064f3407ca8336426054d0352a48567 with nonce of 1:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "0x0b96fec58064f3407ca8336426054d0352a48567": {
            "balance": "0x0",
            "nonce": 1,
            "storage": {
                "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000005": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000006": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000007": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000008": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000009": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x000000000000000000000000000000000000000000000000000000000000000a": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x000000000000000000000000000000000000000000000000000000000000000b": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x000000000000000000000000000000000000000000000000000000000000000c": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x000000000000000000000000000000000000000000000000000000000000000d": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x000000000000000000000000000000000000000000000000000000000000000e": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x000000000000000000000000000000000000000000000000000000000000000f": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000010": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000011": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000012": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000000000000000000013": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0xb315cdd88ca22ece6d4f62a7e497509bef421e4416dbb9ed70552ccabf555f5d": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0xb5404d7cb54ab2e7b3ead812eae081c4b9e3f52c2a8d91d2a1b746239103f1ea": "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0xe8606e3a62d90ea1b10be4c36159d8ee53cb53db4ee3bbe8cc66661363b7e3e3": "0x0000000000000000000000000000000000000000000000000000000000000000"
            }
        },
...
}

Steps to reproduce the behaviour

Call the debug API of a geth node, for example, using following cmd:

curl <URL for RPC node> \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"debug_traceTransaction","params":["0x4544af322f2b63d8dbe4dcd41c6c80535095d93406b316087706adca97e662b3", {"tracer": "prestateTracer"}], "id":1,"jsonrpc":"2.0"}'

Discussion

Note that there is more account being created in the tx above like 0x9426105341f2fe684f3218f33987c453faf42de4, and prestate tracer report correct nonce (0) for this address. We note that 0x0b96fec58064f3407ca8336426054d0352a48567 should have be traced in the CaptureStart hook, where the to address has been initialized and nonce being set to 1 rather than 0. This has also made the exist method return true and the address is not pruned in the final result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions