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

Misleading storage from trace_replayTransactions upon executing suicide on contract #8937

Open
ankitchiplunkar opened this Issue Jun 20, 2018 · 5 comments

Comments

4 participants
@ankitchiplunkar
Copy link

ankitchiplunkar commented Jun 20, 2018

Before filing a new issue, please provide the following information.

I'm running:

  • Which Parity version?: Parity/v1.10.4-stable
  • Which operating system?: Linux
  • How installed?: via installer
  • Are you fully synchronized?: no
  • Which network are you connected to?: ethereum
  • Did you try to restart the node?: yes

Issue:

Misleading storage from trace_replayTransactions upon executing suicide on contract.

Expected

Suppose a contract has 2 positions [pos1, pos2] in its storage with values [value1, value2] respectively. After contract suicide the storage of the contract should be wiped out. Thus a sample response of method trace_replayTransactions in mode stateDiff should be:

"storage":{
"pos1":{"-":"value1"},
"pos2":{"-":"value2"}
}

Response

But, the response from trace_replayTransactions in mode stateDiff shows no modification.

"storage":{}

Details

Let us take an example on the mainnet.

Transaction_hash 0x12945faff5df252934cfbc25353dbecf2175b5017a3990bb764b44b7cc763547 creates a contract 0x506f4b138e30f4ed0b9511d4d676eaaeca466983. The following is the contract relevant response to the method trace_replayTransaction for above transaction.

"0x506f4b138e30f4ed0b9511d4d676eaaeca466983":{
"balance":{"+":"0x0"},
"code":{"+":"0x60606040526000357c01000000000000000000000000000000000000000000000000000000009004806341c0e1b514610044578063cfae32171461005157610042565b005b61004f6004506100ca565b005b61005c60045061015e565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561015b57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b60206040519081016040528060008152602001506001600050805480601f016020809104026020016040519081016040528092919081815260200182805480156101cd57820191906000526020600020905b8154815290600101906020018083116101b057829003601f168201915b505050505090506101d9565b9056"},
"nonce":{"+":"0x0"},
"storage":{
"0x0000000000000000000000000000000000000000000000000000000000000000":{
"+":"0x0000000000000000000000002d11763b4999fb3b61ca8d19c8c77a743079f7bd"},
"0x0000000000000000000000000000000000000000000000000000000000000001":{
"+":"0x000000000000000000000000000000000000000000000000000000000000000c"},
"0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6":{
"+":"0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"}
}
}

3 positions in the contract storage have some value associated to them. The next transaction 0xc4af9cd2bba88af9f0f8e8fdbda2537751ef55b7ecacab5b8f2dade34d69f691 suicides the contract. Again, the following is the contract relevant response to the method trace_replayTransaction for above transaction.

"0x506f4b138e30f4ed0b9511d4d676eaaeca466983":{
"balance":{"-":"0x0"},
"code":{"-":"0x60606040526000357c01000000000000000000000000000000000000000000000000000000009004806341c0e1b514610044578063cfae32171461005157610042565b005b61004f6004506100ca565b005b61005c60045061015e565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561015b57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b60206040519081016040528060008152602001506001600050805480601f016020809104026020016040519081016040528092919081815260200182805480156101cd57820191906000526020600020905b8154815290600101906020018083116101b057829003601f168201915b505050505090506101d9565b9056"},
"nonce":{"-":"0x0"},
"storage":{}
}

Notice, the values in balance, code and nonce have been removed, but the 3 positions that had been initialized have not been removed after the suicide call.

Note: There are no values in the contract storage, when verified after exporting the state. Thus the storage values are being deleted.

@Tbaut

This comment has been minimized.

Copy link
Collaborator

Tbaut commented Jun 21, 2018

Can you please try with 1.11 as #8297 should solve your problem. I couldn't try as I do not have any archive + tracing node handy.

@Tbaut Tbaut added this to the 1.12 milestone Jun 21, 2018

@ankitchiplunkar

This comment has been minimized.

Copy link

ankitchiplunkar commented Jun 21, 2018

Updated to 1.11.4 using bash <(curl https://get.parity.io -L)

Still get the same misleading result.

Command

$ curl --data '{
"method":"trace_replayTransaction",
"params":["0xc4af9cd2bba88af9f0f8e8fdbda2537751ef55b7ecacab5b8f2dade34d69f691",["stateDiff"]],
"id":1, "jsonrpc":"2.0"
}' 
-H "Content-Type: application/json" -X POST localhost:8545

Relevant result

"0x506f4b138e30f4ed0b9511d4d676eaaeca466983":
{
"balance":{"-":"0x0"},
"code":{"-":"0x60606040526000357c01000000000000000000000000000000000000000000000000000000009004806341c0e1b514610044578063cfae32171461005157610042565b005b61004f6004506100ca565b005b61005c60045061015e565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561015b57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b60206040519081016040528060008152602001506001600050805480601f016020809104026020016040519081016040528092919081815260200182805480156101cd57820191906000526020600020905b8154815290600101906020018083116101b057829003601f168201915b505050505090506101d9565b9056"},
"nonce":{"-":"0x0"},
"storage":{}
}

#8297 deals with adding account information to stateDiff after contract refund, this issue deals with removing the contract storage to stateDiff after contract suicide.

@Tbaut

This comment has been minimized.

Copy link
Collaborator

Tbaut commented Jun 21, 2018

I could access an archive node and can confirm.

@Tbaut Tbaut added this to Needs Assignment in Core via automation Jun 21, 2018

@Tbaut Tbaut moved this from Needs Assignment to Straightforward Picks in Core Jun 21, 2018

@5chdn 5chdn modified the milestones: 2.0, 2.1 Jul 17, 2018

@5chdn 5chdn modified the milestones: 2.1, 2.2 Sep 11, 2018

@5chdn 5chdn modified the milestones: 2.2, 2.3 Oct 29, 2018

@ankitchiplunkar

This comment has been minimized.

Copy link

ankitchiplunkar commented Nov 30, 2018

Any updates on this?

@jpzk

This comment has been minimized.

Copy link

jpzk commented Dec 13, 2018

I think this is a bit more than just an annoyance, it's an interface inconsistency, and given the fact that the returned schema is used as a de-facto standard for traces even more important.

That said, would be great to see this ticket included earlier! Thanks.

@5chdn 5chdn modified the milestones: 2.3, 2.4 Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment