Skip to content

Commit

Permalink
Bump to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Dec 3, 2024
1 parent c8f9847 commit 46cdddc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/nitro-validator
10 changes: 4 additions & 6 deletions src/SystemConfigGlobal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ pragma solidity ^0.8.0;
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {ISemver} from "@eth-optimism-bedrock/src/universal/interfaces/ISemver.sol";
import {NitroValidator} from "@nitro-validator/NitroValidator.sol";
import {CborDecode} from "@nitro-validator/CborDecode.sol";
import {CertManager} from "@nitro-validator/CertManager.sol";
import {NodePtr, LibNodePtr} from "@nitro-validator/NodePtr.sol";
import {LibBytes} from "@nitro-validator/LibBytes.sol";

contract SystemConfigGlobal is OwnableUpgradeable, ISemver, NitroValidator {
using LibNodePtr for NodePtr;
using LibBytes for bytes;
using CborDecode for bytes;

uint256 public constant MAX_AGE = 60 minutes;

Expand Down Expand Up @@ -53,12 +51,12 @@ contract SystemConfigGlobal is OwnableUpgradeable, ISemver, NitroValidator {

function registerSigner(bytes calldata attestationTbs, bytes calldata signature) external onlyOwner {
Ptrs memory ptrs = validateAttestation(attestationTbs, signature);
bytes memory pcr0 = attestationTbs.slice(ptrs.pcrs[0].content(), ptrs.pcrs[0].length());
bytes memory pcr0 = attestationTbs.slice(ptrs.pcrs[0]);
require(validPCR0s[keccak256(pcr0)], "invalid pcr0 in attestation");

require(ptrs.timestamp + MAX_AGE > block.timestamp, "attestation too old");

bytes memory publicKey = attestationTbs.slice(ptrs.publicKey.content(), ptrs.publicKey.length());
bytes memory publicKey = attestationTbs.slice(ptrs.publicKey);
address enclaveAddress = address(uint160(uint256(keccak256(publicKey))));
validSigners[enclaveAddress] = true;
}
Expand Down

0 comments on commit 46cdddc

Please sign in to comment.