Skip to content

Commit

Permalink
Eth call with 4844 params (#6661)
Browse files Browse the repository at this point in the history
* use accessList in hash and equals

* add blob fields to callParams

* blob fields from callParam used in transaction simulator

* don't zero maxFeePerBlobs if not present

* add roundtrip callParam verification

* added a failure case test

* error conversion

* added some spec tests

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>
  • Loading branch information
macfarla authored Mar 5, 2024
1 parent 95ae4af commit cea2099
Show file tree
Hide file tree
Showing 21 changed files with 372 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- RocksDB database metadata refactoring [#6555](https://github.com/hyperledger/besu/pull/6555)
- Make layered txpool aware of minGasPrice and minPriorityFeePerGas dynamic options [#6611](https://github.com/hyperledger/besu/pull/6611)
- Update commons-compress to 1.26.0 [#6648](https://github.com/hyperledger/besu/pull/6648)
- 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)

### Bug fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void shouldReturnExpectedResultForCallAtLatestBlock() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -100,6 +102,8 @@ public void shouldReturnExpectedResultForCallAtSpecificBlock() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "0x8");
final JsonRpcResponse expectedResponse =
Expand All @@ -126,6 +130,8 @@ public void shouldReturnSuccessWhenCreatingContract() {
"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -152,6 +158,8 @@ public void shouldReturnErrorWithGasLimitTooLow() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -176,6 +184,8 @@ public void shouldReturnErrorWithGasPriceTooHighAndStrict() {
Bytes.fromHexString("0x12a7b914"),
null,
true,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -200,6 +210,8 @@ public void shouldReturnSuccessWithGasPriceTooHighNotStrict() {
Bytes.fromHexString("0x12a7b914"),
null,
false,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -225,6 +237,8 @@ public void shouldReturnErrorWithGasPriceTooHigh() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -249,6 +263,8 @@ public void shouldReturnSuccessWithValidGasPrice() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -274,6 +290,8 @@ public void shouldReturnErrorWithGasPriceAndEmptyBalance() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -298,6 +316,8 @@ public void shouldReturnSuccessWithZeroGasPriceAndEmptyBalance() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -323,6 +343,8 @@ public void shouldReturnSuccessWithoutGasPriceAndEmptyBalance() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -348,6 +370,8 @@ public void shouldReturnSuccessWithInvalidGasPricingAndEmptyBalance() {
Bytes.fromHexString("0x12a7b914"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -373,6 +397,8 @@ public void shouldReturnEmptyHashResultForCallWithOnlyToField() {
null,
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(null, "0x");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public void shouldSucceedWhenCreateAccessListSimpleContract() {
@Test
public void shouldReturnExpectedValueForEmptyCallParameter() {
final JsonCallParameter callParameter =
new JsonCallParameter(null, null, null, null, null, null, null, null, null, null, null);
new JsonCallParameter(
null, null, null, null, null, null, null, null, null, null, null, null, null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse =
new JsonRpcSuccessResponse(null, new CreateAccessListResult(new ArrayList<>(), 0xcf08));
Expand All @@ -164,6 +165,8 @@ public void shouldReturnExpectedValueForTransfer() {
null,
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse =
Expand All @@ -189,6 +192,8 @@ public void shouldReturnExpectedValueForContractDeploy() {
"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse =
Expand All @@ -214,6 +219,8 @@ public void shouldIgnoreSenderBalanceAccountWhenStrictModeDisabledAndReturnExpec
"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029"),
null,
false,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse =
Expand All @@ -227,7 +234,8 @@ public void shouldIgnoreSenderBalanceAccountWhenStrictModeDisabledAndReturnExpec
@Test
public void shouldReturnExpectedValueForInsufficientGas() {
final JsonCallParameter callParameter =
new JsonCallParameter(null, null, 1L, null, null, null, null, null, null, null, null);
new JsonCallParameter(
null, null, 1L, null, null, null, null, null, null, null, null, null, null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse =
new JsonRpcSuccessResponse(null, new CreateAccessListResult(new ArrayList<>(), 0xcf08));
Expand Down Expand Up @@ -262,7 +270,9 @@ private JsonCallParameter createAccessListJsonCallParameters(
null,
null,
null,
accessList);
accessList,
null,
null);
}

private JsonRpcRequestContext requestWithParams(final Object... params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public void setUp() {
@Test
public void shouldReturnExpectedValueForEmptyCallParameter() {
final JsonCallParameter callParameter =
new JsonCallParameter(null, null, null, null, null, null, null, null, null, null, null);
new JsonCallParameter(
null, null, null, null, null, null, null, null, null, null, null, null, null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(null, "0x5208");

Expand All @@ -88,6 +89,8 @@ public void shouldReturnExpectedValueForTransfer() {
null,
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(null, "0x5208");
Expand All @@ -112,6 +115,8 @@ public void shouldReturnExpectedValueForContractDeploy() {
"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(null, "0x1b551");
Expand All @@ -136,6 +141,8 @@ public void shouldIgnoreSenderBalanceAccountWhenStrictModeDisabledAndReturnExpec
"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029"),
null,
false,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(null, "0x1b551");
Expand All @@ -160,6 +167,8 @@ public void shouldNotIgnoreSenderBalanceAccountWhenStrictModeDisabledAndThrowErr
"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029"),
null,
true,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter);

Expand All @@ -176,7 +185,8 @@ public void shouldNotIgnoreSenderBalanceAccountWhenStrictModeDisabledAndThrowErr
@Test
public void shouldReturnExpectedValueForInsufficientGas() {
final JsonCallParameter callParameter =
new JsonCallParameter(null, null, 1L, null, null, null, null, null, null, null, null);
new JsonCallParameter(
null, null, 1L, null, null, null, null, null, null, null, null, null, null);
final JsonRpcRequestContext request = requestWithParams(callParameter);
final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(null, "0x5208");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void shouldReturnSuccessWithoutGasPriceAndEmptyBalance() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -100,6 +102,8 @@ public void shouldReturnErrorWithGasPriceTooHigh() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -124,6 +128,8 @@ public void shouldReturnSuccessWithValidGasPrice() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -149,6 +155,8 @@ public void shouldReturnErrorWithGasPriceLessThanCurrentBaseFee() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -173,6 +181,8 @@ public void shouldReturnSuccessWithValidMaxFeePerGas() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -198,6 +208,8 @@ public void shouldReturnSuccessWithValidMaxFeePerGasAndMaxPriorityFeePerGas() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -223,6 +235,8 @@ public void shouldReturnErrorWithValidMaxFeePerGasLessThanCurrentBaseFee() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -247,6 +261,8 @@ public void shouldReturnErrorWithValidMaxFeePerGasLessThanMaxPriorityFeePerGas()
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand All @@ -272,6 +288,8 @@ public void shouldReturnErrorWithMaxFeePerGasAndEmptyBalance() {
Bytes.fromHexString("0x2e64cec1"),
null,
null,
null,
null,
null);
final JsonRpcRequestContext request = requestWithParams(callParameter, "latest");
final JsonRpcResponse expectedResponse =
Expand Down
Loading

0 comments on commit cea2099

Please sign in to comment.