Skip to content

Commit

Permalink
Merge branch 'main' into zkbesu
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-10 committed Aug 20, 2024
2 parents 22fab53 + 0182252 commit 9dfb434
Show file tree
Hide file tree
Showing 160 changed files with 657 additions and 430 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

### Additions and Improvements
- Add 'inbound' field to admin_peers JSON-RPC Call [#7461](https://github.com/hyperledger/besu/pull/7461)
- Add pending block header to `TransactionEvaluationContext` plugin API [#7483](https://github.com/hyperledger/besu/pull/7483)

### Bug fixes
- Fix tracing in precompiled contracts when halting for out of gas [#7318](https://github.com/hyperledger/besu/issues/7318)
- Correctly release txpool save and restore lock in case of exceptions [#7473](https://github.com/hyperledger/besu/pull/7473)
- Fix for `eth_gasPrice` could not retrieve block error [#7482](https://github.com/hyperledger/besu/pull/7482)

## 24.8.0

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Having the following accounts is necessary for contributing code/issues to Besu.

### Other important information

* [Roadmap](https://wiki.hyperledger.org/display/BESU/Roadmap)
* [Roadmap](https://wiki.hyperledger.org/pages/viewpage.action?pageId=24781786)
* [Code of Conduct](https://wiki.hyperledger.org/display/BESU/Code+of+Conduct)
* [Governance](https://wiki.hyperledger.org/display/BESU/Governance)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.exception.InvalidJsonRpcParameters;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.BlockParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
Expand Down Expand Up @@ -71,7 +72,7 @@ private Optional<BlockHeader> determineBlockHeader(final JsonRpcRequestContext r
final Optional<BlockParameter> blockParameter;
try {
blockParameter = request.getOptionalParameter(0, BlockParameter.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid block parameter (index 0)", RpcErrorType.INVALID_BLOCK_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
Expand Down Expand Up @@ -71,7 +72,7 @@ private Optional<BlockHeader> determineBlockHeader(final JsonRpcRequestContext r
final Hash hash;
try {
hash = request.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid block hash parameter (index 0)", RpcErrorType.INVALID_BLOCK_HASH_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
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;
Expand Down Expand Up @@ -51,7 +52,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Address address;
try {
address = requestContext.getRequiredParameter(0, Address.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid address parameter (index 0)", RpcErrorType.INVALID_ADDRESS_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
Expand Down Expand Up @@ -53,14 +54,14 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Address address;
try {
address = requestContext.getRequiredParameter(0, Address.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid address parameter (index 0)", RpcErrorType.INVALID_ADDRESS_PARAMS, e);
}
final Boolean auth;
try {
auth = requestContext.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid auth parameter (index 1)", RpcErrorType.INVALID_PROPOSAL_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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.BlockParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
Expand Down Expand Up @@ -70,14 +71,14 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Optional<BlockParameter> startBlockParameter;
try {
startBlockParameter = requestContext.getOptionalParameter(0, BlockParameter.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid start block parameter (index 0)", RpcErrorType.INVALID_BLOCK_NUMBER_PARAMS, e);
}
final Optional<BlockParameter> endBlockParameter;
try {
endBlockParameter = requestContext.getOptionalParameter(1, BlockParameter.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid end block parameter (index 1)", RpcErrorType.INVALID_BLOCK_NUMBER_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
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;
Expand Down Expand Up @@ -55,7 +56,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Address validatorAddress;
try {
validatorAddress = requestContext.getRequiredParameter(0, Address.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid validator address parameter (index 0)", RpcErrorType.INVALID_ADDRESS_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
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;
Expand Down Expand Up @@ -66,7 +67,7 @@ private Object blockResult(final JsonRpcRequestContext request) {
final Hash hash;
try {
hash = request.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid block hash parameter (index 0)", RpcErrorType.INVALID_BLOCK_HASH_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.AbstractBlockParameterMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.BlockParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.core.BlockHeader;
Expand Down Expand Up @@ -54,7 +55,7 @@ public IbftGetValidatorsByBlockNumber(
protected BlockParameter blockParameter(final JsonRpcRequestContext request) {
try {
return request.getRequiredParameter(0, BlockParameter.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid block parameter (index 0)", RpcErrorType.INVALID_BLOCK_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
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;
Expand Down Expand Up @@ -56,14 +57,14 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Address validatorAddress;
try {
validatorAddress = requestContext.getRequiredParameter(0, Address.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid address parameter (index 0)", RpcErrorType.INVALID_ADDRESS_PARAMS, e);
}
final Boolean add;
try {
add = requestContext.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid vote type parameter (index 1)", RpcErrorType.INVALID_VOTE_TYPE_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
Expand Down Expand Up @@ -53,7 +54,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Address validatorAddress;
try {
validatorAddress = requestContext.getRequiredParameter(0, Address.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid validator address parameter (index 0)",
RpcErrorType.INVALID_ADDRESS_PARAMS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
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;
Expand Down Expand Up @@ -67,7 +68,7 @@ private Object blockResult(final JsonRpcRequestContext request) {
final Hash hash;
try {
hash = request.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid block hash parameter (index 0)", RpcErrorType.INVALID_BLOCK_HASH_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.AbstractBlockParameterMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.BlockParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.core.BlockHeader;
Expand Down Expand Up @@ -54,7 +55,7 @@ public QbftGetValidatorsByBlockNumber(
protected BlockParameter blockParameter(final JsonRpcRequestContext request) {
try {
return request.getRequiredParameter(0, BlockParameter.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid block parameter (index 0)", RpcErrorType.INVALID_BLOCK_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
Expand Down Expand Up @@ -54,7 +55,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Address validatorAddress;
try {
validatorAddress = requestContext.getRequiredParameter(0, Address.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid validator address parameter (index 0)",
RpcErrorType.INVALID_ADDRESS_PARAMS,
Expand All @@ -63,7 +64,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Boolean add;
try {
add = requestContext.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid vote type parameter (index 1)", RpcErrorType.INVALID_VOTE_TYPE_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.exception.InvalidJsonRpcParameters;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.AbstractBlockParameterMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.BlockParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
Expand Down Expand Up @@ -60,7 +61,7 @@ public String getName() {
protected BlockParameter blockParameter(final JsonRpcRequestContext request) {
try {
return request.getRequiredParameter(0, BlockParameter.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
} catch (JsonRpcParameterException e) {
throw new InvalidJsonRpcParameters(
"Invalid block parameter (index 0)", RpcErrorType.INVALID_BLOCK_PARAMS, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.hyperledger.besu.ethereum.api.jsonrpc.internal.exception.InvalidJsonRpcRequestException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter.JsonRpcParameterException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;

import java.util.Arrays;
Expand Down Expand Up @@ -132,15 +133,18 @@ public int hashCode() {
return Objects.hash(id, method, Arrays.hashCode(params), version, isNotification);
}

public <T> T getRequiredParameter(final int index, final Class<T> paramClass) {
public <T> T getRequiredParameter(final int index, final Class<T> paramClass)
throws JsonRpcParameterException {
return parameterAccessor.required(params, index, paramClass);
}

public <T> Optional<T> getOptionalParameter(final int index, final Class<T> paramClass) {
public <T> Optional<T> getOptionalParameter(final int index, final Class<T> paramClass)
throws JsonRpcParameterException {
return parameterAccessor.optional(params, index, paramClass);
}

public <T> Optional<List<T>> getOptionalList(final int index, final Class<T> paramClass) {
public <T> Optional<List<T>> getOptionalList(final int index, final Class<T> paramClass)
throws JsonRpcParameterException {
return parameterAccessor.optionalList(params, index, paramClass);
}

Expand Down
Loading

0 comments on commit 9dfb434

Please sign in to comment.