-
Notifications
You must be signed in to change notification settings - Fork 153
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
test(eas): mock gatekeeper tests #1412
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import { IEAS } from "../interfaces/IEAS.sol"; | ||
|
||
/// @title MockEAS | ||
/// @notice A mock contract to test the EASGatekeeper | ||
contract MockEAS is IEAS { | ||
address public immutable attester; | ||
bytes32 public immutable schema; | ||
|
||
address public recipient; | ||
|
||
constructor(address _attester, bytes32 _schema, address _recipient) { | ||
Check notice Code scanning / Slither Missing zero address validation Low
MockEAS.constructor(address,bytes32,address)._attester lacks a zero-check on :
- attester = _attester |
||
attester = _attester; | ||
schema = _schema; | ||
recipient = _recipient; | ||
} | ||
|
||
/// @notice Set the attestation recipient (mock) | ||
function setRecipient(address _recipient) public { | ||
Check notice Code scanning / Slither Missing zero address validation Low Check warning Code scanning / Slither Conformance to Solidity naming conventions Warning
Parameter MockEAS.setRecipient(address)._recipient is not in mixedCase
|
||
recipient = _recipient; | ||
} | ||
|
||
/// @inheritdoc IEAS | ||
function getAttestation(bytes32 attestationId) external view override returns (Attestation memory) { | ||
// revoked | ||
if (attestationId == 0x0000000000000000000000000000000000000000000000000000000000000001) { | ||
return | ||
Attestation({ | ||
uid: "0x000000000000000000000000000001", | ||
schema: schema, | ||
time: 0, | ||
expirationTime: 0, | ||
revocationTime: 1, | ||
refUID: "0x000000000000000000000000000001", | ||
recipient: recipient, | ||
attester: attester, | ||
revocable: true, | ||
data: "" | ||
}); | ||
// invalid schema | ||
} else if (attestationId == 0x0000000000000000000000000000000000000000000000000000000000000002) { | ||
return | ||
Attestation({ | ||
uid: "0x000000000000000000000000000001", | ||
schema: "0x000000000000000000000000000001", | ||
time: 0, | ||
expirationTime: 0, | ||
revocationTime: 0, | ||
refUID: "0x000000000000000000000000000001", | ||
recipient: recipient, | ||
attester: attester, | ||
revocable: false, | ||
data: "" | ||
}); | ||
// invalid recipient | ||
} else if (attestationId == 0x0000000000000000000000000000000000000000000000000000000000000003) { | ||
return | ||
Attestation({ | ||
uid: "0x000000000000000000000000000001", | ||
schema: schema, | ||
time: 0, | ||
expirationTime: 0, | ||
revocationTime: 0, | ||
refUID: "0x000000000000000000000000000001", | ||
recipient: address(0), | ||
attester: attester, | ||
revocable: false, | ||
data: "" | ||
}); | ||
// invalid attester | ||
} else if (attestationId == 0x0000000000000000000000000000000000000000000000000000000000000004) { | ||
return | ||
Attestation({ | ||
uid: "0x000000000000000000000000000001", | ||
schema: schema, | ||
time: 0, | ||
expirationTime: 0, | ||
revocationTime: 0, | ||
refUID: "0x000000000000000000000000000001", | ||
recipient: recipient, | ||
attester: address(0), | ||
revocable: false, | ||
data: "" | ||
}); | ||
// valid | ||
} else { | ||
return | ||
Attestation({ | ||
uid: "0x000000000000000000000000000001", | ||
schema: schema, | ||
time: 0, | ||
expirationTime: 0, | ||
revocationTime: 0, | ||
refUID: "0x000000000000000000000000000001", | ||
recipient: recipient, | ||
attester: attester, | ||
revocable: false, | ||
data: "" | ||
}); | ||
} | ||
} | ||
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
MockEAS.getAttestation(bytes32) uses literals with too many digits:
- attestationId == 0x0000000000000000000000000000000000000000000000000000000000000002
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
MockEAS.getAttestation(bytes32) uses literals with too many digits:
- attestationId == 0x0000000000000000000000000000000000000000000000000000000000000001
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
MockEAS.getAttestation(bytes32) uses literals with too many digits:
- attestationId == 0x0000000000000000000000000000000000000000000000000000000000000004
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
MockEAS.getAttestation(bytes32) uses literals with too many digits:
- attestationId == 0x0000000000000000000000000000000000000000000000000000000000000003
Comment on lines
+26
to
+103
Check warning Code scanning / Slither Too many digits Warning
MockEAS.getAttestation(bytes32) uses literals with too many digits:
- Attestation({uid:0x000000000000000000000000000001,schema:0x000000000000000000000000000001,time:0,expirationTime:0,revocationTime:0,refUID:0x000000000000000000000000000001,recipient:recipient,attester:attester,revocable:false,data:}) |
||
} |
Check notice
Code scanning / Slither
Missing zero address validation Low