Skip to content
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

Merged
merged 1 commit into from
Apr 30, 2024
Merged

test(eas): mock gatekeeper tests #1412

merged 1 commit into from
Apr 30, 2024

Conversation

ctrlc03
Copy link
Collaborator

@ctrlc03 ctrlc03 commented Apr 30, 2024

Description

Mock gatekeeper tests vs using forked environment

Related issue(s)

Fix: #1409

Confirmation

Copy link

vercel bot commented Apr 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
maci-website ✅ Ready (Inspect) Visit Preview Apr 30, 2024 2:28pm

}

/// @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


address public recipient;

constructor(address _attester, bytes32 _schema, address _recipient) {

Check notice

Code scanning / Slither

Missing zero address validation Low

}

/// @notice Set the attestation recipient (mock)
function setRecipient(address _recipient) public {

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

Parameter MockEAS.setRecipient(address)._recipient is not in mixedCase
Comment on lines +26 to +103
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
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

Comment on lines +26 to +103
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
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
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

Comment on lines +26 to +103
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: ""
});
}
}
Copy link
Collaborator

@0xmad 0xmad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ctrlc03 thanks!

@0xmad 0xmad merged commit 86ee506 into dev Apr 30, 2024
20 checks passed
@0xmad 0xmad deleted the test/mock-gatekeepers branch April 30, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Mock gatekeeper tests
2 participants