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

* relax JsonCallParameter constructor to allow for both input and data being set if equal

Signed-off-by: Friedemann Fürst <friedemann.fuerst@smartcontract.com>

* fix: format

Signed-off-by: Friedemann Fürst <friedemann.fuerst@smartcontract.com>

* add changelog entry

Signed-off-by: Friedemann Fürst <friedemann.fuerst@smartcontract.com>

---------

Signed-off-by: Friedemann Fürst <friedemann.fuerst@smartcontract.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/6676/head
Friedemann Fürst 9 months ago committed by GitHub
parent b2ca0e9bf9
commit 8becd5a3a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 27
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthCallIntegrationTest.java
  3. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/JsonCallParameter.java
  4. 4
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_call_invalidWithDifferentInputAndDataAttributes.json
  5. 22
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_call_withInputAndDataAttribute.json

@ -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

@ -408,6 +408,33 @@ public class EthCallIntegrationTest {
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));
}

@ -71,7 +71,7 @@ public class JsonCallParameter extends CallParameter {
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");
}

@ -8,9 +8,9 @@
"to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
"from": "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"input": "0x12a7b914",
"data": "0x12a7b914"
"data": "0x12a7b915"
},
"0x19"
"latest"
]
},
"response": {

@ -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…
Cancel
Save