-
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
} | ||
|
||
/// @notice Set the attestation recipient (mock) | ||
function setRecipient(address _recipient) public { |
Check notice
Code scanning / Slither
Missing zero address validation Low
|
||
address public recipient; | ||
|
||
constructor(address _attester, bytes32 _schema, address _recipient) { |
Check notice
Code scanning / Slither
Missing zero address validation Low
- recipient = _recipient
|
||
address public recipient; | ||
|
||
constructor(address _attester, bytes32 _schema, address _recipient) { |
Check notice
Code scanning / Slither
Missing zero address validation Low
- attester = _attester
} | ||
|
||
/// @notice Set the attestation recipient (mock) | ||
function setRecipient(address _recipient) public { |
Check warning
Code scanning / Slither
Conformance to Solidity naming conventions Warning
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: "" | ||
}); | ||
} | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
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: "" | ||
}); | ||
} | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- attestationId == 0x0000000000000000000000000000000000000000000000000000000000000004
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: "" | ||
}); | ||
} | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
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: "" | ||
}); | ||
} | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
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: "" | ||
}); | ||
} | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- attestationId == 0x0000000000000000000000000000000000000000000000000000000000000003
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: "" | ||
}); | ||
} | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- Attestation({uid:0x000000000000000000000000000001,schema:0x000000000000000000000000000001,time:0,expirationTime:0,revocationTime:0,refUID:0x000000000000000000000000000001,recipient:recipient,attester:attester,revocable:false,data:})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ctrlc03 thanks!
Description
Mock gatekeeper tests vs using forked environment
Related issue(s)
Fix: #1409
Confirmation