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

trace_filter does not return failed contract creation #9822

Closed
medvedev1088 opened this issue Oct 29, 2018 · 21 comments
Closed

trace_filter does not return failed contract creation #9822

medvedev1088 opened this issue Oct 29, 2018 · 21 comments
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M4-core ⛓ Core client code / Rust.
Milestone

Comments

@medvedev1088
Copy link

  • Parity Ethereum version: Parity-Ethereum/v2.0.8-stable-ef8f95e-20181015/x86_64-linux-gnu/rustc1.29.0
  • Operating system: Linux
  • Installation: Docker
  • Fully synchronized: yes
  • Network: ethereum
  • Restarted: yes

debug_trace API for block 2,878,467 is missing the trace for transaction https://etherscan.io/tx/0xb8965886e04cdbf18132a722f5a556a378b9dbcab5d1fc4050e54eadc12fafbd. Is it an expected behaviour? If yes, what's the rationale for skipping such traces?

Below is the JSON API request and response for the block.

> curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"trace_filter","params":[{"fromBlock": "0x2BEC03", "toBlock": "0x2BEC03"}],"id":1}'

{
    "jsonrpc": "2.0",
    "result": [
        {
            "action": {
                "callType": "call",
                "from": "0xcaa216e03ee4932941ef0729f250e297fd5655ad",
                "gas": "0xb9d8",
                "input": "0xe637a44b000000000000000000000000000000000000000000000000000529f0a21a905f00000000000000000000000000000000000000000000000000050498d760af01",
                "to": "0xfdc77b9cb732eb8c896b152e28294521f5f62e67",
                "value": "0x0"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x5f74",
                "output": "0x"
            },
            "subtraces": 1,
            "traceAddress": [],
            "transactionHash": "0x03c0d74b32caac835805eb8eb4b174685fd72379c981369672dfee925aa720d9",
            "transactionPosition": 0,
            "type": "call"
        },
        {
            "action": {
                "callType": "callcode",
                "from": "0xfdc77b9cb732eb8c896b152e28294521f5f62e67",
                "gas": "0xae05",
                "input": "0x5035db4a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000caa216e03ee4932941ef0729f250e297fd5655ad",
                "to": "0xfdc77b9cb732eb8c896b152e28294521f5f62e67",
                "value": "0x0"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x255",
                "output": "0x0000000000000000000000000000000000000000000000000000000000000000"
            },
            "subtraces": 0,
            "traceAddress": [
                0
            ],
            "transactionHash": "0x03c0d74b32caac835805eb8eb4b174685fd72379c981369672dfee925aa720d9",
            "transactionPosition": 0,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x91337a300e0361bddb2e377dd4e88ccb7796663d",
                "gas": "0x10d88",
                "input": "0x",
                "to": "0x8f6e97be83af27a8ceb0b795ec6c86962c2135f6",
                "value": "0x164a5305742c38000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x5151ddfa2cc70ddcdfb84c44dd61ed1a49c185f68e0f7ad2c15bfc4b32aff755",
            "transactionPosition": 1,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0xc68c06c5ee03b0d5b3b6e830b9c471571eeb8923",
                "gas": "0x10d38",
                "input": "0x0000000000000000000000000000000000000000",
                "to": "0xf90c9ac616ecfefb3860aaa5bc33caf9bc606441",
                "value": "0x380afb26cf85000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x58e048c45856325f5ae171458b1f7a80db4b80e626407d265078c9a8960e88e3",
            "transactionPosition": 2,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x11af339e6b44a1e36ebdfaa08cce5a4f16df5b0f",
                "gas": "0x10d88",
                "input": "0x",
                "to": "0xdfad8c8a6172d33b95038ec5bb067239b71f70d0",
                "value": "0x1bc09ddb5ad7f100"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x84c232c5111aaee45a0eb374d224e102bc05149dde75f29e32b428ce96c5ddbf",
            "transactionPosition": 3,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x4bb96091ee9d802ed039c4d1a5f6216f90f81b01",
                "gas": "0x4650",
                "input": "0x",
                "to": "0x82d6ab6c1d6532640d1a2cef44a7c43a66bf748c",
                "value": "0x44b1eec6162f0000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x895a19c1058b20f07756aab6c9660ab669588ae19bd8c5843d201369b067b1ab",
            "transactionPosition": 4,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x6000a0d1503631443e7833de6ed46f91d7787219",
                "gas": "0x10d88",
                "input": "0x",
                "to": "0xaf139302bc27c1ca18320d3fce01b90a74dc879b",
                "value": "0x4563918244f40000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0xecdb5c9f49351eee67347bef9d451fa7f793d575dc7bb769665acb01c5962f34",
            "transactionPosition": 6,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x1e9939daaad6924ad004c2560e90804164900341",
                "gas": "0x4650",
                "input": "0x",
                "to": "0xa1af766e540b28dc551fd02d372549d55b087251",
                "value": "0x45cd921d348be3d0"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x799",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0xf52aa5d07bafcb704ba0804d2989f317c5698a0cd70064baf65ed440d06d6006",
            "transactionPosition": 7,
            "type": "call"
        },
        {
            "action": {
                "author": "0x1a060b0604883a99809eb3f798df71bef6c358f1",
                "rewardType": "block",
                "value": "0x4563918244f40000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": null,
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": null,
            "transactionPosition": null,
            "type": "reward"
        }
    ],
    "id": 83
}
@jam10o-new jam10o-new added F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi 📣 RPC API. labels Oct 29, 2018
@jam10o-new
Copy link
Contributor

Is the trace also missing in trace_block for that block?

I'm sure that the trace exists (etherscan has it, for example https://etherscan.io/vmtrace?txhash=0xb8965886e04cdbf18132a722f5a556a378b9dbcab5d1fc4050e54eadc12fafbd&type=parity#raw), this might be an issue regarding how trace_filter works as opposed to trace_block.

@jam10o-new jam10o-new added M4-core ⛓ Core client code / Rust. and removed M6-rpcapi 📣 RPC API. labels Oct 29, 2018
@medvedev1088
Copy link
Author

Indeed, in trace_block this trace exists:

> curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"trace_block","params":["0x2BEC03"],"id":1}'
{
    "jsonrpc": "2.0",
    "result": [
        {
            "action": {
                "callType": "call",
                "from": "0xcaa216e03ee4932941ef0729f250e297fd5655ad",
                "gas": "0xb9d8",
                "input": "0xe637a44b000000000000000000000000000000000000000000000000000529f0a21a905f00000000000000000000000000000000000000000000000000050498d760af01",
                "to": "0xfdc77b9cb732eb8c896b152e28294521f5f62e67",
                "value": "0x0"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x5f74",
                "output": "0x"
            },
            "subtraces": 1,
            "traceAddress": [],
            "transactionHash": "0x03c0d74b32caac835805eb8eb4b174685fd72379c981369672dfee925aa720d9",
            "transactionPosition": 0,
            "type": "call"
        },
        {
            "action": {
                "callType": "callcode",
                "from": "0xfdc77b9cb732eb8c896b152e28294521f5f62e67",
                "gas": "0xae05",
                "input": "0x5035db4a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000caa216e03ee4932941ef0729f250e297fd5655ad",
                "to": "0xfdc77b9cb732eb8c896b152e28294521f5f62e67",
                "value": "0x0"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x255",
                "output": "0x0000000000000000000000000000000000000000000000000000000000000000"
            },
            "subtraces": 0,
            "traceAddress": [
                0
            ],
            "transactionHash": "0x03c0d74b32caac835805eb8eb4b174685fd72379c981369672dfee925aa720d9",
            "transactionPosition": 0,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x91337a300e0361bddb2e377dd4e88ccb7796663d",
                "gas": "0x10d88",
                "input": "0x",
                "to": "0x8f6e97be83af27a8ceb0b795ec6c86962c2135f6",
                "value": "0x164a5305742c38000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x5151ddfa2cc70ddcdfb84c44dd61ed1a49c185f68e0f7ad2c15bfc4b32aff755",
            "transactionPosition": 1,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0xc68c06c5ee03b0d5b3b6e830b9c471571eeb8923",
                "gas": "0x10d38",
                "input": "0x0000000000000000000000000000000000000000",
                "to": "0xf90c9ac616ecfefb3860aaa5bc33caf9bc606441",
                "value": "0x380afb26cf85000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x58e048c45856325f5ae171458b1f7a80db4b80e626407d265078c9a8960e88e3",
            "transactionPosition": 2,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x11af339e6b44a1e36ebdfaa08cce5a4f16df5b0f",
                "gas": "0x10d88",
                "input": "0x",
                "to": "0xdfad8c8a6172d33b95038ec5bb067239b71f70d0",
                "value": "0x1bc09ddb5ad7f100"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x84c232c5111aaee45a0eb374d224e102bc05149dde75f29e32b428ce96c5ddbf",
            "transactionPosition": 3,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x4bb96091ee9d802ed039c4d1a5f6216f90f81b01",
                "gas": "0x4650",
                "input": "0x",
                "to": "0x82d6ab6c1d6532640d1a2cef44a7c43a66bf748c",
                "value": "0x44b1eec6162f0000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x895a19c1058b20f07756aab6c9660ab669588ae19bd8c5843d201369b067b1ab",
            "transactionPosition": 4,
            "type": "call"
        },
        {
            "action": {
                "from": "0x2a125b9db31e1257a887b674ab586c96c11e4cb7",
                "gas": "0x8af8",
                "init": "0xe20151d500000000000000000000000000000000000000000000000000000000000004570000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043232323200000000000000000000000000000000000000000000000000000000",
                "value": "0x0"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "error": "Bad instruction",
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0xb8965886e04cdbf18132a722f5a556a378b9dbcab5d1fc4050e54eadc12fafbd",
            "transactionPosition": 5,
            "type": "create"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x6000a0d1503631443e7833de6ed46f91d7787219",
                "gas": "0x10d88",
                "input": "0x",
                "to": "0xaf139302bc27c1ca18320d3fce01b90a74dc879b",
                "value": "0x4563918244f40000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0xecdb5c9f49351eee67347bef9d451fa7f793d575dc7bb769665acb01c5962f34",
            "transactionPosition": 6,
            "type": "call"
        },
        {
            "action": {
                "callType": "call",
                "from": "0x1e9939daaad6924ad004c2560e90804164900341",
                "gas": "0x4650",
                "input": "0x",
                "to": "0xa1af766e540b28dc551fd02d372549d55b087251",
                "value": "0x45cd921d348be3d0"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": {
                "gasUsed": "0x799",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0xf52aa5d07bafcb704ba0804d2989f317c5698a0cd70064baf65ed440d06d6006",
            "transactionPosition": 7,
            "type": "call"
        },
        {
            "action": {
                "author": "0x1a060b0604883a99809eb3f798df71bef6c358f1",
                "rewardType": "block",
                "value": "0x4563918244f40000"
            },
            "blockHash": "0x667bcaac622ef255cd664fd6afc69fb86bea698de72770ea86bd71fed691a761",
            "blockNumber": 2878467,
            "result": null,
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": null,
            "transactionPosition": null,
            "type": "reward"
        }
    ],
    "id": 83
}

@jam10o-new jam10o-new changed the title Missing traces for failed contract creations trace_filter does not return failed contract creation Oct 29, 2018
@jam10o-new jam10o-new added this to Needs Assignment in Core via automation Oct 31, 2018
@jam10o-new jam10o-new added this to the 2.3 milestone Oct 31, 2018
@tomusdrw
Copy link
Collaborator

Seems the issue is here: https://github.com/paritytech/parity-ethereum/blob/9982eba1889cfc20e7a614da5e809b1dd4d8a729/ethcore/src/trace/types/filter.rs#L109

For some reason we return false in matches for such contracts. I'd say it should be equal to to_adress.matches_all()

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 60.0 DAI (60.0 USD @ $1.0/DAI) attached to it as part of the Ethereum Foundation fund.

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Workers have applied to start work.

These users each claimed they can complete the work by 3 weeks, 2 days from now.
Please review their action plans below:

1) aashutoshrathi has applied to start work (Funders only: approve worker | reject worker).

Check for the function where failed contract creation is handled, probably problem is with this as mentioned in the comment above.

Learn more on the Gitcoin Issue Details page.

@gitcoinbot
Copy link

@aashutoshrathi Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@spm32
Copy link

spm32 commented Nov 28, 2018

Hey @aashutoshrathi you're good to go on this, let us know if you have any questions!

@xiaods
Copy link

xiaods commented Dec 18, 2018

Is this bounty still open ? I'd love to help with it. @ceresstation

@Tbaut
Copy link
Contributor

Tbaut commented Dec 19, 2018

@xiaods yes it's open, feel free to take it ;)

@gitcoinbot
Copy link

gitcoinbot commented Dec 21, 2018

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 2 months, 3 weeks ago.
Please review their action plans below:

1) xiaods has been approved to start work.

