Skip to content

Commit

Permalink
address review comments and enable test in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Neeharika-Sompalli <[email protected]>
  • Loading branch information
Neeharika-Sompalli committed May 24, 2021
1 parent c8fa94f commit 95a691b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public byte[] sigBytesFor(byte[] pubKey) throws KeyPrefixMismatchException {
if (beginsWith(pubKey, pubKeyPrefix)) {
if (sigBytes != EMPTY_SIG) {
throw new KeyPrefixMismatchException(
"Source signature map is ambiguous for given public key " +
Hex.toHexString(pubKey) + " and public key prefix " + Hex.toHexString(pubKeyPrefix));
"Source signature map with prefix " + Hex.toHexString(pubKeyPrefix) +
" is ambiguous for given public key! (" + Hex.toHexString(pubKey) + ")");
}
sigBytes = sigBytesFor(sigPair);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ void throwsOnInvalidSenderAccount() throws Throwable {

@Test
void throwsOnInvalidSigMap() throws Throwable {
assumeFalse(isInCircleCi);

// given:
setupFor(AMBIGUOUS_SIG_MAP_SCENARIO);

// expect:
assertThrows(KeyPrefixMismatchException.class,
KeyPrefixMismatchException exception = assertThrows(KeyPrefixMismatchException.class,
() -> sigVerifies(platformTxn.getBackwardCompatibleSignedTxn()));
assertTrue(exception.getMessage().contains("Source signature map with prefix")
&& exception.getMessage().contains("is ambiguous for given public key!"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public void rejectsNonUniqueSigBytes() throws Throwable {
lookupsMatch(payerKt, overlapFactory, CommonUtils.extractTransactionBodyBytes(signedTxn), subject);
});

assertTrue(exception.getMessage().contains("Source signature map is ambiguous for given public key"));
assertTrue(exception.getMessage().contains("Source signature map with prefix")
&& exception.getMessage().contains("is ambiguous for given public key!"));
}

private void lookupsMatch(KeyTree kt, KeyFactory factory, byte[] data, PubKeyToSigBytes subject) throws Exception {
Expand Down

0 comments on commit 95a691b

Please sign in to comment.