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 22 update more invalid params #7472

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 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
c3e8d22
5098: Update with usage of RpcErrorType.INVALID_BLOCK_PARAMS
Matilda-Clerke Jul 31, 2024
73c45b0
Merge branch 'main' into 5098-branch-3-update-invalid-address-hash-pa…
Matilda-Clerke Jul 31, 2024
75dff8f
5098: Update with usage of RpcErrorType.INVALID_BLOCK_PARAMS
Matilda-Clerke Jul 31, 2024
dd6c10b
5098: Update with usage of RpcErrorType.INVALID_BLOCK_PARAMS
Matilda-Clerke Jul 31, 2024
7d41fac
5098: Update with usage of RpcErrorType.INVALID_BLOCK_COUNT_PARAMS
Matilda-Clerke Jul 31, 2024
e316045
5098: Fix broken integration test
Matilda-Clerke Jul 31, 2024
d7a7dba
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
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
25c68b8
Merge branch 'refs/heads/5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Jul 31, 2024
167a416
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
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
f46c23a
Merge branch 'refs/heads/5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Aug 1, 2024
93594a9
5098: Include parameter index in INVALID_BLOCK_PARAMS
Matilda-Clerke Aug 1, 2024
d8f6f3e
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
Matilda-Clerke Aug 1, 2024
f2fb791
5098: Include parameter index in INVALID_BLOCK_COUNT_PARAMS
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
85eda97
Merge branch 'refs/heads/5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Aug 1, 2024
68b3d29
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
Matilda-Clerke Aug 1, 2024
0c06cac
Merge branch 'main' into 5098-branch-5-update-invalid-auth-params
Matilda-Clerke Aug 2, 2024
005640e
5098: Fix broken integration test
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
a0e0e43
Merge branch 'refs/heads/5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Aug 2, 2024
94c319d
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
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
5d7e9c9
Merge branch 'refs/heads/5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Aug 2, 2024
355a02a
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
Matilda-Clerke Aug 2, 2024
ff2db15
5098: apply spotless
Matilda-Clerke Aug 2, 2024
07b758f
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
Matilda-Clerke Aug 2, 2024
74616be
5098: Update INVALID_BLOCK_HASH_PARAMS locations
Matilda-Clerke Aug 2, 2024
def78c3
Merge branch 'main' into 5098-branch-11-update-invalid-block-hash-params
Matilda-Clerke Aug 2, 2024
437c5a2
Merge branch 'main' into 5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Aug 11, 2024
2b68b15
Merge branch 'refs/heads/5098-branch-7-update-invalid-blob-gas-used-p…
Matilda-Clerke Aug 11, 2024
bd85d0e
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
Matilda-Clerke Aug 11, 2024
e393c3b
Merge branch 'refs/heads/5098-branch-9-update-invalid-block-count-par…
Matilda-Clerke Aug 11, 2024
e2d2f4c
5098: Fix broken unit test
Matilda-Clerke Aug 11, 2024
98b48b0
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
Matilda-Clerke Aug 11, 2024
f3fc8bd
Merge branch 'refs/heads/5098-branch-9-update-invalid-block-count-par…
Matilda-Clerke Aug 11, 2024
7378dcf
5098: apply spotless
Matilda-Clerke Aug 11, 2024
ae1a45f
5098: Update RpcErrorType.INVALID_BLOCK_INDEX
Matilda-Clerke Aug 12, 2024
c562abf
Merge branch 'main' into 5098-branch-8-update-invalid-block-params
Matilda-Clerke Aug 12, 2024
f5bba2f
5098: Update RpcErrorType.INVALID_BLOCK_NUMBER
Matilda-Clerke Aug 12, 2024
1135c0f
5098: apply spotless
Matilda-Clerke Aug 12, 2024
cce32cc
5098: Fix broken tests
Matilda-Clerke Aug 12, 2024
16c7d9d
Merge remote-tracking branch 'origin/5098-branch-8-update-invalid-blo…
Matilda-Clerke Aug 12, 2024
9758f31
Merge branch 'refs/heads/5098-branch-8-update-invalid-block-params' i…
Matilda-Clerke Aug 12, 2024
928a2fa
Merge branch 'refs/heads/5098-branch-9-update-invalid-block-count-par…
Matilda-Clerke Aug 12, 2024
d4ea353
Merge branch 'refs/heads/5098-branch-11-update-invalid-block-hash-par…
Matilda-Clerke Aug 12, 2024
7c14379
Merge branch 'main' into 5098-branch-9-update-invalid-block-count-params
Matilda-Clerke Aug 12, 2024
539c8cc
Merge branch 'refs/heads/5098-branch-9-update-invalid-block-count-par…
Matilda-Clerke Aug 12, 2024
bfda0c0
Merge branch 'refs/heads/5098-branch-11-update-invalid-block-hash-par…
Matilda-Clerke Aug 12, 2024
bd3f5e9
5098: Update RpcErrorType.INVALID_CALL_PARAMS
Matilda-Clerke Aug 12, 2024
2cb1cd4
Merge branch 'main' into 5098-branch-11-update-invalid-block-hash-params
macfarla Aug 12, 2024
1f7a455
5098: Update RpcErrorType.INVALID_CONSOLIDATION_REQUEST_PARAMS
Matilda-Clerke Aug 12, 2024
bfe75b3
5098: Update RpcErrorType.INVALID_CREATE_PRIVACY_GROUP_PARAMS
Matilda-Clerke Aug 12, 2024
bc1e563
5098: Fix broken test
Matilda-Clerke Aug 12, 2024
4c6654a
Merge remote-tracking branch 'origin/5098-branch-11-update-invalid-bl…
Matilda-Clerke Aug 12, 2024
bb7e492
Merge branch 'refs/heads/5098-branch-11-update-invalid-block-hash-par…
Matilda-Clerke Aug 12, 2024
a50503c
Merge branch 'refs/heads/5098-branch-12-update-invalid-block-index-an…
Matilda-Clerke Aug 12, 2024
34a8718
5098: Update RpcErrorType.INVALID_DATA_PARAMS
Matilda-Clerke Aug 12, 2024
3642beb
5098: Update RpcErrorType.INVALID_DEPOSIT_REQUEST_PARAMS
Matilda-Clerke Aug 12, 2024
3cf1d8c
5098: Update RpcErrorType.INVALID_ENGINE_EXCHANGE_TRANSITION_CONFIGUR…
Matilda-Clerke Aug 12, 2024
baf9ac0
5098: Update RpcErrorType.INVALID_ENGINE_FORKCHOICE_UPDATED_PARAMS
Matilda-Clerke Aug 12, 2024
07664dc
5098: Update RpcErrorType.INVALID_ENGINE_PAYLOAD_ATTRIBUTES_PARAMS
Matilda-Clerke Aug 12, 2024
ebe03d7
5098: Update RpcErrorType.INVALID_ENGINE_PAYLOAD_PARAMS
Matilda-Clerke Aug 12, 2024
7e873e7
5098: Update RpcErrorType.INVALID_ENGINE_PREPARE_PAYLOAD_PARAMS
Matilda-Clerke Aug 12, 2024
3d6824e
5098: Apply spotless
Matilda-Clerke Aug 12, 2024
20b5a08
Merge branch 'main' into 5098-branch-15-update-remaining-invalid-engi…
Matilda-Clerke Aug 13, 2024
a70a150
5098: Update RpcErrorType.INVALID_ENODE_PARAMS
Matilda-Clerke Aug 13, 2024
2db0f4b
5098: Update RpcErrorType.INVALID_EXCESS_BLOB_GAS_PARAMS
Matilda-Clerke Aug 13, 2024
d15a65e
5098: Apply spotless
Matilda-Clerke Aug 13, 2024
36a0819
5098: Update RpcErrorType.INVALID_EXTRA_DATA_PARAMS
Matilda-Clerke Aug 14, 2024
509c15e
5098: Update RpcErrorType.INVALID_FILTER_PARAMS
Matilda-Clerke Aug 14, 2024
086a1b9
5098: Apply spotless
Matilda-Clerke Aug 14, 2024
a6efed6
5098: Fix broken tests
Matilda-Clerke Aug 14, 2024
597670e
5098: Update several RpcErrorTypes
Matilda-Clerke Aug 14, 2024
fd16783
5098: Apply spotless
Matilda-Clerke Aug 14, 2024
9f4c7cf
5098: Hopefully fix broken integration test
Matilda-Clerke Aug 14, 2024
d2ed77d
5098: Hopefully fix broken integration test
Matilda-Clerke Aug 14, 2024
667b03a
Merge branch 'main' into 5098-branch-16-update-invalid-enode-and-exce…
Matilda-Clerke Aug 14, 2024
7f04e66
Merge branch 'main' into 5098-branch-16-update-invalid-enode-and-exce…
Matilda-Clerke Aug 14, 2024
eca3323
5098: Update several more RpcErrorTypes
Matilda-Clerke Aug 14, 2024
df64162
5098: Apply spotless
Matilda-Clerke Aug 14, 2024
e87ebe6
Merge branch 'main' into 5098-branch-16-update-invalid-enode-and-exce…
Matilda-Clerke Aug 14, 2024
ae5b11f
Merge branch 'refs/heads/5098-branch-16-update-invalid-enode-and-exce…
Matilda-Clerke Aug 14, 2024
70218ef
Merge branch 'refs/heads/5098-branch-17-update-extra-data-and-filter-…
Matilda-Clerke Aug 14, 2024
8da7f70
Merge branch 'refs/heads/5098-branch-18-update-more-invalid-params' i…
Matilda-Clerke Aug 14, 2024
c53e5be
5098: Update RpcErrorType.INVALID_PARAM_COUNT
Matilda-Clerke Aug 15, 2024
a7e8896
5098: Update RpcErrorType.INVALID_PAYLOAD_ID_PARAMS
Matilda-Clerke Aug 15, 2024
feadf68
5098: Update RpcErrorType.INVALID_PENDING_TRANSACTIONS_PARAMS
Matilda-Clerke Aug 15, 2024
e007317
5098: Update RpcErrorType.INVAlID_PLUGIN_NAME_PARAMS
Matilda-Clerke Aug 15, 2024
4a30816
5098: Apply spotless
Matilda-Clerke Aug 15, 2024
74da26b
5098: Fix broken tests
Matilda-Clerke Aug 15, 2024
47d5a4d
5098: Update RpcErrorTypes
Matilda-Clerke Aug 15, 2024
870ecda
5098: Fix broken tests
Matilda-Clerke Aug 15, 2024
c124f3b
Merge branch 'main' into 5098-branch-21-update-more-invalid-params
Matilda-Clerke Aug 16, 2024
afc9baa
5098: Update several RpcErrorTypes
Matilda-Clerke Aug 16, 2024
71c9523
5098: Apply spotless
Matilda-Clerke Aug 16, 2024
c7c6c51
Merge branch 'refs/heads/5098-branch-21-update-more-invalid-params' i…
Matilda-Clerke Aug 16, 2024
31fbb3e
5098: Fix broken test
Matilda-Clerke Aug 16, 2024
32567cc
5098: Update remaining RpcErrorTypes
Matilda-Clerke Aug 16, 2024
b7fb9f4
5098: Apply spotless
Matilda-Clerke Aug 16, 2024
b80a53c
Merge branch 'main' into 5098-branch-22-update-more-invalid-params
Matilda-Clerke Aug 16, 2024
7096a3b
5098: Update failing tests
Matilda-Clerke Aug 16, 2024
c099a5b
5098: Fix failing tests
Matilda-Clerke Aug 16, 2024
67f3d0f
Merge branch 'main' into 5098-branch-22-update-more-invalid-params
Matilda-Clerke Aug 18, 2024
0bb0e6c
5098: Fix failing tests
Matilda-Clerke Aug 19, 2024
a3407f6
Merge remote-tracking branch 'origin/5098-branch-22-update-more-inval…
Matilda-Clerke Aug 19, 2024
4e606d5
5098: Fix failing tests
Matilda-Clerke Aug 19, 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 @@ -60,7 +60,13 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
throw new InvalidJsonRpcParameters(
"Invalid address parameter (index 0)", RpcErrorType.INVALID_ADDRESS_PARAMS, e);
}
final Boolean add = requestContext.getRequiredParameter(1, Boolean.class);
final Boolean add;
try {
add = requestContext.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid vote type parameter (index 1)", RpcErrorType.INVALID_VOTE_TYPE_PARAMS, e);
}
LOG.trace(
"Received RPC rpcName={} voteType={} address={}",
getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void exceptionWhenNoParamsSupplied() {
public void exceptionWhenNoAuthSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams(Address.fromHexString("1"))))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Missing required json rpc parameter at index 1");
.hasMessage("Invalid vote type parameter (index 1)");
}