i currently maintain parity node and familiar with the parity apis. i can have a try to resolve it. thanks a lot.

Learn more on the Gitcoin Issue Details page.

xiaods added a commit to xiaods/parity-ethereum that referenced this issue Dec 22, 2018
trace_filter does not return failed contract creation openethereum#9822

reference @tomusdrw's comments on this issue:
openethereum#9822 (comment)

i have a try to fix it.
xiaods added a commit to xiaods/parity-ethereum that referenced this issue Dec 26, 2018
trace_filter does not return failed contract creation openethereum#9822

reference @tomusdrw's comments on this issue:
openethereum#9822 (comment)

i have a try to fix it.
@xiaods
Copy link

xiaods commented Dec 31, 2018

@Tbaut cloud you approve my work request?

xiaods added a commit to xiaods/parity-ethereum that referenced this issue Jan 1, 2019
trace_filter does not return failed contract creation openethereum#9822

reference @tomusdrw's comments on this issue:
openethereum#9822 (comment)

fix it.
@xiaods
Copy link

xiaods commented Jan 1, 2019

@medvedev1088 cloud you approve my work request?

xiaods added a commit to xiaods/parity-ethereum that referenced this issue Jan 2, 2019
…reation

currently trace_filter can't return failed contract creation transaction
but trace_block can query the failed contract creation transaction.it
because the logic of parity-ethereum/ethcore/src/trace/types/filter.rs
Line 109 in 9982eba
```
 _ => false
```

this patch correct the logic:
```
 _ => self.to_address.matches_all()
```

Signed-off-by: Deshi Xiao <xiaods@gmail.com>
@Tbaut
Copy link
Contributor

Tbaut commented Jan 2, 2019

I think @ceresstation can approve it.

@xiaods
Copy link

xiaods commented Jan 3, 2019

@ceresstation hi, cloud you please approve it?

@spm32
Copy link

spm32 commented Jan 4, 2019

@xiaods Sorry for the delay, just approved you :)

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 60.0 DAI (60.0 USD @ $1.0/DAI) has been submitted by:

  1. @xiaods

@ceresstation please take a look at the submitted work:


@xiaods
Copy link

xiaods commented Jan 9, 2019

@ceresstation when review done, it will merge asap.

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

xiaods commented Jan 10, 2019

Superseded by #10140, it already mark as good. it will merge asap.

@xiaods
Copy link

xiaods commented Jan 10, 2019

@medvedev1088 you can check it.

Core automation moved this from Needs Assignment to Done Jan 11, 2019
@xiaods
Copy link

xiaods commented Jan 11, 2019

@ceresstation cloud you please check gitcoin task status? it already done.

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 60.0 DAI (60.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @xiaods.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

No branches or pull requests

8 participants