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

Update Shutter spec #50

Merged
merged 13 commits into from
Aug 28, 2024
Merged

Conversation

jannikluhn
Copy link
Contributor

The current version of the spec is outdated relative to what's live on the network right now. This PR aligns the two versions. See the commit messages for descriptions of the individual changes.

This also clarifies that decryption key for slot s is generated in slot
`s - 1`.
To improve compatibility with other Shutter implementations, the gnosis
specific message fields are moved to an optional field `extra`.

Field indices are a bit random for historical reasons. We might clean
this up in the future.
To improve compatibility with other Shutter implementations, the gnosis
specific message fields are moved to an optional field `extra`.
The sender is taken from the `TransactionSubmitted` event, not the keys
message.
This was meant to simplify recovery if many keypers go down at the same
time. However, it is very inefficient. In the current implementation,
this mechanism is not used in favor of a different recovery mechanism.
This mechanism will be added to the spec in the future.
This may help the validator fetching specific events without syncing the
chain history.
Previously, the validator was expected to choose encrypted transactions
by their identity preimage. This is problematic for two reasons:

- the identity preimage is not necessarily unique
- the validator has to sync the full chain history in order to be able
  to do this

Now, the validator is supposed to fetch the events in a tx index range,
given by the keys' message tx pointer and the number of keys in that
message.
The dummy key ensures keypers generate at least one key per slot with
registered validator, even if there are no transactions scheduled. This
does not interfer with anything, but it allows monitoring key generation
works even if no one uses the system.
The tx pointer records the current state of transaction execution or in
other words the next transaction the system is supposed to execute.
Ideally, this value would be tracked by the chain itself, but this would
require a chain fork. Instead, we have to rely on consensus among the
keypers.

In practice, under normal conditions, the keypers use the txPointer in
`DecryptionKeys` messages as canonical (note that in order to be valid,
these messages need to be signed off by at least a threshold of the
keypers). However, if no such message is received for a long time, key
generation must be failing. This might be due to keypers not agreeing on
the txPointer. In order to recover from this failure, the keypers reset
the txPointer to the number of encrypted transactions in the queue,
i.e., they jump to the end (because this is the easiest value to agree
on without communication).

Keypers should do this when key generation has been failing for some
time. What "some time" means is left to the keypers to decide. It is a
tradeoff between quick recovery and poor UX due to skipped transactions.

Note that this automatically contains a retry mechanism: If key
production is failing, no decryption keys messages will be received, so
they also will not update the tx pointer.
Previously, the keyper set contract had to broadcast the eon key. Now,
the keyper set contract defines a predicate that says if an account is
allowed to broadcast or not. This allows them to outsource key
broadcasting to a dedicated contract.
shutter/low-level.md Show resolved Hide resolved
shutter/low-level.md Show resolved Hide resolved
@dapplion dapplion merged commit 183f0d5 into gnosischain:master Aug 28, 2024
1 check passed
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.

2 participants