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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

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? 🙂

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