-
Notifications
You must be signed in to change notification settings - Fork 115
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
runtime: Add client node TEE freshness verification #4922
runtime: Add client node TEE freshness verification #4922
Conversation
63ce5f0
to
6e537f9
Compare
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.
Just left some quick comments.
babd6f1
to
d727058
Compare
Codecov Report
@@ Coverage Diff @@
## master #4922 +/- ##
==========================================
- Coverage 66.71% 66.70% -0.02%
==========================================
Files 464 464
Lines 51127 51203 +76
==========================================
+ Hits 34110 34155 +45
- Misses 12836 12867 +31
Partials 4181 4181
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
d727058
to
5fcedbc
Compare
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.
Looks good (pending on #4904), some minor comments.
go/consensus/api/submission.go
Outdated
@@ -63,7 +63,14 @@ type SubmissionManager interface { | |||
// with the passed signer and submits it to consensus backend. | |||
// | |||
// It also automatically handles retries in case the nonce was incorrectly estimated. | |||
SignAndSubmitTx(ctx context.Context, signer signature.Signer, tx *transaction.Transaction) error | |||
SignAndSubmitTx(ctx context.Context, signer signature.Signer, tx *transaction.Transaction) (*transaction.SignedTransaction, error) |
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.
Is there a need now for SignAndSubmitTx
to also return the transaction or is having this only in SignAndSubmitTxWithProof
enough (this would reduce the amount of changes required)?
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.
No, currently there is no need. I just wanted to be consistent with SignAndSubmitTxWithProof
. It is actually interesting that we never need the signed transaction, neither the height at which it was published.
I can remove it if you like.
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 would remove it.
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.
Removed and rebased.
5fcedbc
to
a051f6d
Compare
Rebase on master now that #4904 is merged. |
a051f6d
to
ab96348
Compare
return None; | ||
} | ||
match total { | ||
0 => panic!("cannot call compute_hash_from_aunts() with 0 total"), |
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.
Given that this is checked above in which case there is an early return this could easily be changed to an unreachable!
(with a comment that this is handled above) to make this explicit.
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.
Agree, unreachable is better. However, I didn't want to remove this as I wanted to be consistent with GO version.
index: i64, | ||
total: i64, | ||
leaf_hash: Hash, | ||
inner_hashes: &Vec<Hash>, |
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.
Could this be changed to &[Hash]
to avoid conversions to vec?
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.
Yes, much better.
07a95b3
to
e729284
Compare
e729284
to
d80da34
Compare
Add client node TEE freshness verification
Executor and key manager TEE nodes currently use node registration (which includes the randomly generated Runtime Attestation Key and nonce) in order to establish consensus layer view freshness.
But this approach doesn’t work for client nodes. Since client nodes do not currently register, there is no way for TEE runtimes running on them to verify consensus layer freshness. There is however a need for client nodes to be able to execute signed queries and requiring an up-to-date consensus layer view is crucial for verifying quotes and policies.
To do this the runtime just needs to generate a transaction containing a nonce and that transaction must be published in a block, with the host node providing the height at which the transaction was published, its index and Merkle proof of inclusion. The runtime can then use the light client to verify the specified block header and the provided Merkle proof using the verified transaction root hash.
The newly added
registry.ProveFreshness
transaction that accepts a fixed-size binary blob of 32 bytes and always succeeds without doing any processing should be used for this purpose. The runtime host protocol should be extended to support this new flow, initiated by the consensus verifier in the runtime (immediately after initializing the light client in case enabled in the static runtime config), e.g. adding theHostProveFreshness{Request,Response}
messages.Note that this check can be used very early on as it doesn’t require the node to be registered.
Test
Unhappy path tested locally. Happy path already included in trust root tests.