From 95a691bfef29db4c778f1b13dc16e5af28d90392 Mon Sep 17 00:00:00 2001 From: Neeharika-Sompalli Date: Mon, 24 May 2021 16:25:44 -0500 Subject: [PATCH] address review comments and enable test in CI Signed-off-by: Neeharika-Sompalli --- .../services/sigs/sourcing/SigMapPubKeyToSigBytes.java | 4 ++-- .../com/hedera/services/sigs/SigVerifierRegressionTest.java | 6 +++--- .../services/sigs/sourcing/SigMapPubKeyToSigBytesTest.java | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hedera-node/src/main/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytes.java b/hedera-node/src/main/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytes.java index 3da81438d655..b9d67596e600 100644 --- a/hedera-node/src/main/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytes.java +++ b/hedera-node/src/main/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytes.java @@ -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); } diff --git a/hedera-node/src/test/java/com/hedera/services/sigs/SigVerifierRegressionTest.java b/hedera-node/src/test/java/com/hedera/services/sigs/SigVerifierRegressionTest.java index eb86c870f254..186a16172640 100644 --- a/hedera-node/src/test/java/com/hedera/services/sigs/SigVerifierRegressionTest.java +++ b/hedera-node/src/test/java/com/hedera/services/sigs/SigVerifierRegressionTest.java @@ -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 diff --git a/hedera-node/src/test/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytesTest.java b/hedera-node/src/test/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytesTest.java index 0b2c7b0528d4..285412b4c290 100644 --- a/hedera-node/src/test/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytesTest.java +++ b/hedera-node/src/test/java/com/hedera/services/sigs/sourcing/SigMapPubKeyToSigBytesTest.java @@ -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 {