@Test
Expand All @@ -77,7 +77,7 @@ public void exceptionWhenNoAddressSupplied() {
public void exceptionWhenInvalidBoolParameterSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams(Address.fromHexString("1"), "c")))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessageContaining("Invalid json rpc parameter at index 1");
.hasMessageContaining("Invalid vote type parameter (index 1)");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
RpcErrorType.INVALID_ADDRESS_PARAMS,
e);
}
final Boolean add = requestContext.getRequiredParameter(1, Boolean.class);
final Boolean add;
try {
add = requestContext.getRequiredParameter(1, Boolean.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid vote type parameter (index 1)", RpcErrorType.INVALID_VOTE_TYPE_PARAMS, e);
}
LOG.trace(
"Received RPC rpcName={} voteType={} address={}",
getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void exceptionWhenNoParamsSupplied() {
public void exceptionWhenNoAuthSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams(Address.fromHexString("1"))))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessage("Missing required json rpc parameter at index 1");
.hasMessage("Invalid vote type parameter (index 1)");
}

@Test
Expand All @@ -79,7 +79,7 @@ public void exceptionWhenNoAddressSupplied() {
public void exceptionWhenInvalidBoolParameterSupplied() {
assertThatThrownBy(() -> method.response(requestWithParams(Address.fromHexString("1"), "c")))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessageContaining("Invalid json rpc parameter at index 1");
.hasMessageContaining("Invalid vote type parameter (index 1)");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ protected BlockParameterOrBlockHash blockParameterOrBlockHash(
@Override
protected Object resultByBlockHash(
final JsonRpcRequestContext requestContext, final Hash blockHash) {
final Integer txIndex = requestContext.getRequiredParameter(1, Integer.class);
final Integer txIndex;
try {
txIndex = requestContext.getRequiredParameter(1, Integer.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction index parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_INDEX_PARAMS,
e);
}
final Address address;
try {
address = requestContext.getRequiredParameter(2, Address.class);
Expand All @@ -97,7 +105,7 @@ protected Object resultByBlockHash(
List<TransactionWithMetadata> transactions = block.get().getTransactions();
if (transactions.isEmpty() || txIndex < 0 || txIndex > block.get().getTransactions().size()) {
return new JsonRpcErrorResponse(
requestContext.getRequest().getId(), RpcErrorType.INVALID_PARAMS);
requestContext.getRequest().getId(), RpcErrorType.INVALID_TRANSACTION_PARAMS);
}

return Tracer.processTracing(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod;
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.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.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
Expand All @@ -38,7 +40,15 @@ public String getName() {

@Override
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Hash txHash = requestContext.getRequiredParameter(0, Hash.class);
final Hash txHash;
try {
txHash = requestContext.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction hash parameter (index 0)",
RpcErrorType.INVALID_TRANSACTION_HASH_PARAMS,
e);
}

return blockchainQueries
.transactionByHash(txHash)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
throw new InvalidJsonRpcParameters(
"Invalid block hash parameter (index 0)", RpcErrorType.INVALID_BLOCK_HASH_PARAMS, e);
}
final Optional<TransactionTraceParams> transactionTraceParams =
requestContext.getOptionalParameter(1, TransactionTraceParams.class);
final Optional<TransactionTraceParams> transactionTraceParams;
try {
transactionTraceParams = requestContext.getOptionalParameter(1, TransactionTraceParams.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 1)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}

final BadBlockManager badBlockManager = protocolContext.getBadBlockManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,15 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
throw new InvalidJsonRpcParameters(
"Invalid block hash parameter (index 0)", RpcErrorType.INVALID_BLOCK_HASH_PARAMS, e);
}
final Optional<TransactionTraceParams> transactionTraceParams =
requestContext.getOptionalParameter(1, TransactionTraceParams.class);
final Optional<TransactionTraceParams> transactionTraceParams;
try {
transactionTraceParams = requestContext.getOptionalParameter(1, TransactionTraceParams.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 1)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}

return blockchainQueries
.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
throw new InvalidJsonRpcParameters(
"Invalid block or block hash parameter (index 0)", RpcErrorType.INVALID_BLOCK_PARAMS, e);
}
final int transactionIndex = requestContext.getRequiredParameter(1, Integer.class);
final int transactionIndex;
try {
transactionIndex = requestContext.getRequiredParameter(1, Integer.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction index parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_INDEX_PARAMS,
e);
}
final Address accountAddress;
try {
accountAddress = requestContext.getRequiredParameter(2, Address.class);
Expand All @@ -92,7 +100,13 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
throw new InvalidJsonRpcParameters(
"Invalid data start hash parameter (index 3)", RpcErrorType.INVALID_DATA_HASH_PARAMS, e);
}
final int limit = requestContext.getRequiredParameter(4, Integer.class);
final int limit;
try {
limit = requestContext.getRequiredParameter(4, Integer.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid limit parameter (index 4)", RpcErrorType.INVALID_TRANSACTION_LIMIT_PARAMS, e);
}

final Optional<Hash> blockHashOptional = hashFromParameter(blockParameterOrBlockHash);
if (blockHashOptional.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,19 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
throw new InvalidJsonRpcParameters(
"Invalid block params (index 0)", RpcErrorType.INVALID_BLOCK_PARAMS, e);
}
final TraceOptions traceOptions =
requestContext
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
final TraceOptions traceOptions;
try {
traceOptions =
requestContext
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}

if (this.blockchainQueries.blockByHash(block.getHeader().getParentHash()).isPresent()) {
final Collection<DebugTraceTransactionResult> results =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,19 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
throw new InvalidJsonRpcParameters(
"Invalid block hash parameter (index 0)", RpcErrorType.INVALID_BLOCK_HASH_PARAMS, e);
}
final TraceOptions traceOptions =
requestContext
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
final TraceOptions traceOptions;
try {
traceOptions =
requestContext
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 1)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Invalid transaction trace parameters (index 1)",
"Invalid transaction trace parameter (index 1)",

RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}

final Collection<DebugTraceTransactionResult> results =
Tracer.processTracing(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,19 @@ protected BlockParameter blockParameter(final JsonRpcRequestContext request) {
protected Object resultByBlockNumber(
final JsonRpcRequestContext request, final long blockNumber) {
final Optional<Hash> blockHash = getBlockchainQueries().getBlockHashByNumber(blockNumber);
final TraceOptions traceOptions =
request
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
final TraceOptions traceOptions;
try {
traceOptions =
request
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}

return blockHash
.flatMap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,17 @@ public String getName() {

@Override
protected TraceOptions getTraceOptions(final JsonRpcRequestContext requestContext) {
return requestContext
.getOptionalParameter(2, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
try {
return requestContext
.getOptionalParameter(2, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameters (index 2)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Invalid transaction trace parameters (index 2)",
"Invalid transaction trace parameter (index 2)",

RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod;
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.TransactionTraceParams;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.Tracer;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTracer;
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.DebugTraceTransactionResult;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata;
Expand All @@ -48,15 +50,31 @@ public String getName() {

@Override
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Hash hash = requestContext.getRequiredParameter(0, Hash.class);
final Hash hash;
try {
hash = requestContext.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction hash parameter (index 0)",
RpcErrorType.INVALID_TRANSACTION_HASH_PARAMS,
e);
}
final Optional<TransactionWithMetadata> transactionWithMetadata =
blockchain.transactionByHash(hash);
if (transactionWithMetadata.isPresent()) {
final TraceOptions traceOptions =
requestContext
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
final TraceOptions traceOptions;
try {
traceOptions =
requestContext
.getOptionalParameter(1, TransactionTraceParams.class)
.map(TransactionTraceParams::traceOptions)
.orElse(TraceOptions.DEFAULT);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction trace parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS,
e);
}
final DebugTraceTransactionResult debugTraceTransactionResult =
debugTraceTransactionResult(hash, transactionWithMetadata.get(), traceOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod;
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.UnsignedIntParameter;
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.TransactionCompleteResult;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.TransactionResult;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
Expand All @@ -42,8 +44,24 @@ public String getName() {

@Override
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final Hash hash = requestContext.getRequiredParameter(0, Hash.class);
final int index = requestContext.getRequiredParameter(1, UnsignedIntParameter.class).getValue();
final Hash hash;
try {
hash = requestContext.getRequiredParameter(0, Hash.class);
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction hash parameter (index 0)",
RpcErrorType.INVALID_TRANSACTION_HASH_PARAMS,
e);
}
final int index;
try {
index = requestContext.getRequiredParameter(1, UnsignedIntParameter.class).getValue();
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction id parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_ID_PARAMS,
e);
}
final Optional<TransactionWithMetadata> transactionWithMetadata =
blockchain.transactionByBlockHashAndIndex(hash, index);
final TransactionResult result =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ protected BlockParameter blockParameter(final JsonRpcRequestContext request) {
@Override
protected Object resultByBlockNumber(
final JsonRpcRequestContext request, final long blockNumber) {
final int index = request.getRequiredParameter(1, UnsignedIntParameter.class).getValue();
final int index;
try {
index = request.getRequiredParameter(1, UnsignedIntParameter.class).getValue();
} catch (Exception e) { // TODO:replace with JsonRpcParameter.JsonRpcParameterException
throw new InvalidJsonRpcParameters(
"Invalid transaction index parameter (index 1)",
RpcErrorType.INVALID_TRANSACTION_INDEX_PARAMS,
e);
}
final Optional<TransactionWithMetadata> transactionWithMetadata =
getBlockchainQueries().transactionByBlockNumberAndIndex(blockNumber, index);
return transactionWithMetadata.map(TransactionCompleteResult::new).orElse(null);
Expand Down
Loading
Loading