-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add additional verification to EspressoTEEVerifier #28
Conversation
@param rawQuote The raw quote in bytes | ||
@return header The parsed header | ||
*/ | ||
function parseQuoteHeader(bytes calldata rawQuote) public pure returns (Header memory header) { |
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 didnt see any harm in making it public and I think it might turn out helpful for debugging in the future. Its a pure function so takes very less gas as well.
qeIdDaoUpsert(3, qeIdPath); | ||
fmspcTcbDaoUpsert(tcbInfoPath); | ||
function setUp() public { | ||
vm.createSelectFork("https://rpc.ankr.com/eth_sepolia"); |
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 am forking sepolia in tests here instead of arb sepolia because automata hasnt deployed there contracts on arb sepolia yet. I will migrate these tests once they have done that
|
||
/** | ||
constructor(bytes32 _mrEnclave, bytes32 _mrSigner, address _quoteVerifier) { |
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.
The reason I am accepting the V3QuoteVerifier
contract here is because automata changed how they manage their contracts. Now each Verifier contract should be registered with the PCCSRouter
V3QuoteVerifier | ||
} from "@automata-network/dcap-attestation/contracts/verifiers/V3QuoteVerifier.sol"; | ||
import {BytesUtils} from "@automata-network/dcap-attestation/contracts/utils/BytesUtils.sol"; | ||
import {Ownable} from "solady/auth/Ownable.sol"; |
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 particular reason we're not using the openzeppelin Ownable
here?
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.
Automata uses this library for ownable. Apparently is more gas efficient
string memory inputFile = string.concat(vm.projectRoot(), quotePath); | ||
bytes memory sampleQuote = vm.readFileBinary(inputFile); | ||
espressoTEEVerifier = new EspressoTEEVerifier( | ||
bytes32(0x51dfe95acffa8a4075b716257c836895af9202a5fd56c8c2208dacb79c659ff1), |
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.
Define a variable like badMrEnclave
here? And similarly for the other tests. Makes it a bit easier to read especially since the value is the same except for the last digit.
To be more certain that we are always reverting for the right reasons I think it would be a bit better to have custom Error types for each reason we fail verification and check in the tests if we are reverting for the right reasons. Suggestion for later cleanup work.
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 will clean this up, might as well do it here!
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.
What's the best way to run the tests locally? Both |
I also get an error from
That contract seems to be at |
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 fine to me. Some nitpicks and I haven't been able to run it locally because the compilation takes seemingly forever.
I did do |
src/bridge/EspressoTEEVerifier.sol
Outdated
@@ -136,13 +146,6 @@ contract EspressoTEEVerifier is Ownable { | |||
success = true; | |||
} | |||
|
|||
/* |
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.
we dont need this as we can call transferOwnership
function present in the Ownable contract
64c3051
to
cc05e5d
Compare
* Add additional verification to EspressoTEEVerifier * fix tests * fix tests * cleanup * revert broken tests * fix ci * fix ci * address comments * address comments * add code docs
Closes #312
I have listed down my findings related to automata here
This PR:
Important Files to Review
Additional Verifications Added
(NOTE: we dont need to check the signature because automata already verifies that, we only check that the reportData matches the function arguments)