Skip to content

Commit

Permalink
Return short hex string and change log
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel-Trintinalia <[email protected]>
  • Loading branch information
Gabriel-Trintinalia committed Oct 27, 2023
1 parent 7568818 commit e72f6a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public String getName() {
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
return new JsonRpcSuccessResponse(
requestContext.getRequest().getId(),
miningParameters.getMinPriorityFeePerGas().toHexString());
miningParameters.getMinPriorityFeePerGas().toShortHexString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Wei minPriorityFeePerGas =
Wei.fromHexString(requestContext.getRequiredParameter(0, String.class));
miningParameters.setMinPriorityFeePerGas(minPriorityFeePerGas);
LOG.debug("min priority fee per gas changed to {}", minPriorityFeePerGas);
LOG.debug(
"min priority fee per gas changed to {}", minPriorityFeePerGas.toHumanReadableString());
return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), true);
} catch (final IllegalArgumentException invalidJsonRpcParameters) {
return new JsonRpcErrorResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public void setUp() {

@Test
public void shouldReturnMinPriorityFee() {
Wei minPriorityFee = Wei.fromHexString("0x46");
String minPriorityFee = "0x46";

final JsonRpcRequestContext request =
new JsonRpcRequestContext(new JsonRpcRequest("2.0", method.getName(), new Object[] {}));

when(miningParameters.getMinPriorityFeePerGas()).thenReturn(minPriorityFee);
when(miningParameters.getMinPriorityFeePerGas()).thenReturn(Wei.fromHexString(minPriorityFee));

final JsonRpcResponse expected =
new JsonRpcSuccessResponse(request.getRequest().getId(), minPriorityFee.toHexString());
new JsonRpcSuccessResponse(request.getRequest().getId(), minPriorityFee);

final JsonRpcResponse actual = method.response(request);
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
Expand Down

0 comments on commit e72f6a1

Please sign in to comment.