Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Enhancement: Include raw event data in txlog #5324

Merged
merged 3 commits into from
Jul 20, 2022
Merged

Enhancement: Include raw event data in txlog #5324

merged 3 commits into from
Jul 20, 2022

Conversation

haltman-at
Copy link
Contributor

@haltman-at haltman-at commented Jul 19, 2022

This one is pretty straightforward. It adds a raw field to event actions in the txlog, so there will be info even if decoding failed. The raw field has four subfields: address, codeAddress, topics, and data. The topics and data fields are what you expect. The address is the address that officially omitted the event, and codeAddress is the address of the code that emitted the event. These can be different if the event was emitted from a delegatecall (e.g. a library), as officially it's the caller of the library that emits the event, but I thought it was good to include the codeAddress as well to tell you what contract's code emitted the event.

Note that if an event is emitted from a constructor, both address and codeAddress will be equal to the address that the contract was being created at (barring some cases where we can't determine it, in which case they'll show as zero instead, sorry -- although this will only ever happen for reverted events).

I also expanded the existing tests to test this new functionality.

(Actually, wait, thought, now that I've done this -- should address and codeAddress be dropped? They're derivable from the rest of the txlog, which seems to go against how txlog works in general; it generally doesn't include derivable info like that. Like if you think about the original purpose of txlog as a visualization tool, this address info wouldn't be used, because it would already be implicit from the diagram. Should I remove those?)

@haltman-at haltman-at requested review from gnidan, benjamincburns and cds-amal and removed request for benjamincburns July 19, 2022 00:09
@haltman-at haltman-at changed the title Ehancement: Include raw event data in txlog Enhancement: Include raw event data in txlog Jul 19, 2022
@gnidan
Copy link
Contributor

gnidan commented Jul 19, 2022

@haltman-at I concur... we should remove the redundancy and replace it with an easy-to-use selector

@haltman-at
Copy link
Contributor Author

Cool. Should the flattedEvents selector be in this PR, or be a separate one?

@gnidan
Copy link
Contributor

gnidan commented Jul 19, 2022

Cool. Should the flattedEvents selector be in this PR, or be a separate one?

You know how I feel that everything that can be separate, should be separate ;)

@haltman-at
Copy link
Contributor Author

Cool, that's what I had intended anyway. :)

Copy link
Contributor

@gnidan gnidan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Nice and easy :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants