Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

StateDiff does not contain refunded address account #8158

Closed
cleanunicorn opened this issue Mar 19, 2018 · 7 comments
Closed

StateDiff does not contain refunded address account #8158

cleanunicorn opened this issue Mar 19, 2018 · 7 comments
Labels
F2-bug 🐞 The client fails to follow expected behavior. Q1-mentor 🕺 An easy task were a mentor is available. Please indicate in the issue who the mentor could be. Q2-easy 💃 Can be fixed by copy and pasting from StackOverflow.

Comments

@cleanunicorn
Copy link

cleanunicorn commented Mar 19, 2018

I'm running:

  • Which Parity version?: 1.10.0-nightly-793624b
  • Which operating system?: Linux
  • How installed?: binaries
  • Are you fully synchronized?: yes
  • Which network are you connected to?: ethereum
  • Did you try to restart the node?: yes

trace_replayTransaction does not contain in the stateDiff the account that ETH was refunded to after suicide.
I am expecting the account 0x6c6677787779626e676572657265726572657374 to be part of the stateDiff section and to contain its balance change

Transaction hash 0x5816cb0c95789787803ba22bf73e5d1be8a1bc21ac8c91523ce128ac3bb7a157

It's one of the DOS txs

"stateDiff ": {
    "0x4bb96091ee9d802ed039c4d1a5f6216f90f81b01": {
        "balance": {
            "*": {
                "from": "0x1789f998fe8fc5ebbe", 
                "to": "0x178a2ee36a37676bbe"
            }
        }, 
        "code": "=", 
        "nonce": "=", 
        "storage": {}
    }, 
    "0xd3e32594cedbc102d739142aa70d21f4caea5618": {
        "balance": {
            "*": {
                "from": "0x54cb7eeea86dfdb3", 
                "to": "0x5496348300cc7db3"
            }
        }, 
        "code": "=", 
        "nonce": {
            "*": {
                "from": "0x8ed", 
                "to": "0x8ee"
            }
        }, 
        "storage": {}
    }
}
"trace": [
...

{
    "action": {
        "address": "0x31c2c092b367e53b0e989fa2960ae4e493ce5cd1", 
        "balance": "0x1", 
        "refundAddress": "0x6c6677787779626e676572657265726572657374"
    }, 
    "result": null, 
    "subtraces": 0, 
    "traceAddress": [
        47, 
        146, 
        0
    ], 
    "type": "suicide"
}

In this request there are 7716 suicide events and none of the refund addresses are added in the stateDiff

I've used this request to get the data

POST http://localhost:8545 HTTP/1.1
content-type: application/json

{
    "method": "trace_replayTransaction",
        "params":
    [
        "0x5816cb0c95789787803ba22bf73e5d1be8a1bc21ac8c91523ce128ac3bb7a157", 
        [
            "stateDiff",
            "trace"
        ]
    ], 
    "id": 1, 
    "jsonrpc": "2.0"
}
@debris
Copy link
Collaborator

debris commented Mar 20, 2018

that's an interesting finding. tbh I don't how is it possible, but it should be fairly easy to fix

@debris debris added F2-bug 🐞 The client fails to follow expected behavior. Q2-easy 💃 Can be fixed by copy and pasting from StackOverflow. Q1-mentor 🕺 An easy task were a mentor is available. Please indicate in the issue who the mentor could be. labels Mar 20, 2018
@cleanunicorn
Copy link
Author

cleanunicorn commented Mar 20, 2018

I've added a bit more info. There are 7716 refunds and none of the destination accounts are added in the stateDiff
All of the refunds are for 1 wei

@izgzhen
Copy link

izgzhen commented Mar 22, 2018

@debris let me try to investigate into this :)

@debris
Copy link
Collaborator

debris commented Mar 22, 2018

sure @izgzhen ! Ask me anything if you need any help :)

@5chdn 5chdn added this to the 1.11 milestone Mar 23, 2018
@izgzhen
Copy link

izgzhen commented Mar 27, 2018

From what I found, https://github.com/paritytech/parity/blob/04931618ed840decdaa7e90c20d2855c74355763/ethcore/transaction/src/transaction.rs#L40-L47 might be related.

There is no Suicide action in this enum Action.

@debris
Copy link
Collaborator

debris commented Mar 28, 2018

@izgzhen it's not related. If transaction rlp has destination, it's a call to a contract. If it does not, it's creating a new one. There is no other option :)

@izgzhen
Copy link

izgzhen commented Mar 28, 2018

https://github.com/paritytech/parity/blob/04931618ed840decdaa7e90c20d2855c74355763/ethcore/src/externalities.rs#L357-L381

Maybe we should insert the refund_address into the self.substate.touched?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior. Q1-mentor 🕺 An easy task were a mentor is available. Please indicate in the issue who the mentor could be. Q2-easy 💃 Can be fixed by copy and pasting from StackOverflow.
Projects
None yet
Development

No branches or pull requests

4 participants