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

DEV-3592: Emit events for indexers to query status and output data #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions contracts/AttestationEntrypointBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ abstract contract AttestationEntrypointBase is Ownable {

mapping(uint16 quoteVersion => IQuoteVerifier verifier) public quoteVerifiers;

event AttestationSubmitted(bool success, bytes output);

constructor() {
_initializeOwner(msg.sender);
}
Expand Down Expand Up @@ -91,7 +93,6 @@ abstract contract AttestationEntrypointBase is Ownable {
*/
function _verifyAndAttestOnChain(bytes calldata rawQuote)
internal
view
returns (bool success, bytes memory output)
{
// Parse the header
Expand All @@ -105,6 +106,8 @@ abstract contract AttestationEntrypointBase is Ownable {
// We found a supported version, begin verifying the quote
// Note: The quote header cannot be trusted yet, it will be validated by the Verifier library
(success, output) = quoteVerifier.verifyQuote(header, rawQuote);

emit AttestationSubmitted(success, output);
}

/**
Expand All @@ -125,7 +128,6 @@ abstract contract AttestationEntrypointBase is Ownable {
bytes calldata proofBytes
)
internal
view
returns (bool success, bytes memory verifiedOutput)
{
ZkCoProcessorConfig memory zkConfig = _zkConfig[zkCoprocessor];
Expand All @@ -147,6 +149,8 @@ abstract contract AttestationEntrypointBase is Ownable {
return (false, bytes("Unsupported quote version"));
}
(success, verifiedOutput) = quoteVerifier.verifyZkOutput(output);

emit AttestationSubmitted(success, output);
}

/**
Expand Down
9 changes: 8 additions & 1 deletion contracts/bases/QuoteVerifierBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,14 @@ abstract contract QuoteVerifierBase is IQuoteVerifier, EnclaveIdBase, X509ChainB
}

function serializeOutput(Output memory output) internal pure returns (bytes memory) {
return abi.encodePacked(output.quoteVersion, output.tee, output.tcbStatus, output.fmspcBytes, output.quoteBody, abi.encode(output.advisoryIDs));
return abi.encodePacked(
output.quoteVersion,
output.tee,
output.tcbStatus,
output.fmspcBytes,
output.quoteBody,
output.advisoryIDs.length > 0 ? abi.encode(output.advisoryIDs) : bytes("")
);
}

function checkCollateralHashes(uint256 offset, bytes calldata journal) internal view returns (bool) {
Expand Down
Loading