Sparkly Seaweed Wolf
Medium
One attestation's mock profile may be changed. This will cause the previous review is unavailable.
In EthosProfile, we will use one mockId to record attestation reviews. When we add one review via addReview for one attestation, one mockId for this attestation will be created or used for one attestation.
If there is not one mock for this attestation, we will create one mockId, otherwise, we will use the previous created mockId. This will guarantee that all reviews fro this attestation will be aggregated via this mockId.
The problem is that one attestation's mockId may be changed if this attestation is claimed via _claimAttestation
. When the mockId for this attestation is updated, previous reviews are still connected with the previous mockId. When users want to get all reviews via this attestation hash, they cannot get the previous reviews.
function addReview(
Score score,
address subject,
address paymentToken,
string calldata comment,
string calldata metadata,
AttestationDetails calldata attestationDetails
) external payable whenNotPaused {
...
IEthosProfile ethosProfile = _getEthosProfile();
bytes32 attestationHash;
uint256 mockId;
if (subject != address(0)) {
...
} else {
attestationHash = _getEthosAttestation().getServiceAndAccountHash(
attestationDetails.service,
attestationDetails.account
);
mockId = ethosProfile.profileIdByAttestation(attestationHash);
mockId = _addReview(mockId, subject, true, attestationHash, ethosProfile);
}
...
}
function _addReview(
uint256 mockId,
...
) internal returns (uint256 subjectProfileId) {
if (mockId == 0) {
subjectProfileId = ethosProfile.incrementProfileCount(
isAttestation,
subject,
attestationHash
);
} else {
subjectProfileId = mockId;
}
...
}
function _claimAttestation(
uint256 profileId,
bytes32 attestationHash,
string calldata evidence
) private returns (bool) {
...
// Keep the profile contract up to date re: registered attestations
IEthosProfile(ethosProfile).assignExistingProfileToAttestation(attestationHash, profileId);
...
}
function assignExistingProfileToAttestation(
bytes32 attestationHash,
uint256 profileId
) external isEthosAttestation {
profileIdByAttestation[attestationHash] = profileId;
}
- One attestation is claimed and assigned to another mockId.
N/A
- Alice creates one attestation.
- Bob creates one review for this attestation. MockId is 2. Bob's review will be connected with mockId 2.
- Cathy claim this attestation and assign this attestation's mockId to 3.
- David create another review for this attestation. MockId is 3.
- When users want to get all reviews for this attestation, only David's review is available via
reviewsByAttestationHashInRange
.
Some previous reviews will not be available for function reviewsByAttestationHashInRange
. This will break our design intent that aggregate all reviews together for the same attestation.
N/A
When one attestation's profile id is changed, we should update reviewIdsBySubjectProfileId
timely.