-
Notifications
You must be signed in to change notification settings - Fork 2
Add endpoints for event based decryption triggers #79
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
base: main
Are you sure you want to change the base?
Conversation
Note: it changed from 'use 3rd party tooling' but does not mention, that the provided compiler implementation is opinionated, and 3rd party tooling could provide more flexible event triggers. Namely triggers that allow for some parameters to be omitted, e.g. topic0
… get_data_for_encryption endpoint
internal/usecase/eventtrigger.go
Outdated
| type EventArgument struct { | ||
| Name string `json:"name" example:"amount"` | ||
| Operator string `json:"op" example:"gte"` | ||
| Number int `json:"number" example:"25433"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a *big.Int (and probably encoded as a decimal string), not an int because of potential overflows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opted to make it a string that is interpreted and consumed as a *big.Int further down the stack, when compiling. Since this unmarshaling only, I believe this should not lead to problems. But please let me know, if you think otherwise.
Whitelisting only certain contracts for event based decryption triggers does not help with reducing or limiting load on keypers. Instead, if there is need for it, we would need to limit the total number of active event based triggers.
The parameter is not necessary for event based identities, because it can be derived from signing key.
The specialized func was used in only one place and could produce semantically incorrect results. I inlined the switch statement and added an explicit error case on default.
In order to avoid overflow for large integers, the 'number' argument is parsed from a decimal string.
This implements API endpoints for event based decryption triggers.
WIP/TODO:
TODOcommentsRegisterEventIdentityis untested so far/compile_event_trigger_definition,/register_event_trigger) to rate limitingFixes #74
See also https://github.com/shutter-network/shutter-api?tab=readme-ov-file#1b-register-an-identity-with-event-based-decryption-triggers-wip