Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Taam <[email protected]>
  • Loading branch information
matkt committed Jan 16, 2025
1 parent 9b0d3f4 commit 7b2073f
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,18 @@ private static FlatTrace.Context handleHalt(
traceFrameBuilder = currentContext.getBuilder();
}
traceFrameBuilder.error(
traceFrame.getExceptionalHaltReason().map(ExceptionalHaltReason::getDescription));
traceFrame
.getExceptionalHaltReason()
.map(
exceptionalHaltReason -> {
if (exceptionalHaltReason
.name()
.equals(ExceptionalHaltReason.INVALID_OPERATION.name())) {
return ExceptionalHaltReason.INVALID_OPERATION.getDescription();
} else {
return exceptionalHaltReason.getDescription();
}
}));
if (currentContext != null) {
final Action.Builder actionBuilder = traceFrameBuilder.getActionBuilder();
actionBuilder.value(Quantity.create(traceFrame.getValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void methodErrorWithDataShouldReturnErrorResponseWithDecodedData() throws
try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
assertThat(resp.code()).isEqualTo(200);
final JsonObject json = new JsonObject(resp.body().string());
testHelper.assertValidJsonRpcError(json, 1, -2, "Error with data: ABC", "abc");
testHelper.assertValidJsonRpcError(json, 1, -2, "ABC", "abc");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ public void shouldReturnErrorReasonWhenTransactionReverted() {
null, new JsonRpcError(RpcErrorType.REVERT_ERROR, executionRevertedReason));

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

final JsonRpcResponse actualResponse = method.response(request);

assertThat(actualResponse).usingRecursiveComparison().isEqualTo(expectedResponse);

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

@Test
Expand All @@ -359,14 +359,14 @@ public void shouldReturnABIDecodeErrorReasonWhenInvalidRevertReason() {
null, new JsonRpcError(RpcErrorType.REVERT_ERROR, invalidRevertReason));

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

final JsonRpcResponse actualResponse = method.response(request);

assertThat(actualResponse).usingRecursiveComparison().isEqualTo(expectedResponse);

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

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"response": {
"jsonrpc": "2.0",
"id": 4,
"error":{"code":-32009,"message":"blob gas price below current blob base fee"}
"error":{"code":-32009,"message":"tx max fee per blob gas less than block blob gas fee: address 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b blobGasFeeCap: 0 wei, blobBaseFee: 1 wei"}
},
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"response": {
"jsonrpc": "2.0",
"id": 4,
"error":{"code":-32000,"message":"Total blob gas too high"}
"error":{"code":-32000,"message":"total blob gas 917504 exceeds max blob gas per block 786432"}
},
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"response": {
"jsonrpc": "2.0",
"id": 4,
"error":{"code":-32602,"message":"Invalid transaction type"}
"error":{"code":-32602,"message":"transaction blob transactions must have a to address"}
},
"statusCode": 200
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"id": 4,
"error" : {
"code" : -32003,
"message" : "Intrinsic gas exceeds gas limit"
"message" : "intrinsic gas cost 21000 exceeds gas limit 0"
}
},
"statusCode": 200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
"id": 4,
"error": {
"code": -32004,
"message": "Upfront cost exceeds account balance"
"message": "transaction up-front cost 0x2fefd80000000000000 exceeds transaction sender account balance 0x340ab63a021fc9a9"
}
},
{
"jsonrpc": "2.0",
"id": 5,
"error": {
"code": -32004,
"message": "Upfront cost exceeds account balance"
"message": "transaction up-front cost 0x2fefd80000000000000 exceeds transaction sender account balance 0x340ab63a021fc9a9"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"id": 3,
"error" : {
"code" : -32004,
"message" : "Upfront cost exceeds account balance"
"message" : "transaction up-front cost 0x2 exceeds transaction sender account balance 0x1"
}
},
"statusCode": 200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"id": 4,
"error": {
"code": -32004,
"message": "Upfront cost exceeds account balance"
"message": "transaction up-front cost 0x340ab63a021fc9aa exceeds transaction sender account balance 0x340ab63a021fc9a9"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"id": 3,
"error": {
"code": -32000,
"message": "Transaction processing could not be completed due to an exception: INVALID_OPERATION"
"message": "invalid opcode: 0xfe"
}
},
"statusCode": 200
Expand Down

0 comments on commit 7b2073f

Please sign in to comment.