diff --git a/foundry.toml b/foundry.toml index f09acafc..10e4a4a4 100644 --- a/foundry.toml +++ b/foundry.toml @@ -8,6 +8,7 @@ optimizer = true optimizer_runs = 1 via_ir = true solc_version = '0.8.25' +evm_version = 'cancun' fs_permissions = [{ access = "read", path = "./"}] remappings = ['ds-test/=lib/forge-std/lib/ds-test/src/', 'forge-std/=lib/forge-std/src/', @@ -25,4 +26,4 @@ auto_detect_remappings = false [fmt] number_underscore = 'thousands' line_length = 100 -# See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file +# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/src/mocks/EspressoTEEVerifier.sol b/src/mocks/EspressoTEEVerifier.sol index 3b0518c0..1ed915da 100644 --- a/src/mocks/EspressoTEEVerifier.sol +++ b/src/mocks/EspressoTEEVerifier.sol @@ -9,12 +9,29 @@ pragma solidity ^0.8.0; */ contract EspressoTEEVerifierMock { + enum TeeType { + SGX + } + mapping(address => bool) public registeredSigner; constructor() {} - function verify( - bytes calldata rawQuote, - bytes32 reportDataHash - ) external view returns (bool success) { - return (true); + function verify(bytes calldata signature, bytes32 userDataHash) external { + return; + } + + function registerSigner( + bytes calldata attestation, + bytes calldata data, + TeeType teeType + ) external { + // data length should be 20 bytes + require(data.length == 20, "Invalid data length"); + + address signer = address(uint160(bytes20(data[:20]))); + registeredSigner[signer] = true; + } + + function registeredSigners(address signer, TeeType teeType) external view returns (bool) { + return registeredSigner[signer]; } } diff --git a/test/foundry/Inbox.t.sol b/test/foundry/Inbox.t.sol index 5ee001a7..ee80daa5 100644 --- a/test/foundry/Inbox.t.sol +++ b/test/foundry/Inbox.t.sol @@ -110,8 +110,8 @@ contract InboxTest is AbsInboxTest { uint256 userEthBalanceBefore = address(user).balance; // deposit too many eth shall fail - // TODO: Fix test // vm.prank(user); + // TODO: Fix this test // uint256 invalidDepositAmount = 300 ether; // vm.expectRevert(); // ethInbox.depositEth{value: invalidDepositAmount}();