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

Transaction call object to accept both input and data field if equal #6702

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Add blob transaction support to `eth_call` [#6661](https://github.com/hyperledger/besu/pull/6661)
- Add blobs to `eth_feeHistory` [#6679](https://github.com/hyperledger/besu/pull/6679)
- Refactor and extend `TransactionPoolValidatorService` [#6636](https://github.com/hyperledger/besu/pull/6636)
- Transaction call object to accept both `input` and `data` field simultaneously if they are set to equal values [#6702](https://github.com/hyperledger/besu/pull/6702)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,33 @@ public void shouldReturnEmptyHashResultForCallWithOnlyToField() {
assertThat(response).usingRecursiveComparison().isEqualTo(expectedResponse);
}

@Test
public void shouldReturnSuccessWithInputAndDataFieldSetToSameValue() {
final JsonCallParameter callParameter =
new JsonCallParameter(
Address.fromHexString("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"),
Address.fromHexString("0x6295ee1b4f6dd65047762f924ecd367c17eabf8f"),
null,
null,
null,
null,
null,
Bytes.fromHexString("0x12a7b914"),
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
new JsonRpcSuccessResponse(
null, "0x0000000000000000000000000000000000000000000000000000000000000001");

final JsonRpcResponse response = method.response(request);

assertThat(response).usingRecursiveComparison().isEqualTo(expectedResponse);
}

private JsonRpcRequestContext requestWithParams(final Object... params) {
return new JsonRpcRequestContext(new JsonRpcRequest("2.0", "eth_call", params));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public JsonCallParameter(
Optional.ofNullable(maxFeePerBlobGas),
Optional.ofNullable(blobVersionedHashes));

if (input != null && data != null) {
if (input != null && data != null && !input.equals(data)) {
throw new IllegalArgumentException("Only one of 'input' or 'data' should be provided");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
"from": "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"input": "0x12a7b914",
"data": "0x12a7b914"
"data": "0x12a7b915"
},
"0x19"
"latest"
]
},
"response": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"request": {
"id": 3,
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
"from": "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"input": "0x12a7b914",
"data": "0x12a7b914"
},
"0x19"
]
},
"response": {
"jsonrpc": "2.0",
"id": 3,
"result": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"statusCode": 200
}
Loading