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

Track in events the blockchain log index when created from a specific log withing a transaction #7887

Conversation

gianluca-pub-dev
Copy link
Contributor

Design idea: track the blockhain log index when possible, so to map the event 1 to 1 with the blockchain, and so to improve review and test cases

Closes #(issue_number)

Checklist

  • The PR modified the frontend, and updated the user guide to reflect the changes.

@gianluca-pub-dev
Copy link
Contributor Author

gianluca-pub-dev commented May 5, 2024

@LefterisJP , this low priority draft PR is for discussing a possible idea for having events more deterministic

…he event 1 to 1 with the blockchain, and so to improve review and test cases
@gianluca-pub-dev gianluca-pub-dev force-pushed the feat/add_tx_log_index_as_event_attribute_for_tracking_with_blockhain_logs-when_possible branch from f86cc36 to b940216 Compare May 5, 2024 14:02
@@ -443,6 +443,7 @@ def _decode_transaction(
result = DEFAULT_DECODING_OUTPUT

if result.event:
result.event.tx_log_index = tx_log.log_index
Copy link
Member

Choose a reason for hiding this comment

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

@LefterisJP , this low priority draft PR is for discussing a possible idea for having events more deterministic

Hey thanks for the PR but we do not need this. Determinism in the sequence index is not needed as we don't want to map our events to the log event index order. A lot of contracts show events in order that makes no sense. So our decoders tend to change them to match an order that makes sense.

What's more rotki's events are not only 1-1 to ethereum events. All events, bitcoin transactions, CEX transactions etc, are mapped to rotki events. They are supposed to be the lowest common denominator.

Sequence index is the attribute that started being the log index of the evm event when an evm event was the source of the event. But we wanted to change the sequence index some times to make sense as mentioned above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your review @LefterisJP .

Please notice that I am not proposing to drop the sequence_index attribute or changing its logic. I am just proposing to store additionally the original log event index as attribute, so the detection would be less error-prone (for complex transactions) asserting the tx_log_index in the unit tests. And also that information could be used for reviewing the event on the blockchain. I have seen that rotki is creating also new events as with make_next_event, and this the reason I left "None" as possible value for tx_log_index. In that case the user/review/developer can know that is a "virtual" event.

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.

None yet

2 participants