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

How to ensure a piece of state is only used by a CCR once #190

Open
Lilyjjo opened this issue Feb 9, 2024 · 4 comments
Open

How to ensure a piece of state is only used by a CCR once #190

Lilyjjo opened this issue Feb 9, 2024 · 4 comments
Labels
question Further information is requested

Comments

@Lilyjjo
Copy link

Lilyjjo commented Feb 9, 2024

I am confused on how to ensure that confidential compute requests (CCRs) only use a piece of state once.

Rationale

It would be useful for suave developers to know if a piece of state has been consumed by a CCR already.

Take the use case of trying to create and send transactions to an L1 using a singular private key. The suapp stores the private key in the confidential store so this operation must be ran in a CCR. Each transaction needs a unique and continuously increasing nonce to sign over. The question is: where can we store this nonce so CCRs can be triggered permissionlessly?

Option 1: Put the nonce on-chain and increment it during CCR callbacks.
Issue: What happens if multiple CCRs are sent per on-chain block? In this case, the on-chain nonce would be used multilpe times and CCRs would fail to have their logic execute as intended.

Option 2: Put the nonce in the confidential store.
Issue: What happens if two kettles get a CCR at the same time? How do the CCRs coordinate around the race condition of consuming and updating the confidential store?

Option 3: Have the user pass it in.
Issue: Similar race condition to (1)/(2) and additional greifing attack vector of users intentionally submitting wrong nonces.

Option 4: Put the nonce in the confidential store and restrict the Suapp to a single kettle to avoid the race conditions.
Issue: this is not decentralized enough for some applications.

Ask

Is there another solution that I'm not considering?

I'm working on an application and would like to have data stored somewhere that can be safely and permissonlessly acted on by multiple kettles inside of CCRs.

@lthibault lthibault added the question Further information is requested label Feb 9, 2024
@amiller
Copy link

amiller commented Feb 9, 2024

I don't see how this would be possible without coordination between the Kettles to implement a distributed counter. Maybe something like ROTE can be suitable and lower latency than Suave chain consensus https://eprint.iacr.org/2017/048.pdf

@Lilyjjo
Copy link
Author

Lilyjjo commented Feb 9, 2024

Ok this makes sense. I incorrectly keep on trying to program the CCR's off-chain/MEVM half of Suave like it is the on-chain/EVM half. In case it is helpful for future people: it was discussed in tg that Suave does not provide for synchronization or consistency in the off-chain execution environment.

@dmarzzz
Copy link
Member

dmarzzz commented Feb 13, 2024

How I explained this issue internally
Screenshot 2024-02-13 at 12 20 47 PM

@pistomat
Copy link
Contributor

Ok this makes sense. I incorrectly keep on trying to program the CCR's off-chain/MEVM half of Suave like it is the on-chain/EVM half. In case it is helpful for future people: it was discussed in tg that Suave does not provide for synchronization or consistency in the off-chain execution environment.

@Lilyjjo Is that tg public? Can you provide link?

Thanks a lot for this PSA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants