Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5098 branch 7 update invalid blob gas used params #7408

Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e41cf31
5098: Add RpcErrorTypes
Matilda-Clerke Jul 29, 2024
147d580
5098: Modify InvalidJsonRpcParameters and InvalidJsonRpcRequestExcept…
Matilda-Clerke Jul 29, 2024
8da4815
5098: Modify InvalidJsonRpcParameters and InvalidJsonRpcRequestExcept…
Matilda-Clerke Jul 30, 2024
8ca34d7
5098: Add JsonRpcParameterException for later use
Matilda-Clerke Jul 30, 2024
5b5631a
5098: Update locations for RpcErrorType.INVALID_ACCOUNTS_PARAMS
Matilda-Clerke Jul 30, 2024
950117b
5098: Address review comments, apply spotless
Matilda-Clerke Jul 30, 2024
0004fa2
Merge branch 'refs/heads/5098-branch-1-add-rpc-error-types' into 5098…
Matilda-Clerke Jul 30, 2024
7fc2c2b
5098: Update with changes from branch 1
Matilda-Clerke Jul 30, 2024
b70da06
Merge branch 'main' into 5098-branch-1-add-rpc-error-types
Matilda-Clerke Jul 30, 2024
a54a5aa
5098: Update code to use RpcErrorType.INVALID_ADDRESS_HASH_PARAMS
Matilda-Clerke Jul 30, 2024
5acb2d7
5098: apply spotless
Matilda-Clerke Jul 30, 2024
aba28d4
Merge branch 'refs/heads/5098-branch-2-update-invalid-accounts-params…
Matilda-Clerke Jul 30, 2024
afb8860
5098: apply spotless
Matilda-Clerke Jul 30, 2024
0d4a9b3
5098: Update plugin-api gradle hash
Matilda-Clerke Jul 30, 2024
ad7d7b3
Merge branch 'refs/heads/5098-branch-1-add-rpc-error-types' into 5098…
Matilda-Clerke Jul 30, 2024
8aac343
Merge branch 'refs/heads/5098-branch-2-update-invalid-accounts-params…
Matilda-Clerke Jul 30, 2024
9ba006b
5098: Add comment on INVALID_PARAMS_ERROR_CODE
Matilda-Clerke Jul 30, 2024
531c530
5098: Apply spotless on latest changes
Matilda-Clerke Jul 30, 2024
e946b06
Merge branch 'main' into 5098-branch-1-add-rpc-error-types
Matilda-Clerke Jul 30, 2024
b0dc1a8
Merge branch 'refs/heads/5098-branch-1-add-rpc-error-types' into 5098…
Matilda-Clerke Jul 30, 2024
cc6bdf3
Merge branch 'refs/heads/5098-branch-2-update-invalid-accounts-params…
Matilda-Clerke Jul 30, 2024
983ac77
Merge branch 'main' into 5098-branch-2-update-invalid-accounts-params
Matilda-Clerke Jul 30, 2024
6fc67ee
5098: Update code to use RpcErrorType.INVALID_ADDRESS_PARAMS
Matilda-Clerke Jul 30, 2024
728ab2c
5098: Fix broken unit test
Matilda-Clerke Jul 30, 2024
6480308
Merge remote-tracking branch 'origin/5098-branch-2-update-invalid-acc…
Matilda-Clerke Jul 30, 2024
8b72fbc
Merge branch 'refs/heads/5098-branch-2-update-invalid-accounts-params…
Matilda-Clerke Jul 30, 2024
a60966c
Merge branch 'refs/heads/5098-branch-3-update-invalid-address-hash-pa…
Matilda-Clerke Jul 30, 2024
0fb6919
5098: Fix broken unit test
Matilda-Clerke Jul 31, 2024
e967e32
Merge branch 'refs/heads/5098-branch-2-update-invalid-accounts-params…
Matilda-Clerke Jul 31, 2024
32db32b
Merge branch 'refs/heads/5098-branch-3-update-invalid-address-hash-pa…
Matilda-Clerke Jul 31, 2024
9f53648
5098: Update with usage of RpcErrorType.INVALID_AUTH_PARAMS
Matilda-Clerke Jul 31, 2024
3cfe6dd
5098: Update with usage of RpcErrorType.INVALID_BLOB_COUNT
Matilda-Clerke Jul 31, 2024
7414843
5098: Update with usage of RpcErrorType.INVALID_BLOB_GAS_USED_PARAMS
Matilda-Clerke Jul 31, 2024
73c45b0
Merge branch 'main' into 5098-branch-3-update-invalid-address-hash-pa…
Matilda-Clerke Jul 31, 2024
670c6fa
Merge branch 'main' into 5098-branch-3-update-invalid-address-hash-pa…
Matilda-Clerke Jul 31, 2024
724dd14
Merge branch 'refs/heads/5098-branch-3-update-invalid-address-hash-pa…
Matilda-Clerke Jul 31, 2024
ab04552
Merge branch 'refs/heads/5098-branch-4-update-invalid-address-params'…
Matilda-Clerke Jul 31, 2024
8e1a740
Merge branch 'refs/heads/5098-branch-5-update-invalid-auth-params' in…
Matilda-Clerke Jul 31, 2024
71cad41
Merge branch 'refs/heads/5098-branch-6-update-invalid-blob-count' int…
Matilda-Clerke Jul 31, 2024
4fef179
Merge branch 'main' into 5098-branch-4-update-invalid-address-params
macfarla Jul 31, 2024
bd6b7d3
5098: Add index to exception messages
Matilda-Clerke Jul 31, 2024
eda22ac
5098: apoply spotless
Matilda-Clerke Jul 31, 2024
6ce053b
5098: Update BaseJsonRpcProcessor to utilise RpcErrorType from Invali…
Matilda-Clerke Aug 1, 2024
943426b
Merge branch 'refs/heads/5098-branch-4-update-invalid-address-params'…
Matilda-Clerke Aug 1, 2024
d441737
5098: Include parameter index in INVALID_AUTH_PARAMS
Matilda-Clerke Aug 1, 2024
11b4839
Merge branch 'refs/heads/5098-branch-5-update-invalid-auth-params' in…
Matilda-Clerke Aug 1, 2024
3459365
Merge branch 'refs/heads/5098-branch-6-update-invalid-blob-count' int…
Matilda-Clerke Aug 1, 2024
0b3d153
Merge branch 'main' into 5098-branch-4-update-invalid-address-params
Matilda-Clerke Aug 1, 2024
6e106de
Merge branch 'main' into 5098-branch-4-update-invalid-address-params
Matilda-Clerke Aug 1, 2024
625b75f
Merge branch 'main' into 5098-branch-4-update-invalid-address-params
Matilda-Clerke Aug 1, 2024
373d5c9
Merge branch 'refs/heads/5098-branch-4-update-invalid-address-params'…
Matilda-Clerke Aug 1, 2024
876e74d
Merge branch 'refs/heads/5098-branch-5-update-invalid-auth-params' in…
Matilda-Clerke Aug 1, 2024
9e2ff60
Merge branch 'refs/heads/5098-branch-6-update-invalid-blob-count' int…
Matilda-Clerke Aug 1, 2024
0c06cac
Merge branch 'main' into 5098-branch-5-update-invalid-auth-params
Matilda-Clerke Aug 2, 2024
89a9fb4
Merge branch 'refs/heads/5098-branch-5-update-invalid-auth-params' in…
Matilda-Clerke Aug 2, 2024
42cce8f
Merge branch 'refs/heads/5098-branch-6-update-invalid-blob-count' int…
Matilda-Clerke Aug 2, 2024
792f328
5098: Rename INVALID_AUTH_PARAMS to INVALID_PROPOSAL_PARAMS
Matilda-Clerke Aug 2, 2024
e840fea
Merge branch 'refs/heads/5098-branch-5-update-invalid-auth-params' in…
Matilda-Clerke Aug 2, 2024
e4c663a
Merge branch 'refs/heads/5098-branch-6-update-invalid-blob-count' int…
Matilda-Clerke Aug 2, 2024
437c5a2
Merge branch 'main' into 5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Aug 11, 2024
8f2148e
Merge branch 'main' into 5098-branch-7-update-invalid-blob-gas-used-p…
macfarla Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ protected ValidationResult<RpcErrorType> validateBlobs(
if (header.getBlobGasUsed().isPresent() && maybeVersionedHashes.isPresent()) {
if (!validateBlobGasUsed(header, maybeVersionedHashes.get(), protocolSpec)) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS,
RpcErrorType.INVALID_BLOB_GAS_USED_PARAMS,
"Payload BlobGasUsed does not match calculated BlobGasUsed");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected ValidationResult<RpcErrorType> validateParameters(
final Optional<String> maybeBeaconBlockRootParam) {
if (payloadParameter.getBlobGasUsed() != null) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS, "non-null BlobGasUsed pre-cancun");
RpcErrorType.INVALID_BLOB_GAS_USED_PARAMS, "Missing blob gas used field");
}
if (payloadParameter.getExcessBlobGas() != null) {
return ValidationResult.invalid(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ protected ValidationResult<RpcErrorType> validateParameters(
final EnginePayloadParameter payloadParameter,
final Optional<List<String>> maybeVersionedHashParam,
final Optional<String> maybeBeaconBlockRootParam) {
if (payloadParameter.getBlobGasUsed() == null || payloadParameter.getExcessBlobGas() == null) {
if (payloadParameter.getBlobGasUsed() == null) {
return ValidationResult.invalid(
RpcErrorType.INVALID_BLOB_GAS_USED_PARAMS, "Missing blob gas used field");
} else if (payloadParameter.getExcessBlobGas() == null) {
return ValidationResult.invalid(RpcErrorType.INVALID_PARAMS, "Missing blob gas fields");
} else if (maybeVersionedHashParam == null || maybeVersionedHashParam.isEmpty()) {
return ValidationResult.invalid(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ protected ValidationResult<RpcErrorType> validateParameters(
final EnginePayloadParameter payloadParameter,
final Optional<List<String>> maybeVersionedHashParam,
final Optional<String> maybeBeaconBlockRootParam) {
if (payloadParameter.getBlobGasUsed() == null || payloadParameter.getExcessBlobGas() == null) {
return ValidationResult.invalid(RpcErrorType.INVALID_PARAMS, "Missing blob gas fields");
if (payloadParameter.getBlobGasUsed() == null) {
return ValidationResult.invalid(
RpcErrorType.INVALID_BLOB_GAS_USED_PARAMS, "Missing blob gas used field");
} else if (payloadParameter.getExcessBlobGas() == null) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS, "non-null ExcessBlobGas pre-cancun");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there not a specific error code for this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is, but it will be coming in a later PR as I'm updating them in alphabetical order to ensure I don't miss any. This is the 7th PR in the series, breaking apart #7389 which is too gigantic to review.

} else if (maybeVersionedHashParam == null || maybeVersionedHashParam.isEmpty()) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS, "Missing versioned hashes field");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.ExecutionEngineJsonRpcMethod.EngineStatus.INVALID;
import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalParameterTestFixture.WITHDRAWAL_PARAM_1;
import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType.INVALID_BLOB_GAS_USED_PARAMS;
import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType.INVALID_PARAMS;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -149,8 +150,8 @@ public void shouldValidateBlobGasUsedCorrectly() {
var resp =
resp(mockEnginePayload(blockHeader, Collections.emptyList(), List.of(), null, null, null));
final JsonRpcError jsonRpcError = fromErrorResp(resp);
assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode());
assertThat(jsonRpcError.getData()).isEqualTo("non-null BlobGasUsed pre-cancun");
assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_BLOB_GAS_USED_PARAMS.getCode());
assertThat(jsonRpcError.getData()).isEqualTo("Missing blob gas used field");
verify(engineCallListener, times(1)).executionEngineCalled();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void shouldValidateBlobGasUsedCorrectly() {

final JsonRpcError jsonRpcError = fromErrorResp(resp);
assertThat(jsonRpcError.getCode()).isEqualTo(INVALID_PARAMS.getCode());
assertThat(jsonRpcError.getData()).isEqualTo("Missing blob gas fields");
assertThat(jsonRpcError.getData()).isEqualTo("Missing blob gas used field");
verify(engineCallListener, times(1)).executionEngineCalled();
}

Expand Down
Loading