Skip to content

Commit 7d6417b

Browse files
Merge pull request #53 from EspressoSystems/philippe/close-natspec-documentation-gaps
Close natspec documentation gaps.
2 parents a4f8e35 + ad7a97e commit 7d6417b

8 files changed

Lines changed: 28 additions & 10 deletions

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Run Forge build
3535
run: |
36-
forge build --sizes
36+
forge build --deny warnings --sizes
3737
id: build
3838

3939
- name: Run Forge tests

‎src/EspressoTEEVerifier.sol‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ contract EspressoTEEVerifier is OwnableWithGuardiansUpgradeable, IEspressoTEEVer
3434
_disableInitializers();
3535
}
3636

37+
/**
38+
* @notice Initializes verifier contracts and ownership for this proxy instance.
39+
* @param _owner The owner address that can manage verifier configuration.
40+
* @param _espressoSGXTEEVerifier The SGX verifier used for SGX-based attestations.
41+
* @param _espressoNitroTEEVerifier The Nitro verifier used for Nitro-based attestations.
42+
*/
3743
function initialize(
3844
address _owner,
3945
IEspressoSGXTEEVerifier _espressoSGXTEEVerifier,

‎src/TEEHelper.sol‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ abstract contract TEEHelper is ITEEHelper, Initializable {
1919
bytes32 internal constant TEE_HELPER_STORAGE_SLOT =
2020
0x6c53fdf1cef7bc567e8d46761d9c42d29c5fad7063be8d47b686412bfc375800;
2121

22+
/**
23+
* @notice Returns the ERC-7201 namespaced storage pointer for TEE helper state.
24+
* @return l Storage reference for TEEHelper state variables.
25+
*/
2226
function _layout() internal pure returns (TEEHelperStorage storage l) {
2327
bytes32 slot = TEE_HELPER_STORAGE_SLOT;
2428
assembly {
@@ -139,6 +143,10 @@ abstract contract TEEHelper is ITEEHelper, Initializable {
139143
}
140144
}
141145

146+
/**
147+
* @notice Updates the authorized TEE verifier address.
148+
* @param newTEEVerifier The new verifier address allowed to manage enclave hashes.
149+
*/
142150
function _setTEEVerifier(address newTEEVerifier) internal {
143151
if (newTEEVerifier == address(0)) {
144152
revert InvalidTEEVerifierAddress();

‎src/mocks/EspressoNitroTEEVerifierMock.sol‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ contract EspressoNitroTEEVerifierMock {
2020
/**
2121
* @notice Register a signer without verification. In mock, we skip ZK proof verification.
2222
* @param output The public output (ignored in mock, but we extract signer from it)
23-
* @param proofBytes The proof bytes (ignored in mock)
2423
*/
25-
function registerService(bytes calldata output, bytes calldata proofBytes, ServiceType service)
26-
external
27-
{
24+
function registerService(bytes calldata output, bytes calldata, ServiceType service) external {
2825
VerifierJournal memory journal = abi.decode(output, (VerifierJournal));
2926

3027
// The publicKey's first byte 0x04 byte followed which only determine if the public key is compressed or not.

‎src/mocks/EspressoSGXTEEVerifierMock.sol‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ contract EspressoSGXTEEVerifierMock {
2020

2121
/**
2222
* @notice Register a signer without verification. In mock, we skip quote verification.
23-
* @param attestation The attestation (ignored in mock)
2423
* @param data The signer address as bytes (20 bytes)
2524
*/
26-
function registerService(bytes calldata attestation, bytes calldata data, ServiceType service)
27-
external
28-
{
25+
function registerService(bytes calldata, bytes calldata data, ServiceType service) external {
2926
require(data.length == 20, "Invalid data length");
3027

3128
address signer = address(uint160(bytes20(data[:20])));

‎src/mocks/EspressoTEEVerifier.sol‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ contract EspressoTEEVerifierMock {
5151
}
5252
return true;
5353
}
54+
55+
return false;
5456
}
5557

5658
/**
@@ -88,6 +90,8 @@ contract EspressoTEEVerifierMock {
8890
if (teeType == IEspressoTEEVerifier.TeeType.NITRO) {
8991
return espressoNitroTEEVerifier.isSignerValid(signer, serviceType);
9092
}
93+
94+
return false;
9195
}
9296

9397
/**
@@ -107,6 +111,8 @@ contract EspressoTEEVerifierMock {
107111
if (teeType == IEspressoTEEVerifier.TeeType.NITRO) {
108112
return espressoNitroTEEVerifier.registeredEnclaveHash(enclaveHash, service);
109113
}
114+
115+
return false;
110116
}
111117

112118
function setEspressoSGXTEEVerifier(IEspressoSGXTEEVerifier _espressoSGXTEEVerifier) external {

‎test/EspressoSGXTEEVerifier.t.sol‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ contract EspressoSGXTEEVerifierTest is Test {
337337

338338
function testSetEnclaveHash() public {
339339
vm.startPrank(adminTEE);
340-
bytes32 newMrEnclave = bytes32(hex"01");
340+
bytes32 newMrEnclave = bytes32(uint256(1));
341341
espressoTEEVerifier.setEnclaveHash(
342342
newMrEnclave, true, IEspressoTEEVerifier.TeeType.SGX, ServiceType.BatchPoster
343343
);

‎test/JournalValidation.t.sol‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ contract JournalValidationTest is Test {
162162
bytes memory validKey = new bytes(65);
163163
validKey[0] = 0x04; // Uncompressed marker
164164
for (uint256 i = 1; i < 65; i++) {
165+
// casting to 'uint8' is safe because loop bounds guarantee i is in [1, 64]
166+
// forge-lint: disable-next-line(unsafe-typecast)
165167
validKey[i] = bytes1(uint8(i));
166168
}
167169

@@ -176,6 +178,8 @@ contract JournalValidationTest is Test {
176178
bytes memory validPublicKey = new bytes(65);
177179
validPublicKey[0] = 0x04;
178180
for (uint256 i = 1; i < 65; i++) {
181+
// casting to 'uint8' is safe because loop bounds guarantee i is in [1, 64]
182+
// forge-lint: disable-next-line(unsafe-typecast)
179183
validPublicKey[i] = bytes1(uint8(i));
180184
}
181185

0 commit comments

Comments
 (0)