Skip to content

Commit

Permalink
Merge branch 'main' into fine-tune-peer-txs-tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-10 authored Oct 17, 2024
2 parents 3248f99 + 5469b52 commit 0783e44
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ public void shouldReturnExecutionResultWhenExecutionIsSuccessful() {
when(result.isSuccessful()).thenReturn(true);
when(result.getValidationResult()).thenReturn(ValidationResult.valid());
when(result.getOutput()).thenReturn(Bytes.of(1));
verify(transactionSimulator).process(any(), any(), any(), mapperCaptor.capture(), any());
verify(transactionSimulator)
.process(eq(callParameter()), any(), any(), mapperCaptor.capture(), any());
assertThat(mapperCaptor.getValue().apply(mock(MutableWorldState.class), Optional.of(result)))
.isEqualTo(Optional.of(expectedResponse));

assertThat(response).usingRecursiveComparison().isEqualTo(expectedResponse);
verify(transactionSimulator).process(eq(callParameter()), any(), any(), any(), any());
verify(blockchainQueries, atLeastOnce()).getBlockchain();
verifyNoMoreInteractions(blockchainQueries);
}
Expand All @@ -174,10 +174,9 @@ public void shouldReturnBasicExecutionRevertErrorWithoutReason() {
// Expect a revert error with no decoded reason (error doesn't begin "Error(string)" so ignored)
final String abiHexString = "0x1234";
final JsonRpcError expectedError = new JsonRpcError(REVERT_ERROR, abiHexString);
final JsonRpcResponse expectedResponse = new JsonRpcErrorResponse(null, expectedError);
final JsonRpcErrorResponse expectedResponse = new JsonRpcErrorResponse(null, expectedError);

assertThat(((JsonRpcErrorResponse) expectedResponse).getError().getMessage())
.isEqualTo("Execution reverted");
assertThat(expectedResponse.getError().getMessage()).isEqualTo("Execution reverted");

mockTransactionProcessorSuccessResult(expectedResponse);
when(blockchainQueries.getBlockchain()).thenReturn(blockchain);
Expand Down Expand Up @@ -214,9 +213,9 @@ public void shouldReturnExecutionRevertErrorWithABIParseError() {
// bytes are invalid ABI)
final String abiHexString = "0x08c379a002d36d";
final JsonRpcError expectedError = new JsonRpcError(REVERT_ERROR, abiHexString);
final JsonRpcResponse expectedResponse = new JsonRpcErrorResponse(null, expectedError);
final JsonRpcErrorResponse expectedResponse = new JsonRpcErrorResponse(null, expectedError);

assertThat(((JsonRpcErrorResponse) expectedResponse).getError().getMessage())
assertThat(expectedResponse.getError().getMessage())
.isEqualTo("Execution reverted: ABI decode error");

mockTransactionProcessorSuccessResult(expectedResponse);
Expand Down Expand Up @@ -254,9 +253,9 @@ public void shouldReturnExecutionRevertErrorWithParsedABI() {
final String abiHexString =
"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002545524332303a207472616e736665722066726f6d20746865207a65726f2061646472657373000000000000000000000000000000000000000000000000000000";
final JsonRpcError expectedError = new JsonRpcError(REVERT_ERROR, abiHexString);
final JsonRpcResponse expectedResponse = new JsonRpcErrorResponse(null, expectedError);
final JsonRpcErrorResponse expectedResponse = new JsonRpcErrorResponse(null, expectedError);

assertThat(((JsonRpcErrorResponse) expectedResponse).getError().getMessage())
assertThat(expectedResponse.getError().getMessage())
.isEqualTo("Execution reverted: ERC20: transfer from the zero address");

mockTransactionProcessorSuccessResult(expectedResponse);
Expand All @@ -279,8 +278,6 @@ public void shouldReturnExecutionRevertErrorWithParsedABI() {
when(result.result()).thenReturn(processingResult);

verify(transactionSimulator).process(any(), any(), any(), mapperCaptor.capture(), any());
System.out.println(result);
System.out.println(expectedResponse);
assertThat(mapperCaptor.getValue().apply(mock(MutableWorldState.class), Optional.of(result)))
.isEqualTo(Optional.of(expectedResponse));

Expand Down

0 comments on commit 0783e44

Please sign in to comment.