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

Handle *_DELEGATE Transaction Service events #2106

Merged
merged 6 commits into from
Nov 19, 2024
Merged

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Nov 7, 2024

Summary

The Transaction Service now emits new *_DELEGATE events for creating, updating and deleting delegates:

  • NEW_DELEGATE
  • UPDATED_DELEGATE
  • DELETED_DELEGATE

This adds the relevant validation and handling of the aforementioned, clearing the delegates cache accordingly.

Changes

  • Add schemas, inferred entities and relevant builders
  • Add method to clear delegates, called by each event

@iamacook iamacook self-assigned this Nov 7, 2024
@iamacook
Copy link
Member Author

iamacook commented Nov 7, 2024

I'm marking this as a draft for now as there is no chain identifier for each event. I've discussed this with @falvaradorodriguez, and he will add them soon. A chainId property is preemptively added accordingly.

This has now been resolved.

@iamacook iamacook marked this pull request as ready for review November 7, 2024 16:49
@iamacook iamacook requested a review from a team as a code owner November 7, 2024 16:49
>,
): Array<Promise<void>> {
if (!event.safeAddress) {
return [];
Copy link
Member

Choose a reason for hiding this comment

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

Could you elaborate on the case the event is not directly related to a Safe address? I'm not super sure of the this, but does this happen if the delegate is linked to a delegator, but not to a specific Safe? Is it therefore is linked to all the Safes the delegator owns? Maybe we should include a comment explaining the case, wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not entirely sure why or how this can happening but the event can potentially have no address according to the Transaction Service.

Choose a reason for hiding this comment

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

Just to comment. Right now, it is possible to create a delegate for a delegator without a specific safe. In that case, the delegate user would be valid for all safes of the delegator user. If a specific safe is specified, it would only be valid for operations on that safe.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks guys! Then if I understood correctly, if the Safe address included in the event is null we would need to clear the cache for all the Safe addresses the delegator owns. Do you think this is correct? @iamacook @falvaradorodriguez? 🙂

Copy link
Member

Choose a reason for hiding this comment

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

I'm merging this one as it is, and I'm opening a new ticket so we can handle that case separately: #2146

@hectorgomezv hectorgomezv self-requested a review November 19, 2024 18:15
@hectorgomezv hectorgomezv merged commit 9f48dd1 into main Nov 19, 2024
20 checks passed
@hectorgomezv hectorgomezv deleted the delegate-events branch November 19, 2024 18:20
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.

3 participants