Params should be single item of array type, not outer array of strings (#5037)

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
pull/5042/head
Simon Dudley 2 years ago committed by GitHub
parent 7130923517
commit 33ea29316d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeCapabilities.java
  2. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineExchangeCapabilitiesTest.java
  3. 2
      ethereum/referencetests/src/reference-test/external-resources

@ -24,7 +24,6 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.ExecutionEngin
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;
@ -52,10 +51,7 @@ public class EngineExchangeCapabilities extends ExecutionEngineJsonRpcMethod {
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);

@ -74,11 +74,13 @@ public class EngineExchangeCapabilitiesTest {
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")

@ -1 +1 @@
Subproject commit 638da7ca7b2ca371ebb33d7d7d2562981aafd9b2
Subproject commit 69c4c2a98dc8a712d4c6f5a817da4f21ff719006
Loading…
Cancel
Save