diff --git a/contracts/src/examples/modules/SchemaCheckerModule.sol b/contracts/src/examples/modules/SchemaCheckerModule.sol index 2db99ac9..95ab77d4 100644 --- a/contracts/src/examples/modules/SchemaCheckerModule.sol +++ b/contracts/src/examples/modules/SchemaCheckerModule.sol @@ -26,13 +26,9 @@ contract SchemaCheckerModule is AbstractModule { address /*txSender*/, uint256 /*value*/ ) public view override { - Profile memory issuerProfile; - (issuerProfile.issuer, issuerProfile.schemaId, issuerProfile.issueDate) = abi.decode( - attestationPayload.attestationData, - (address, bytes32, uint64) - ); - if (issuerProfile.schemaId != attestationPayload.schemaId) { + if (keccak256(abi.encodePacked(attestationPayload.schemaId)) != keccak256(abi.encode(bytes32("12345678")))) { revert InvalidSchemaId(); } + abi.decode(attestationPayload.attestationData, (address, bytes32, uint64)); } } diff --git a/contracts/test/example/SchemaCheckerModule.t.sol b/contracts/test/example/SchemaCheckerModule.t.sol index 790378da..dbfd1887 100644 --- a/contracts/test/example/SchemaCheckerModule.t.sol +++ b/contracts/test/example/SchemaCheckerModule.t.sol @@ -18,15 +18,14 @@ contract SchemaCheckerModuleTest is Test { vm.deal(issuer, 1 ether); } - function test_SchemaCheckerModule_verifySchemaId() public { + function test_SchemaCheckerModule_matchSchemaId() public { address user = makeAddr("user"); - bytes32 schemaId = bytes32(uint256(1234)); uint64 issueDate = 0; AttestationPayload memory attestationPayload = AttestationPayload( - schemaId, + bytes32("12345678"), 0, abi.encode(user), - abi.encode(issuer, schemaId, issueDate) + abi.encode(issuer, "112334", issueDate) ); schemaCheckerModule.run(attestationPayload, bytes("0000"), user, 0); @@ -47,7 +46,7 @@ contract SchemaCheckerModuleTest is Test { schemaCheckerModule.run(attestationPayload, bytes("0000"), user, 0); } - function test_EcRecoverModule_supportsInterface() public { + function test_SchemaCheckerModule_supportsInterface() public { bool isAbstractModuleSupported = schemaCheckerModule.supportsInterface(type(AbstractModule).interfaceId); assertEq(isAbstractModuleSupported, true); }