update json-rpc responses for 1559 (#2222)

* address assumption that if 1559 is enabled there is a london fork block config
fixes #2192

Signed-off-by: garyschulte <garyschulte@gmail.com>

* omit null chainId from transaction json serialization, and fix merge regression

Signed-off-by: garyschulte <garyschulte@gmail.com>

* update json-rpc responses for 1559, use current feeCap and gasPremium field names

Signed-off-by: garyschulte <garyschulte@gmail.com>

* add pr number to changelog

Signed-off-by: garyschulte <garyschulte@gmail.com>

* fix transaction decoder

Signed-off-by: Gary Schulte <garyschulte@gmail.com>

* rebase and fix merge conflicts

Signed-off-by: garyschulte <garyschulte@gmail.com>

* remove null chainId from json-rpc test fixtures

Signed-off-by: garyschulte <garyschulte@gmail.com>

* the great 1559 rename

Signed-off-by: garyschulte <garyschulte@gmail.com>

* re-remove gasTarget

Signed-off-by: garyschulte <garyschulte@gmail.com>

* add serialization tests for 1559 transaction fields

Signed-off-by: garyschulte <garyschulte@gmail.com>

* add json property ordering annotations to Transaction*Result and spotless

Signed-off-by: garyschulte <garyschulte@gmail.com>

* rebase on master, update error message feedback from Karim

Signed-off-by: garyschulte <garyschulte@gmail.com>
pull/2290/head
garyschulte 4 years ago committed by GitHub
parent 09a49cfd2d
commit a9dcd5bb5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java
  3. 5
      config/src/test/java/org/hyperledger/besu/config/GenesisConfigFileTest.java
  4. 8
      config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java
  5. 6
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthCall.java
  6. 9
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthEstimateGas.java
  7. 8
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/JsonCallParameter.java
  8. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResult.java
  9. 28
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionCompleteResult.java
  10. 24
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPendingResult.java
  11. 9
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/util/DomainObjectDecodeUtils.java
  12. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthEstimateGasTest.java
  13. 15
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionCompleteResultTest.java
  14. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getBlockByNumber_complete.json
  15. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByBlockHashAndIndex_00.json
  16. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByBlockHashAndIndex_01.json
  17. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByBlockHashAndIndex_02.json
  18. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByBlockNumberAndIndex_00.json
  19. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByBlockNumberAndIndex_01.json
  20. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByBlockNumberAndIndex_latest.json
  21. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByBlockNumberAndIndex_pending.json
  22. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByHash_addressReceiver.json
  23. 1
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getTransactionByHash_contractCreation.json
  24. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java
  25. 110
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java
  26. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/TransactionDecoder.java
  27. 8
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/TransactionEncoder.java
  28. 13
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/TransactionPriceCalculator.java
  29. 31
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/CallParameter.java
  30. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulator.java
  31. 4
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockDataGenerator.java
  32. 16
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/TransactionTestFixture.java
  33. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionBuilderTest.java
  34. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionEIP1559Test.java
  35. 8
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/TransactionDecoderTest.java
  36. 18
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/fees/TransactionPriceCalculatorTest.java
  37. 12
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionValidatorTest.java
  38. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java
  39. 8
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionReplacementByPriceRuleTest.java
  40. 1
      ethereum/permissioning/build.gradle
  41. 2
      ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/RetestethService.java
  42. 1
      ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java
  43. 2
      ethereum/retesteth/src/test/resources/org/hyperledger/besu/ethereum/retesteth/methods/1559ChainParams.json
  44. 2
      plugin-api/build.gradle
  45. 6
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/Transaction.java

@ -14,6 +14,7 @@
- Added ACCESS_LIST transactions to the list of transactions using legacy gas pricing for 1559 [\#2239](https://github.com/hyperledger/besu/pull/2239)
- Reduced logging level of public key decoding failure of malformed packets. [\#2143](https://github.com/hyperledger/besu/pull/2143)
- Add 1559 parameters to json-rpc responses. [\#2222](https://github.com/hyperledger/besu/pull/2222)
### Early Access Features

@ -76,7 +76,7 @@ public interface GenesisConfigOptions {
OptionalLong getEIP1559BlockNumber();
default Optional<Long> getGenesisBaseFee() {
default Optional<Long> getGenesisBaseFeePerGas() {
return getEIP1559BlockNumber().stream()
.boxed()
.filter(g -> g.equals(0L))

@ -102,11 +102,6 @@ public class GenesisConfigFileTest {
assertThat(configWithProperty("gasLimit", "1000").getGasLimit()).isEqualTo(1000);
}
@Test
public void shouldGetGasTarget() {
assertThat(configWithProperty("gasTarget", "9999").getGasLimit()).isEqualTo(9999);
}
@Test
public void shouldRequireGasLimit() {
assertInvalidConfiguration(EMPTY_CONFIG::getGasLimit);

@ -187,7 +187,7 @@ public class GenesisConfigOptionsTest {
final GenesisConfigOptions config = fromConfigOptions(singletonMap("londonblock", 1000));
assertThat(config.getEIP1559BlockNumber()).hasValue(1000);
assertThat(config.getLondonBlockNumber()).hasValue(1000);
assertThat(config.getGenesisBaseFee()).isEmpty();
assertThat(config.getGenesisBaseFeePerGas()).isEmpty();
} finally {
ExperimentalEIPs.eip1559Enabled = ExperimentalEIPs.EIP1559_ENABLED_DEFAULT_VALUE;
}
@ -200,7 +200,7 @@ public class GenesisConfigOptionsTest {
final GenesisConfigOptions config = fromConfigOptions(singletonMap("baikalblock", 1000));
assertThat(config.getEIP1559BlockNumber()).hasValue(1000);
assertThat(config.getLondonBlockNumber()).hasValue(1000);
assertThat(config.getGenesisBaseFee()).isEmpty();
assertThat(config.getGenesisBaseFeePerGas()).isEmpty();
} finally {
ExperimentalEIPs.eip1559Enabled = ExperimentalEIPs.EIP1559_ENABLED_DEFAULT_VALUE;
}
@ -214,7 +214,7 @@ public class GenesisConfigOptionsTest {
final GenesisConfigOptions config = fromConfigOptions(singletonMap("aleutblock", 1000));
assertThat(config.getEIP1559BlockNumber()).hasValue(1000);
assertThat(config.getAleutBlockNumber()).hasValue(1000);
assertThat(config.getGenesisBaseFee()).isEmpty();
assertThat(config.getGenesisBaseFeePerGas()).isEmpty();
} finally {
ExperimentalEIPs.eip1559Enabled = ExperimentalEIPs.EIP1559_ENABLED_DEFAULT_VALUE;
}
@ -227,7 +227,7 @@ public class GenesisConfigOptionsTest {
ExperimentalEIPs.eip1559Enabled = true;
final GenesisConfigOptions config = fromConfigOptions(singletonMap("londonblock", 0));
assertThat(config.getEIP1559BlockNumber()).hasValue(0);
assertThat(config.getGenesisBaseFee())
assertThat(config.getGenesisBaseFeePerGas())
.hasValue(ExperimentalEIPs.EIP1559_BASEFEE_DEFAULT_VALUE);
} finally {
ExperimentalEIPs.eip1559Enabled = ExperimentalEIPs.EIP1559_ENABLED_DEFAULT_VALUE;

@ -127,8 +127,10 @@ public class EthCall extends AbstractBlockParameterOrBlockHashMethod {
throw new InvalidJsonRpcParameters("Missing \"to\" field in call arguments");
}
if (callParams.getGasPrice() != null
&& (callParams.getFeeCap().isPresent() || callParams.getGasPremium().isPresent())) {
throw new InvalidJsonRpcParameters("gasPrice cannot be used with baseFee or feeCap");
&& (callParams.getMaxFeePerGas().isPresent()
|| callParams.getMaxPriorityFeePerGas().isPresent())) {
throw new InvalidJsonRpcParameters(
"gasPrice cannot be used with maxFeePerGas or maxPriorityFeePerGas");
}
return callParams;
}

@ -102,8 +102,8 @@ public class EthEstimateGas implements JsonRpcMethod {
callParams.getTo(),
gasLimit,
Optional.ofNullable(callParams.getGasPrice()).orElse(Wei.ZERO),
callParams.getGasPremium(),
callParams.getFeeCap(),
callParams.getMaxPriorityFeePerGas(),
callParams.getMaxFeePerGas(),
callParams.getValue(),
callParams.getPayload());
}
@ -167,8 +167,9 @@ public class EthEstimateGas implements JsonRpcMethod {
private JsonCallParameter validateAndGetCallParams(final JsonRpcRequestContext request) {
final JsonCallParameter callParams = request.getRequiredParameter(0, JsonCallParameter.class);
if (callParams.getGasPrice() != null
&& (callParams.getFeeCap().isPresent() || callParams.getGasPremium().isPresent())) {
throw new InvalidJsonRpcParameters("gasPrice cannot be used with baseFee or feeCap");
&& (callParams.getMaxFeePerGas().isPresent()
|| callParams.getMaxPriorityFeePerGas().isPresent())) {
throw new InvalidJsonRpcParameters("gasPrice cannot be used with baseFee or maxFeePerGas");
}
return callParams;
}

@ -42,8 +42,8 @@ public class JsonCallParameter extends CallParameter {
@JsonProperty("to") final Address to,
@JsonDeserialize(using = GasDeserializer.class) @JsonProperty("gas") final Gas gasLimit,
@JsonProperty("gasPrice") final Wei gasPrice,
@JsonProperty("gasPremium") final Wei gasPremium,
@JsonProperty("feeCap") final Wei feeCap,
@JsonProperty("maxPriorityFeePerGas") final Wei maxPriorityFeePerGas,
@JsonProperty("maxFeePerGas") final Wei maxFeePerGas,
@JsonProperty("value") final Wei value,
@JsonDeserialize(using = HexStringDeserializer.class) @JsonProperty("data")
final Bytes payload,
@ -53,8 +53,8 @@ public class JsonCallParameter extends CallParameter {
to,
gasLimit != null ? gasLimit.toLong() : -1,
gasPrice,
Optional.ofNullable(gasPremium),
Optional.ofNullable(feeCap),
Optional.ofNullable(maxPriorityFeePerGas),
Optional.ofNullable(maxFeePerGas),
value,
payload);
this.strict = Optional.ofNullable(strict).orElse(FALSE);

@ -25,6 +25,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.JsonNode;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"number",
"hash",

@ -35,6 +35,8 @@ import org.apache.tuweni.bytes.Bytes;
"from",
"gas",
"gasPrice",
"maxPriorityFeePerGas",
"maxFeePerGas",
"hash",
"input",
"nonce",
@ -55,10 +57,22 @@ public class TransactionCompleteResult implements TransactionResult {
private final String blockHash;
private final String blockNumber;
@JsonInclude(JsonInclude.Include.NON_NULL)
private final String chainId;
private final String from;
private final String gas;
@JsonInclude(JsonInclude.Include.NON_NULL)
private final String gasPrice;
@JsonInclude(JsonInclude.Include.NON_NULL)
private final String maxPriorityFeePerGas;
@JsonInclude(JsonInclude.Include.NON_NULL)
private final String maxFeePerGas;
private final String hash;
private final String input;
private final String nonce;
@ -84,6 +98,10 @@ public class TransactionCompleteResult implements TransactionResult {
this.chainId = transaction.getChainId().map(Quantity::create).orElse(null);
this.from = transaction.getSender().toString();
this.gas = Quantity.create(transaction.getGasLimit());
this.maxPriorityFeePerGas =
tx.getTransaction().getMaxPriorityFeePerGas().map(q -> q.toHexString()).orElse(null);
this.maxFeePerGas =
tx.getTransaction().getMaxFeePerGas().map(q -> q.toHexString()).orElse(null);
this.gasPrice = Quantity.create(transaction.getGasPrice());
this.hash = transaction.getHash().toString();
this.input = transaction.getPayload().toString();
@ -132,6 +150,16 @@ public class TransactionCompleteResult implements TransactionResult {
return gas;
}
@JsonGetter(value = "maxPriorityFeePerGas")
public String getMaxPriorityFeePerGas() {
return maxPriorityFeePerGas;
}
@JsonGetter(value = "maxFeePerGas")
public String getMaxFeePerGas() {
return maxFeePerGas;
}
@JsonGetter(value = "gasPrice")
public String getGasPrice() {
return gasPrice;

@ -32,6 +32,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"from",
"gas",
"gasPrice",
"maxPriortyFeePerGas",
"maxFeePerGas",
"hash",
"input",
"nonce",
@ -50,7 +52,16 @@ public class TransactionPendingResult implements TransactionResult {
private final String chainId;
private final String from;
private final String gas;
@JsonInclude(JsonInclude.Include.NON_NULL)
private final String gasPrice;
@JsonInclude(JsonInclude.Include.NON_NULL)
private final String maxPriorityFeePerGas;
@JsonInclude(JsonInclude.Include.NON_NULL)
private final String maxFeePerGas;
private final String hash;
private final String input;
private final String nonce;
@ -73,6 +84,9 @@ public class TransactionPendingResult implements TransactionResult {
this.from = transaction.getSender().toString();
this.gas = Quantity.create(transaction.getGasLimit());
this.gasPrice = Quantity.create(transaction.getGasPrice());
this.maxPriorityFeePerGas =
transaction.getMaxPriorityFeePerGas().map(q -> q.toHexString()).orElse(null);
this.maxFeePerGas = transaction.getMaxFeePerGas().map(q -> q.toHexString()).orElse(null);
this.hash = transaction.getHash().toString();
this.input = transaction.getPayload().toString();
this.nonce = Quantity.create(transaction.getNonce());
@ -116,6 +130,16 @@ public class TransactionPendingResult implements TransactionResult {
return gasPrice;
}
@JsonGetter(value = "maxPriorityFeePerGas")
public String getMaxPriorityFeePerGas() {
return maxPriorityFeePerGas;
}
@JsonGetter(value = "maxFeePerGas")
public String getMaxFeePerGas() {
return maxFeePerGas;
}
@JsonGetter(value = "hash")
public String getHash() {
return hash;

@ -14,12 +14,9 @@
*/
package org.hyperledger.besu.ethereum.api.util;
import static org.hyperledger.besu.plugin.data.TransactionType.FRONTIER;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.exception.InvalidJsonRpcRequestException;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.TransactionDecoder;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPException;
import org.apache.logging.log4j.LogManager;
@ -33,11 +30,7 @@ public class DomainObjectDecodeUtils {
throws InvalidJsonRpcRequestException {
try {
Bytes txnBytes = Bytes.fromHexString(rawTransaction);
if (!txnBytes.isEmpty() && FRONTIER.compareTo(txnBytes.get(0)) < 0) {
return TransactionDecoder.decodeOpaqueBytes(txnBytes);
} else {
return Transaction.readFrom(RLP.input(txnBytes));
}
return TransactionDecoder.decodeOpaqueBytes(txnBytes);
} catch (final IllegalArgumentException | RLPException e) {
LOG.debug(e);
throw new InvalidJsonRpcRequestException("Invalid raw transaction hex", e);

@ -157,7 +157,7 @@ public class EthEstimateGasTest {
mockTransientProcessorResultGasEstimate(1L, false, false);
Assertions.assertThatThrownBy(() -> method.response(request))
.isInstanceOf(InvalidJsonRpcParameters.class)
.hasMessageContaining("gasPrice cannot be used with baseFee or feeCap");
.hasMessageContaining("gasPrice cannot be used with baseFee or maxFeePerGas");
}
@Test

@ -27,6 +27,18 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
public class TransactionCompleteResultTest {
@Test
public void eip1559TransactionFields() {
final BlockDataGenerator gen = new BlockDataGenerator();
final Transaction transaction = gen.transaction(TransactionType.EIP1559);
TransactionCompleteResult tcr =
new TransactionCompleteResult(new TransactionWithMetadata(transaction, 0L, Hash.ZERO, 0));
assertThat(tcr.getMaxFeePerGas()).isNotEmpty();
assertThat(tcr.getMaxPriorityFeePerGas()).isNotEmpty();
assertThat(tcr.getGasPrice()).isNull();
}
@Test
public void accessListTransactionFields() throws JsonProcessingException {
final BlockDataGenerator gen = new BlockDataGenerator();
@ -40,6 +52,9 @@ public class TransactionCompleteResultTest {
"0xfc84c3946cb419cbd8c2c68d5e79a3b2a03a8faff4d9e2be493f5a07eb5da95e"),
0));
assertThat(transactionCompleteResult.getGasPrice()).isNotEmpty();
assertThat(transactionCompleteResult.getMaxFeePerGas()).isNull();
assertThat(transactionCompleteResult.getMaxPriorityFeePerGas()).isNull();
final ObjectMapper objectMapper = new ObjectMapper();
final String jsonString =
objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(transactionCompleteResult);

@ -35,7 +35,6 @@
{
"blockHash": "0x1878c6f27178250f3d55186a2887b076936599f307d96dabcf331b2ff0a38f0c",
"blockNumber": "0x10",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -14,7 +14,6 @@
"result": {
"blockHash": "0x10aaf14a53caf27552325374429d3558398a36d3682ede6603c2c6511896e9f9",
"blockNumber": "0x1",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x2fefd8",
"gasPrice": "0x1",

@ -14,7 +14,6 @@
"result": {
"blockHash": "0x0e29f455b8db7b15042efe9eabe0beb0ce2c7901919bba1107b1352191e09942",
"blockNumber": "0x2",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -14,7 +14,6 @@
"result": {
"blockHash": "0x71d59849ddd98543bdfbe8548f5eed559b07b8aaf196369f39134500eab68e53",
"blockNumber": "0x20",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -14,7 +14,6 @@
"result": {
"blockHash": "0x0e29f455b8db7b15042efe9eabe0beb0ce2c7901919bba1107b1352191e09942",
"blockNumber": "0x2",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -14,7 +14,6 @@
"result": {
"blockHash": "0x3d813a0ffc9cd04436e17e3e9c309f1e80df0407078e50355ce0d570b5424812",
"blockNumber": "0x3",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -14,7 +14,6 @@
"result": {
"blockHash": "0x71d59849ddd98543bdfbe8548f5eed559b07b8aaf196369f39134500eab68e53",
"blockNumber": "0x20",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -14,7 +14,6 @@
"result": {
"blockHash": "0x71d59849ddd98543bdfbe8548f5eed559b07b8aaf196369f39134500eab68e53",
"blockNumber": "0x20",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -13,7 +13,6 @@
"result": {
"blockHash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6",
"blockNumber": "0x1e",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x4cb2f",
"gasPrice": "0x1",

@ -13,7 +13,6 @@
"result": {
"blockHash": "0x10aaf14a53caf27552325374429d3558398a36d3682ede6603c2c6511896e9f9",
"blockNumber": "0x1",
"chainId": null,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"gas": "0x2fefd8",
"gasPrice": "0x1",

@ -156,7 +156,7 @@ public final class GenesisState {
.mixHash(parseMixHash(genesis))
.nonce(parseNonce(genesis))
.blockHeaderFunctions(ScheduleBasedBlockHeaderFunctions.create(protocolSchedule))
.baseFee(genesis.getConfigOptions().getGenesisBaseFee().orElse(null))
.baseFee(genesis.getConfigOptions().getGenesisBaseFeePerGas().orElse(null))
.buildBlockHeader();
}

@ -62,9 +62,9 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
private final Wei gasPrice;
private final Wei gasPremium;
private final Wei maxPriorityFeePerGas;
private final Wei feeCap;
private final Wei maxFeePerGas;
private final long gasLimit;
@ -111,8 +111,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
* @param transactionType the transaction type
* @param nonce the nonce
* @param gasPrice the gas price
* @param gasPremium the gas premium
* @param feeCap the fee cap
* @param maxPriorityFeePerGas the max priorty fee per gas
* @param maxFeePerGas the max fee per gas
* @param gasLimit the gas limit
* @param to the transaction recipient
* @param value the value being transferred to the recipient
@ -134,8 +134,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
final TransactionType transactionType,
final long nonce,
final Wei gasPrice,
final Wei gasPremium,
final Wei feeCap,
final Wei maxPriorityFeePerGas,
final Wei maxFeePerGas,
final long gasLimit,
final Optional<Address> to,
final Wei value,
@ -164,8 +164,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
this.transactionType = transactionType;
this.nonce = nonce;
this.gasPrice = gasPrice;
this.gasPremium = gasPremium;
this.feeCap = feeCap;
this.maxPriorityFeePerGas = maxPriorityFeePerGas;
this.maxFeePerGas = maxFeePerGas;
this.gasLimit = gasLimit;
this.to = to;
this.value = value;
@ -180,8 +180,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
public Transaction(
final long nonce,
final Wei gasPrice,
final Wei gasPremium,
final Wei feeCap,
final Wei maxPriorityFeePerGas,
final Wei maxFeePerGas,
final long gasLimit,
final Optional<Address> to,
final Wei value,
@ -194,8 +194,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
TransactionType.FRONTIER,
nonce,
gasPrice,
gasPremium,
feeCap,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
@ -301,23 +301,23 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
}
/**
* Return the transaction gas premium.
* Return the transaction max priority per gas.
*
* @return the transaction gas premium
* @return the transaction max priority per gas
*/
@Override
public Optional<Quantity> getGasPremium() {
return Optional.ofNullable(gasPremium);
public Optional<Quantity> getMaxPriorityFeePerGas() {
return Optional.ofNullable(maxPriorityFeePerGas);
}
/**
* Return the transaction fee cap.
* Return the transaction max fee per gas.
*
* @return the transaction fee cap
* @return the transaction max fee per gas
*/
@Override
public Optional<Quantity> getFeeCap() {
return Optional.ofNullable(feeCap);
public Optional<Quantity> getMaxFeePerGas() {
return Optional.ofNullable(maxFeePerGas);
}
/**
@ -447,8 +447,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
transactionType,
nonce,
gasPrice,
gasPremium,
feeCap,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
@ -573,8 +573,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
final TransactionType transactionType,
final long nonce,
final Wei gasPrice,
final Wei gasPremium,
final Wei feeCap,
final Wei maxPriorityFeePerGas,
final Wei maxFeePerGas,
final long gasLimit,
final Optional<Address> to,
final Wei value,
@ -589,7 +589,15 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
case EIP1559:
preimage =
eip1559Preimage(
nonce, gasPremium, feeCap, gasLimit, to, value, payload, chainId, accessList);
nonce,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
payload,
chainId,
accessList);
break;
case ACCESS_LIST:
preimage =
@ -641,8 +649,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
private static Bytes eip1559Preimage(
final long nonce,
final Wei gasPremium,
final Wei feeCap,
final Wei maxPriorityFeePerGas,
final Wei maxFeePerGas,
final long gasLimit,
final Optional<Address> to,
final Wei value,
@ -655,8 +663,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
rlpOutput.startList();
rlpOutput.writeBigIntegerScalar(chainId.orElseThrow());
rlpOutput.writeLongScalar(nonce);
rlpOutput.writeUInt256Scalar(gasPremium);
rlpOutput.writeUInt256Scalar(feeCap);
rlpOutput.writeUInt256Scalar(maxPriorityFeePerGas);
rlpOutput.writeUInt256Scalar(maxFeePerGas);
rlpOutput.writeLongScalar(gasLimit);
rlpOutput.writeBytes(to.map(Bytes::copy).orElse(Bytes.EMPTY));
rlpOutput.writeUInt256Scalar(value);
@ -696,8 +704,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
return Objects.equals(this.chainId, that.chainId)
&& Objects.equals(this.gasLimit, that.gasLimit)
&& Objects.equals(this.gasPrice, that.gasPrice)
&& Objects.equals(this.gasPremium, that.gasPremium)
&& Objects.equals(this.feeCap, that.feeCap)
&& Objects.equals(this.maxPriorityFeePerGas, that.maxPriorityFeePerGas)
&& Objects.equals(this.maxFeePerGas, that.maxFeePerGas)
&& Objects.equals(this.nonce, that.nonce)
&& Objects.equals(this.payload, that.payload)
&& Objects.equals(this.signature, that.signature)
@ -709,7 +717,17 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
@Override
public int hashCode() {
return Objects.hash(
nonce, gasPrice, gasPremium, feeCap, gasLimit, to, value, payload, signature, chainId, v);
nonce,
gasPrice,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
payload,
signature,
chainId,
v);
}
@Override
@ -719,9 +737,9 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
sb.append("type=").append(getType()).append(", ");
sb.append("nonce=").append(getNonce()).append(", ");
sb.append("gasPrice=").append(getGasPrice()).append(", ");
if (getGasPremium().isPresent() && getFeeCap().isPresent()) {
sb.append("gasPremium=").append(getGasPremium()).append(", ");
sb.append("feeCap=").append(getFeeCap()).append(", ");
if (getMaxPriorityFeePerGas().isPresent() && getMaxFeePerGas().isPresent()) {
sb.append("maxPriorityFeePerGas=").append(getMaxPriorityFeePerGas()).append(", ");
sb.append("maxFeePerGas=").append(getMaxFeePerGas()).append(", ");
}
sb.append("gasLimit=").append(getGasLimit()).append(", ");
if (getTo().isPresent()) sb.append("to=").append(getTo().get()).append(", ");
@ -751,9 +769,9 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
protected Wei gasPrice;
protected Wei gasPremium;
protected Wei maxPriorityFeePerGas;
protected Wei feeCap;
protected Wei maxFeePerGas;
protected long gasLimit = -1L;
@ -793,13 +811,13 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
return this;
}
public Builder gasPremium(final Wei gasPremium) {
this.gasPremium = gasPremium;
public Builder maxPriorityFeePerGas(final Wei maxPriorityFeePerGas) {
this.maxPriorityFeePerGas = maxPriorityFeePerGas;
return this;
}
public Builder feeCap(final Wei feeCap) {
this.feeCap = feeCap;
public Builder maxFeePerGas(final Wei maxFeePerGas) {
this.maxFeePerGas = maxFeePerGas;
return this;
}
@ -844,7 +862,7 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
}
public Builder guessType() {
if (gasPremium != null || feeCap != null) {
if (maxPriorityFeePerGas != null || maxFeePerGas != null) {
transactionType = TransactionType.EIP1559;
} else if (accessList.isPresent()) {
transactionType = TransactionType.ACCESS_LIST;
@ -859,8 +877,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
transactionType,
nonce,
gasPrice,
gasPremium,
feeCap,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,
@ -887,8 +905,8 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
transactionType,
nonce,
gasPrice,
gasPremium,
feeCap,
maxPriorityFeePerGas,
maxFeePerGas,
gasLimit,
to,
value,

@ -77,7 +77,7 @@ public class TransactionDecoder {
try {
transactionType = TransactionType.of(input.get(0));
} catch (final IllegalArgumentException __) {
return decodeFrontier(RLP.input(input));
return decodeForWire(RLP.input(input));
}
return getDecoder(transactionType).decode(RLP.input(input.slice(1)));
}
@ -174,8 +174,8 @@ public class TransactionDecoder {
.type(TransactionType.EIP1559)
.chainId(chainId)
.nonce(input.readLongScalar())
.gasPremium(Wei.wrap(input.readBytes()))
.feeCap(Wei.wrap(input.readBytes()))
.maxPriorityFeePerGas(Wei.wrap(input.readBytes()))
.maxFeePerGas(Wei.wrap(input.readBytes()))
.gasLimit(input.readLongScalar())
.to(input.readBytes(v -> v.size() == 0 ? null : Address.wrap(v)))
.value(Wei.of(input.readUInt256Scalar()))

@ -161,9 +161,13 @@ public class TransactionEncoder {
.longValue());
out.writeLongScalar(transaction.getNonce());
out.writeUInt256Scalar(
transaction.getGasPremium().map(Quantity::getValue).map(Wei::ofNumber).orElseThrow());
transaction
.getMaxPriorityFeePerGas()
.map(Quantity::getValue)
.map(Wei::ofNumber)
.orElseThrow());
out.writeUInt256Scalar(
transaction.getFeeCap().map(Quantity::getValue).map(Wei::ofNumber).orElseThrow());
transaction.getMaxFeePerGas().map(Quantity::getValue).map(Wei::ofNumber).orElseThrow());
out.writeLongScalar(transaction.getGasLimit());
out.writeBytes(transaction.getTo().map(Bytes::copy).orElse(Bytes.EMPTY));
out.writeUInt256Scalar(transaction.getValue());

@ -34,12 +34,13 @@ public interface TransactionPriceCalculator {
if (!transaction.getType().supports1559FeeMarket()) {
return transaction.getGasPrice();
}
final Wei gasPremium =
Wei.of((BigInteger) transaction.getGasPremium().orElseThrow().getValue());
final Wei feeCap = Wei.of((BigInteger) transaction.getFeeCap().orElseThrow().getValue());
Wei price = gasPremium.add(baseFee);
if (price.compareTo(feeCap) > 0) {
price = feeCap;
final Wei maxPriorityFeePerGas =
Wei.of((BigInteger) transaction.getMaxPriorityFeePerGas().orElseThrow().getValue());
final Wei maxFeePerGas =
Wei.of((BigInteger) transaction.getMaxFeePerGas().orElseThrow().getValue());
Wei price = maxPriorityFeePerGas.add(baseFee);
if (price.compareTo(maxFeePerGas) > 0) {
price = maxFeePerGas;
}
return price;
};

@ -31,9 +31,9 @@ public class CallParameter {
private final long gasLimit;
private final Optional<Wei> gasPremium;
private final Optional<Wei> maxPriorityFeePerGas;
private final Optional<Wei> feeCap;
private final Optional<Wei> maxFeePerGas;
private final Wei gasPrice;
@ -51,8 +51,8 @@ public class CallParameter {
this.from = from;
this.to = to;
this.gasLimit = gasLimit;
this.gasPremium = Optional.empty();
this.feeCap = Optional.empty();
this.maxPriorityFeePerGas = Optional.empty();
this.maxFeePerGas = Optional.empty();
this.gasPrice = gasPrice;
this.value = value;
this.payload = payload;
@ -63,15 +63,15 @@ public class CallParameter {
final Address to,
final long gasLimit,
final Wei gasPrice,
final Optional<Wei> gasPremium,
final Optional<Wei> feeCap,
final Optional<Wei> maxPriorityFeePerGas,
final Optional<Wei> maxFeePerGas,
final Wei value,
final Bytes payload) {
this.from = from;
this.to = to;
this.gasLimit = gasLimit;
this.gasPremium = gasPremium;
this.feeCap = feeCap;
this.maxPriorityFeePerGas = maxPriorityFeePerGas;
this.maxFeePerGas = maxFeePerGas;
this.gasPrice = gasPrice;
this.value = value;
this.payload = payload;
@ -93,12 +93,12 @@ public class CallParameter {
return gasPrice;
}
public Optional<Wei> getGasPremium() {
return gasPremium;
public Optional<Wei> getMaxPriorityFeePerGas() {
return maxPriorityFeePerGas;
}
public Optional<Wei> getFeeCap() {
return feeCap;
public Optional<Wei> getMaxFeePerGas() {
return maxFeePerGas;
}
public Wei getValue() {
@ -122,14 +122,15 @@ public class CallParameter {
&& Objects.equals(from, that.from)
&& Objects.equals(to, that.to)
&& Objects.equals(gasPrice, that.gasPrice)
&& Objects.equals(gasPremium, that.gasPremium)
&& Objects.equals(feeCap, that.feeCap)
&& Objects.equals(maxPriorityFeePerGas, that.maxPriorityFeePerGas)
&& Objects.equals(maxFeePerGas, that.maxFeePerGas)
&& Objects.equals(value, that.value)
&& Objects.equals(payload, that.payload);
}
@Override
public int hashCode() {
return Objects.hash(from, to, gasLimit, gasPrice, gasPremium, feeCap, value, payload);
return Objects.hash(
from, to, gasLimit, gasPrice, maxPriorityFeePerGas, maxFeePerGas, value, payload);
}
}

@ -174,8 +174,8 @@ public class TransactionSimulator {
.value(value)
.payload(payload)
.signature(FAKE_SIGNATURE);
callParams.getGasPremium().ifPresent(transactionBuilder::gasPremium);
callParams.getFeeCap().ifPresent(transactionBuilder::feeCap);
callParams.getMaxPriorityFeePerGas().ifPresent(transactionBuilder::maxPriorityFeePerGas);
callParams.getMaxFeePerGas().ifPresent(transactionBuilder::maxFeePerGas);
final Transaction transaction = transactionBuilder.build();

@ -399,8 +399,8 @@ public class BlockDataGenerator {
return Transaction.builder()
.type(TransactionType.EIP1559)
.nonce(positiveLong())
.gasPremium(Wei.wrap(bytes32()))
.feeCap(Wei.wrap(bytes32()))
.maxPriorityFeePerGas(Wei.wrap(bytes32()))
.maxFeePerGas(Wei.wrap(bytes32()))
.gasLimit(positiveLong())
.to(to)
.value(Wei.of(positiveLong()))

@ -41,8 +41,8 @@ public class TransactionTestFixture {
private Optional<BigInteger> chainId = Optional.of(BigInteger.valueOf(1337));
private Optional<Wei> gasPremium = Optional.empty();
private Optional<Wei> feeCap = Optional.empty();
private Optional<Wei> maxPriorityFeePerGas = Optional.empty();
private Optional<Wei> maxFeePerGas = Optional.empty();
public Transaction createTransaction(final KeyPair keys) {
final Transaction.Builder builder = Transaction.builder();
@ -58,8 +58,8 @@ public class TransactionTestFixture {
to.ifPresent(builder::to);
chainId.ifPresent(builder::chainId);
gasPremium.ifPresent(builder::gasPremium);
feeCap.ifPresent(builder::feeCap);
maxPriorityFeePerGas.ifPresent(builder::maxPriorityFeePerGas);
maxFeePerGas.ifPresent(builder::maxFeePerGas);
return builder.signAndBuild(keys);
}
@ -109,13 +109,13 @@ public class TransactionTestFixture {
return this;
}
public TransactionTestFixture gasPremium(final Optional<Wei> gasPremium) {
this.gasPremium = gasPremium;
public TransactionTestFixture maxPriorityFeePerGas(final Optional<Wei> maxPriorityFeePerGas) {
this.maxPriorityFeePerGas = maxPriorityFeePerGas;
return this;
}
public TransactionTestFixture feeCap(final Optional<Wei> feeCap) {
this.feeCap = feeCap;
public TransactionTestFixture maxFeePerGas(final Optional<Wei> maxFeePerGas) {
this.maxFeePerGas = maxFeePerGas;
return this;
}
}

@ -32,7 +32,7 @@ public class TransactionBuilderTest {
public void guessTypeCanGuessAllTypes() {
final BlockDataGenerator gen = new BlockDataGenerator();
final Transaction.Builder frontierBuilder = Transaction.builder();
final Transaction.Builder eip1559Builder = Transaction.builder().feeCap(Wei.of(5));
final Transaction.Builder eip1559Builder = Transaction.builder().maxFeePerGas(Wei.of(5));
final Transaction.Builder accessListBuilder =
Transaction.builder()
.accessList(List.of(new AccessListEntry(gen.address(), List.of(gen.bytes32()))));

@ -53,9 +53,9 @@ public class TransactionEIP1559Test {
.nonce(0)
.value(Wei.ZERO)
.gasLimit(30000)
.gasPremium(Wei.of(2))
.maxPriorityFeePerGas(Wei.of(2))
.payload(Bytes.EMPTY.trimLeadingZeros())
.feeCap(Wei.of(new BigInteger("5000000000", 10)))
.maxFeePerGas(Wei.of(new BigInteger("5000000000", 10)))
.gasPrice(null)
.to(Address.fromHexString("0x000000000000000000000000000000000000aaaa"))
.accessList(accessListEntries)

@ -58,8 +58,8 @@ public class TransactionDecoderTest {
TransactionDecoder.decodeForWire(RLP.input(Bytes.fromHexString(FRONTIER_TX_RLP)));
assertThat(transaction).isNotNull();
assertThat(transaction.getGasPrice()).isEqualByComparingTo(Wei.of(50L));
assertThat(transaction.getGasPremium()).isEmpty();
assertThat(transaction.getFeeCap()).isEmpty();
assertThat(transaction.getMaxPriorityFeePerGas()).isEmpty();
assertThat(transaction.getMaxFeePerGas()).isEmpty();
}
@Test
@ -67,8 +67,8 @@ public class TransactionDecoderTest {
final Transaction transaction =
TransactionDecoder.decodeForWire(RLP.input(Bytes.fromHexString(EIP1559_TX_RLP)));
assertThat(transaction).isNotNull();
assertThat(transaction.getGasPremium()).hasValue(Wei.of(2L));
assertThat(transaction.getFeeCap()).hasValue(Wei.of(new BigInteger("5000000000", 10)));
assertThat(transaction.getMaxPriorityFeePerGas()).hasValue(Wei.of(2L));
assertThat(transaction.getMaxFeePerGas()).hasValue(Wei.of(new BigInteger("5000000000", 10)));
ExperimentalEIPs.eip1559Enabled = ExperimentalEIPs.EIP1559_ENABLED_DEFAULT_VALUE;
}
}

@ -46,8 +46,8 @@ public class TransactionPriceCalculatorTest {
private final TransactionPriceCalculator transactionPriceCalculator;
private final TransactionType transactionType;
private final Wei gasPrice;
private final Wei gasPremium;
private final Wei feeCap;
private final Wei maxPriorityFeePerGas;
private final Wei maxFeePerGas;
private final Optional<Long> baseFee;
private final Wei expectedPrice;
@ -55,15 +55,15 @@ public class TransactionPriceCalculatorTest {
final TransactionPriceCalculator transactionPriceCalculator,
final TransactionType transactionType,
final Wei gasPrice,
final Wei gasPremium,
final Wei feeCap,
final Wei maxPriorityFeePerGas,
final Wei maxFeePerGas,
final Optional<Long> baseFee,
final Wei expectedPrice) {
this.transactionPriceCalculator = transactionPriceCalculator;
this.transactionType = transactionType;
this.gasPrice = gasPrice;
this.gasPremium = gasPremium;
this.feeCap = feeCap;
this.maxPriorityFeePerGas = maxPriorityFeePerGas;
this.maxFeePerGas = maxFeePerGas;
this.baseFee = baseFee;
this.expectedPrice = expectedPrice;
}
@ -98,7 +98,7 @@ public class TransactionPriceCalculatorTest {
Optional.of(150L),
Wei.of(578L)
},
// EIP-1559 must return gas premium + base fee
// EIP-1559 must return maxPriorityFeePerGas + base fee
{
EIP_1559_CALCULATOR,
EIP1559,
@ -129,8 +129,8 @@ public class TransactionPriceCalculatorTest {
.type(transactionType)
.accessList(transactionType == ACCESS_LIST ? Collections.emptyList() : null)
.gasPrice(gasPrice)
.gasPremium(gasPremium)
.feeCap(feeCap)
.maxPriorityFeePerGas(maxPriorityFeePerGas)
.maxFeePerGas(maxFeePerGas)
.build(),
baseFee))
.isEqualByComparingTo(expectedPrice);

@ -287,8 +287,8 @@ public class MainnetTransactionValidatorTest {
final Transaction transaction =
new TransactionTestFixture()
.type(TransactionType.EIP1559)
.gasPremium(Optional.of(Wei.of(3)))
.feeCap(Optional.of(Wei.of(6)))
.maxPriorityFeePerGas(Optional.of(Wei.of(3)))
.maxFeePerGas(Optional.of(Wei.of(6)))
.gasLimit(21000)
.chainId(Optional.of(BigInteger.ONE))
.createTransaction(senderKeys);
@ -321,8 +321,8 @@ public class MainnetTransactionValidatorTest {
final Transaction transaction =
new TransactionTestFixture()
.type(TransactionType.EIP1559)
.gasPremium(Optional.of(Wei.of(1)))
.feeCap(Optional.of(Wei.of(1)))
.maxPriorityFeePerGas(Optional.of(Wei.of(1)))
.maxFeePerGas(Optional.of(Wei.of(1)))
.chainId(Optional.of(BigInteger.ONE))
.createTransaction(senderKeys);
final Optional<Long> basefee = Optional.of(150000L);
@ -345,8 +345,8 @@ public class MainnetTransactionValidatorTest {
defaultGoQuorumCompatibilityMode);
final Transaction transaction =
new TransactionTestFixture()
.gasPremium(Optional.of(Wei.of(1)))
.feeCap(Optional.of(Wei.of(1)))
.maxPriorityFeePerGas(Optional.of(Wei.of(1)))
.maxFeePerGas(Optional.of(Wei.of(1)))
.chainId(Optional.empty())
.createTransaction(senderKeys);
final Optional<Long> basefee = Optional.of(150000L);

@ -397,8 +397,8 @@ public class TransactionSimulatorTest {
.nonce(1L)
.gasPrice(callParameter.getGasPrice())
.gasLimit(callParameter.getGasLimit())
.feeCap(callParameter.getFeeCap().orElseThrow())
.gasPremium(callParameter.getGasPremium().orElseThrow())
.maxFeePerGas(callParameter.getMaxFeePerGas().orElseThrow())
.maxPriorityFeePerGas(callParameter.getMaxPriorityFeePerGas().orElseThrow())
.to(callParameter.getTo())
.sender(callParameter.getFrom())
.value(callParameter.getValue())

@ -109,12 +109,14 @@ public class TransactionReplacementByPriceRuleTest {
return transactionInfo;
}
private static TransactionInfo eip1559Tx(final long gasPremium, final long feeCap) {
private static TransactionInfo eip1559Tx(
final long maxPriorityFeePerGas, final long maxFeePerGas) {
final TransactionInfo transactionInfo = mock(TransactionInfo.class);
final Transaction transaction = mock(Transaction.class);
when(transaction.getType()).thenReturn(TransactionType.EIP1559);
when(transaction.getGasPremium()).thenReturn(Optional.of(Wei.of(gasPremium)));
when(transaction.getFeeCap()).thenReturn(Optional.of(Wei.of(feeCap)));
when(transaction.getMaxPriorityFeePerGas())
.thenReturn(Optional.of(Wei.of(maxPriorityFeePerGas)));
when(transaction.getMaxFeePerGas()).thenReturn(Optional.of(Wei.of(maxFeePerGas)));
when(transactionInfo.getTransaction()).thenReturn(transaction);
return transactionInfo;
}

@ -34,6 +34,7 @@ dependencies {
implementation project(':metrics:core')
implementation project(':util')
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.google.guava:guava'
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'org.apache.tuweni:bytes'

@ -77,7 +77,7 @@ public class RetestethService {
new EthGetTransactionCount(
retestethContext::getBlockchainQueries,
retestethContext::getPendingTransactions,
true),
false),
new DebugStorageRangeAt(
retestethContext::getBlockchainQueries, retestethContext::getBlockReplay, true),
new TestModifyTimestamp(retestethContext),

@ -146,7 +146,6 @@ public class TestSetChainParams implements JsonRpcMethod {
.getString("baseFeePerGas"))
.map(Long::decode)
.orElse(ExperimentalEIPs.EIP1559_BASEFEE_DEFAULT_VALUE);
maybeMove(genesis, "gasTarget", chainParamsJson, "gasLimit");
}
// strip out precompiles with zero balance

@ -2,7 +2,7 @@
"genesis" : {
"author" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"difficulty" : "0x020000",
"gasTarget" : "0x04d2",
"gasLimit" : "0x04d2",
"baseFeePerGas" : "0x3039",
"extraData" : "0x00",
"timestamp" : "0x00",

@ -64,7 +64,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'Zgu1UsdzijNYhkIN4ryqMlAU292gWh6661GWdf5bi14='
knownHash = 'VhijQ2/y9GqGlgxreOf6nIXZB6eSNb2m7uhibCPPJvI='
}
check.dependsOn('checkAPIChanges')

@ -59,10 +59,10 @@ public interface Transaction {
* A scalar value equal to the number of Wei to be paid on top of base fee, as specified in
* EIP-1559.
*
* @return the quantity of Wei for gas premium.
* @return the quantity of Wei for max fee per gas
*/
@Unstable
default Optional<Quantity> getGasPremium() {
default Optional<Quantity> getMaxPriorityFeePerGas() {
return Optional.empty();
}
@ -72,7 +72,7 @@ public interface Transaction {
* @return the quantity of Wei for fee cap.
*/
@Unstable
default Optional<Quantity> getFeeCap() {
default Optional<Quantity> getMaxFeePerGas() {
return Optional.empty();
}

Loading…
Cancel
Save