Skip to content

Commit

Permalink
5098 branch 3 update invalid address hash params (#7403)
Browse files Browse the repository at this point in the history
* 5098: Add RpcErrorTypes

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Modify InvalidJsonRpcParameters and InvalidJsonRpcRequestException, apply spotless

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Modify InvalidJsonRpcParameters and InvalidJsonRpcRequestException, apply spotless

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Add JsonRpcParameterException for later use

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Update locations for RpcErrorType.INVALID_ACCOUNTS_PARAMS

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Address review comments, apply spotless

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Update with changes from branch 1

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Update code to use RpcErrorType.INVALID_ADDRESS_HASH_PARAMS

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: apply spotless

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: apply spotless

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Update plugin-api gradle hash

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Add comment on INVALID_PARAMS_ERROR_CODE

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Apply spotless on latest changes

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Fix broken unit test

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 5098: Fix broken unit test

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

---------

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
  • Loading branch information
Matilda-Clerke authored Jul 31, 2024
1 parent 4e79c81 commit a844684
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.exception.InvalidJsonRpcParameters;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.BlockParameterOrBlockHash;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugAccountRangeAtResult;
import org.hyperledger.besu.ethereum.api.query.BlockWithMetadata;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
Expand Down Expand Up @@ -58,7 +60,13 @@ public String getName() {
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final BlockParameterOrBlockHash blockParameterOrBlockHash =
requestContext.getRequiredParameter(0, BlockParameterOrBlockHash.class);
final String addressHash = requestContext.getRequiredParameter(2, String.class);
final String addressHash;
try {
addressHash = requestContext.getRequiredParameter(2, String.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid address hash parameter", RpcErrorType.INVALID_ADDRESS_HASH_PARAMS, e);
}
final int maxResults = requestContext.getRequiredParameter(3, Integer.TYPE);

final Optional<Hash> blockHashOptional = hashFromParameter(blockParameterOrBlockHash);
Expand Down

0 comments on commit a844684

Please sign in to comment.