Skip to content

In Homestead, geth creates an account after a transaction that goes OOG #15119

@pirapira

Description

@pirapira

On Homestead, Geth creates an account after a transaction that goes OOG. The transaction has no nested call, so the whole transaction should be reverted.

How to reproduce

On master (5ba9225)

$ make all
$ wget https://gist.githubusercontent.com/pirapira/a95202ac5c3c8fe38e756e37760c0c92/raw/42af23a7eb6eec23c78224f1bda52ee27a929c02/oog.json
$ build/bin/evm --verbosity 10 --dump statetest oog.json

shows

DEBUG[09-08|13:23:40] Trie cache stats after commit            misses=0 unloads=0
DEBUG[09-08|13:23:40] VM returned with error                   err="out of gas"
DEBUG[09-08|13:23:40] Trie cache stats after commit            misses=0 unloads=0
[
  {
    "name": "randomStatetest645",
    "pass": false,
    "fork": "Homestead",
    "error": "post state root mismatch: got 61b79e0d2bc370a210f5091af0509a1d83661dbda2d9e2abe46b60e884c13c70, want 80dfd03978291076e5ba586b1954191fbc909808cb7719834a57934004c96a6a",
    "state": {
      "root": "61b79e0d2bc370a210f5091af0509a1d83661dbda2d9e2abe46b60e884c13c70",
      "accounts": {
        "0000000000000000000000000000000000000003": {
          "balance": "0",
          "nonce": 0,
          "root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
          "codeHash": "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
          "code": "",
          "storage": {}
        },
        "1000000000000000000000000000000000000000": {
          "balance": "13599452106124161378",
          "nonce": 29,
          "root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
          "codeHash": "8f5b3a48e6f8c3d23bdfc60de8bef0ab0536dbfc397f85eeca66199f3c244aef",
          "code": "58679b8e24022d8c28f3620b55a06384bc2f83136515b61916f0f579ea3e9d28799d45aa77bf1fc1a84edf0193dea2d610209eaaf9c814",
          "storage": {}
        },
        "a94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
          "balance": "8007242901501240392",
          "nonce": 1,
          "root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
          "codeHash": "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
          "code": "",
          "storage": {}
        },
        "b94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
          "balance": "3162036930730311545",
          "nonce": 175,
          "root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
          "codeHash": "c848d630219b53525092815814072628e861e8669204095b6a71362d007a09c8",
          "code": "63cbb01282621d72de5268022948f746c938a0cb7c01ef17f23ed237d9f3262c4eb1b95112820595b127c516074df06223db7e0c396eb18074f148d96fd766dda35b6cc250661b5f83f0ed625ba68a5ff49aa1",
          "storage": {}
        },
        "ffffffffffffffffffffffffffffffffffffffff": {
          "balance": "12920981329295898785",
          "nonce": 28,
          "root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
          "codeHash": "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
          "code": "",
          "storage": {}
        }
      }
    }
  }
]

Why I think this is a problem

The output indicates there was an OOG:

DEBUG[09-08|13:23:40] VM returned with error                   err="out of gas"

and the post state has an account at 0000000000000000000000000000000000000003.

The test file oog.json has no accounts at 0000000000000000000000000000000000000003 in the prestate. The test sends a transaction that directly calls a precompiled contract, so there can be no nested calls. The observed out-of-gas should have reverted the whole world state.

@winsvega told me about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions