Skip to content
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

Removed Res::FailedCallOrCreate and added missing fields to TransactionTrace #261

Merged
merged 3 commits into from
Sep 23, 2019
Merged

Removed Res::FailedCallOrCreate and added missing fields to TransactionTrace #261

merged 3 commits into from
Sep 23, 2019

Conversation

r3v2d0g
Copy link
Contributor

@r3v2d0g r3v2d0g commented Sep 21, 2019

Hey 👋!

Parity encodes traces results in one of two fields:

Currently, Res would only be able to decode a CallResult, CreateResult or None because it would only look into the "result" field. Thus, FailedCallOrCreate is unnecessary but Trace and TransactionTrace need an error field (TransactionTrace didn't have one).


I also added an action_type field to TransactionTrace.

…on Trace

Parity encodes traces results in one of two fields:
- "result" which can either store a `CallResult`, `CreateResult` or be equal to `null` (`Res::None`)
- "error" which stores a `TraceError` (https://github.com/paritytech/parity-ethereum/blob/master/ethcore/trace/src/types/error.rs#L25) and which Parity considers as either a `FailedCall` or `FailedCreate`

Currently, `Res` would only be able to decode a `CallResult`, `CreateResult` or `None` because it would only look into the "result" field. Thus, `FailedCallOrCreate` is unnecessary but `Trace` and `TransactionTrace` need an `error` field (`TransactionTrace` didn't have one).

Signed-off-by: Matthieu Le brazidec <matthieu@lebrazidec.email>
@r3v2d0g
Copy link
Contributor Author

r3v2d0g commented Sep 21, 2019

Maybe making our Res have the same variants as Parity's (https://github.com/paritytech/parity-ethereum/blob/master/rpc/src/v1/types/trace.rs#L434) could be done but it would probably need us to implement Deserialize for both Trace and TraceFiltering (except if there's a way to get the current JSON field's key when deserializing Res) and this would add code complexity.

We also could update the error fields from a String to a TraceError (https://github.com/paritytech/parity-ethereum/blob/master/ethcore/trace/src/types/error.rs#L25).

Signed-off-by: Matthieu Le brazidec <matthieu@lebrazidec.email>
@r3v2d0g r3v2d0g changed the title Removed Res::FailedCallOrCreate and added an error field to TransactionTrace Removed Res::FailedCallOrCreate and added missing fields to TransactionTrace Sep 21, 2019
@tomusdrw tomusdrw merged commit 96663e3 into tomusdrw:master Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants