Skip to content

Commit

Permalink
add chunAddr values to know from which IP is the error coming from
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCardinalError committed Sep 20, 2023
1 parent 3307e58 commit 411f347
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Redistribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ contract Redistribution is AccessControl, Pausable {
error AlreadyClaimed(); // This round was already claimed
error NotAdmin(); // Caller of trx is not admin
error OnlyPauser(); // Only account with pauser role can call pause/unpause
error SocVerificationFailed(); // Soc verification failed for this element
error SocCalcNotMatching(); // Soc address calculation does not match with the witness
error IndexOutsideSet(); // Stamp available: index resides outside of the valid index set
error SigRecoveryFailed(); // Stamp authorized: signature recovery failed for element
error BalanceValidationFailed(); // Stamp alive: batch remaining balance validation failed for attached stamp
error BucketDiffers(); // Stamp aligned: postage bucket differs from address bucket
error SocVerificationFailed(bytes32); // Soc verification failed for this element
error SocCalcNotMatching(bytes32); // Soc address calculation does not match with the witness
error IndexOutsideSet(bytes32); // Stamp available: index resides outside of the valid index set
error SigRecoveryFailed(bytes32); // Stamp authorized: signature recovery failed for element
error BalanceValidationFailed(bytes32); // Stamp alive: batch remaining balance validation failed for attached stamp
error BucketDiffers(bytes32); // Stamp aligned: postage bucket differs from address bucket
error InclusionProofFailed(uint8, bytes32);
// 1 = RC inclusion proof failed for element, 2 = First sister segment in data must match,
// 3 = Inclusion proof failed for original address of element, 4 = Inclusion proof failed for transformed address of element
Expand Down Expand Up @@ -906,14 +906,14 @@ contract Redistribution is AccessControl, Pausable {
entryProof.socProofAttached[0].chunkAddr
)
) {
revert SocVerificationFailed();
revert SocVerificationFailed(entryProof.socProofAttached[0].chunkAddr);
}

if (
calculateSocAddress(entryProof.socProofAttached[0].identifier, entryProof.socProofAttached[0].signer) !=
entryProof.proveSegment
) {
revert SocCalcNotMatching();
revert SocCalcNotMatching(entryProof.socProofAttached[0].chunkAddr);
}
}

Expand All @@ -925,22 +925,22 @@ contract Redistribution is AccessControl, Pausable {
uint256 maxPostageIndex = postageStampIndexCount(batchDepth, bucketDepth);
// available
if (postageIndex >= maxPostageIndex) {
revert IndexOutsideSet();
revert IndexOutsideSet(entryProof.chunkAddr);
}

// available
address batchOwner = PostageContract.batchOwner(entryProof.postageId);

// alive
if (PostageContract.remainingBalance(entryProof.postageId) < PostageContract.minimumInitialBalancePerChunk()) {
revert BalanceValidationFailed();
revert BalanceValidationFailed(entryProof.chunkAddr);
}

// aligned
uint64 postageBucket = getPostageBucket(entryProof.index);
uint64 addressBucket = addressToBucket(entryProof.proveSegment, bucketDepth);
if (postageBucket != addressBucket) {
revert BucketDiffers();
revert BucketDiffers(entryProof.chunkAddr);
}

// authorized
Expand All @@ -954,7 +954,7 @@ contract Redistribution is AccessControl, Pausable {
entryProof.timeStamp
)
) {
revert SigRecoveryFailed();
revert SigRecoveryFailed(entryProof.chunkAddr);
}
}

Expand Down

0 comments on commit 411f347

Please sign in to comment.