Skip to content

Conversation

@konradkonrad
Copy link
Contributor

@konradkonrad konradkonrad commented Dec 19, 2025

This implements API endpoints for event based decryption triggers.
WIP/TODO:

  • check TODO comments
  • codepath for RegisterEventIdentity is untested so far
  • consistency in json parameter naming: camel vs snake case
  • Add new endpoints (/compile_event_trigger_definition, /register_event_trigger) to rate limiting

Fixes #74

See also https://github.com/shutter-network/shutter-api?tab=readme-ov-file#1b-register-an-identity-with-event-based-decryption-triggers-wip

konradkonrad and others added 8 commits December 19, 2025 13:34
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
@blockchainluffy blockchainluffy marked this pull request as ready for review December 29, 2025 11:15
type EventArgument struct {
Name string `json:"name" example:"amount"`
Operator string `json:"op" example:"gte"`
Number int `json:"number" example:"25433"`

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

Copy link
Contributor Author

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.
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.

Update Shutter API to include ETDs

5 participants