Skip to content

Commit

Permalink
Rephrase error message
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack committed Jan 22, 2025
1 parent ad383e8 commit d671469
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions rskj-core/src/main/java/co/rsk/peg/Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,10 @@ public static BridgeMethods.BridgeMethodExecutor activeAndRetiringFederationOnly
boolean isFromRetiringFed = retiringFederation != null && BridgeUtils.isFromFederateMember(self.rskTx, retiringFederation, self.signatureCache);

if (!isFromActiveFed && !isFromRetiringFed) {
String errorMessage = String.format("Sender is not part of the active or retiring federations, so he is not enabled to call the function '%s'",funcName);
String errorMessage = String.format(
"The sender is not a member of the active or retiring federations and is therefore not authorized to invoke the function: '%s'",
funcName
);
logger.warn(errorMessage);
throw new VMException(errorMessage);
}
Expand All @@ -1501,7 +1504,10 @@ public static BridgeMethods.BridgeMethodExecutor activeRetiringAndProposedFedera
boolean isFromProposedFed = proposedFederation.isPresent() && BridgeUtils.isFromFederateMember(self.rskTx, proposedFederation.get(), self.signatureCache);

if (!isFromActiveFed && !isFromRetiringFed && !isFromProposedFed) {
String errorMessage = String.format("Sender is not part of the active, retiring or proposed federations, so he is not enabled to call the function '%s'",funcName);
String errorMessage = String.format(
"The sender is not a member of the active, retiring, or proposed federations and is therefore not authorized to call the function: '%s'",
funcName
);
logger.warn(errorMessage);
throw new VMException(errorMessage);
}
Expand Down
6 changes: 3 additions & 3 deletions rskj-core/src/test/java/co/rsk/peg/BridgeTestIntegration.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public class BridgeTestIntegration {
private static final BigInteger GAS_PRICE = new BigInteger("100");
private static final BigInteger GAS_LIMIT = new BigInteger("1000");
private static final String DATA = "80af2871";
private static final String ERR_NOT_FROM_ACTIVE_OR_RETIRING_FED = "Sender is not part of the active or retiring federation";
private static final String ERR_NOT_FROM_ACTIVE_RETIRING_OR_PROPOSED_FED = "Sender is not part of the active, retiring or proposed federations";
private static final String ERR_NOT_FROM_ACTIVE_OR_RETIRING_FED = "The sender is not a member of the active or retiring federations";
private static final String ERR_NOT_FROM_ACTIVE_RETIRING_OR_PROPOSED_FED = "The sender is not a member of the active, retiring, or proposed federations";

private TestSystemProperties config = new TestSystemProperties();
private Constants constants;
Expand Down Expand Up @@ -3375,7 +3375,7 @@ void receiveHeadersAccess_beforePublic_noAccessIfNotFromFederationMember() throw
bridge.execute(data);
fail();
} catch (VMException e) {
assertTrue(e.getMessage().contains("Sender is not part of the active"));
assertTrue(e.getMessage().contains("The sender is not a member of the active"));
}
verify(bridgeSupportMock, never()).receiveHeaders(any(BtcBlock[].class));
}
Expand Down

0 comments on commit d671469

Please sign in to comment.