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

enclaves: light client check #69

Merged
merged 29 commits into from
Jul 24, 2024

Conversation

hu55a1n1
Copy link
Member

@hu55a1n1 hu55a1n1 commented Jul 1, 2024

Closes: #22

@hu55a1n1 hu55a1n1 changed the title Mtcs enclave light client check enclaves: light client check Jul 2, 2024
@hu55a1n1 hu55a1n1 marked this pull request as ready for review July 16, 2024 11:37
Copy link
Contributor

@davekaj davekaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks pretty good to me..... but I think I need more context to go through it line by line.

Can you tell me in 3-4 sentances how the code changes and what it is supposed to do differently now?

Also, how can I test that it is working now?

@hu55a1n1
Copy link
Member Author

Can you tell me in 3-4 sentances how the code changes and what it is supposed to do differently now?

This PR basically adds checks to the apps' enclave code to make sure that the input indeed exists on the blockchain (smart contract). This gives us the guarantee that the enclave was run with the correct input and didn't tamper with or (selectively) censor it.

We do this by attaching a light client & merkle proof to the enclave request (i.e. the gRPC request sent to the enclave by the host in listen.sh) and verifying that proof in the enclave before processing the input request.

And I just realized that I haven't updated the scripts for that. 😅 (probably because there's no listen.sh for mtcs app but I should update the listen.sh script for the transfers app) I propose we get back to this after merging #82 and #96.

@hu55a1n1 hu55a1n1 marked this pull request as draft July 18, 2024 11:31
@davekaj
Copy link
Contributor

davekaj commented Jul 18, 2024

Okay lets wait for those 2 to be merged!

@hu55a1n1 hu55a1n1 marked this pull request as ready for review July 23, 2024 16:42
@@ -39,19 +39,60 @@ REPORT_SIG_FILE="/tmp/${USER}_datareportsig"
if echo "$CLEAN_MSG" | grep -q 'wasm-transfer'; then
echo "---------------------------------------------------------"
echo "... received wasm-transfer event!"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block seems important. Without it, it seems as though the latest request (i.e. the one that triggered this event) is not cleared/processed. I think this has to do with the way wasmd deals with events, i.e. events are sent out before the store is committed so at this point, the latest request is not written to the store and so the query below gives us old state.

I do remember this issue being discussed before but we probably lost it or did something to fix it.

Copy link
Member Author

@hu55a1n1 hu55a1n1 Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related: /issues/65

@hu55a1n1 hu55a1n1 requested a review from davekaj July 24, 2024 09:30
Copy link
Contributor

@davekaj davekaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just two comments, I think we can merge after you comment back

core/quartz/src/server.rs Show resolved Hide resolved
apps/transfers/scripts/listen.sh Outdated Show resolved Hide resolved
hu55a1n1 added 2 commits July 24, 2024 21:18
…com:informalsystems/cycles-quartz into hu55a1n1/22-mtcs-enclave-light-client-check
@hu55a1n1 hu55a1n1 merged commit 2a4e7f5 into main Jul 24, 2024
7 checks passed
@hu55a1n1 hu55a1n1 deleted the hu55a1n1/22-mtcs-enclave-light-client-check branch July 24, 2024 19:30
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.

MIssing light client and merkle proof verification in Clearing.Run handler
2 participants