1Hive / apiary

Aragon DAO explorer
https://apiary.1hive.org
GNU General Public License v3.0
25 stars 16 forks source link

Create abstraction for activity correlation IDs #157

Closed onbjerg closed 4 years ago

onbjerg commented 4 years ago

We want to display some activities as a group in the activity feed. An example of this would be votes:

For this to work, we will have to correlate multiple transactions and traces to the same activity semantically. This is hard, because correlating different transactions is ultimately only possible if you know how an application works, as a possible correlation ID is application specific.

As an example, correlating multiple transactions in the voting case would be done by vote ID, which is either present in events, return values or parameters to function calls.

Proposal

We have an entity ID (like a vote ID). We can assume that this entity ID is unique for each app instance, so we can also assume that a globally unique correlation ID would be hash(appAddress + entityId).

Entity IDs can be extracted from 3 places: return values of calls (such as newVote, which returns a voteId), events (such as StartVote) or function parameters (such as castVote(voteId)).

A possible abstraction would therefore be that we decode logs, function calls and function return values for specific apps that we want to provide correlation on.

Then, we specify where to find the entity ID (e.g. in the first topic of an event log topic[0] = topicOfStartVoteEvent, or the 1st parameter of castVote).

We then store the correlation ID (the hash described above) in the activities document alongside all of the other information we have.

onbjerg commented 4 years ago

No longer in scope.