Skip to content

Commit

Permalink
Params should be single item of array type, not outer array of strings (
Browse files Browse the repository at this point in the history
#5037)

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
  • Loading branch information
siladu authored Feb 1, 2023
1 parent 7130923 commit 33ea293
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -52,10 +51,7 @@ public String getName() {
public JsonRpcResponse syncResponse(final JsonRpcRequestContext requestContext) {
engineCallListener.executionEngineCalled();

final List<String> remoteCapabilities =
Arrays.stream(requestContext.getRequest().getParams())
.map(String::valueOf)
.collect(Collectors.toList());
final String[] remoteCapabilities = requestContext.getRequiredParameter(0, String[].class);
final Object reqId = requestContext.getRequest().getId();

traceLambda(LOG, "received remote capabilities: {}", () -> remoteCapabilities);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ public void shouldNotReturnSelf() {
verify(engineCallListener, times(1)).executionEngineCalled();
}

private JsonRpcResponse resp(final List<String> params) {
private JsonRpcResponse resp(final List<String> capabilitiesParam) {
return method.response(
new JsonRpcRequestContext(
new JsonRpcRequest(
"2.0", ENGINE_EXCHANGE_CAPABILITIES.getMethodName(), params.toArray())));
"2.0",
ENGINE_EXCHANGE_CAPABILITIES.getMethodName(),
new Object[] {capabilitiesParam})));
}

@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 33ea293

Please sign in to comment.