|
|
@ -60,7 +60,9 @@ import org.apache.tuweni.bytes.Bytes32; |
|
|
|
public class StateTestVersionedTransaction { |
|
|
|
public class StateTestVersionedTransaction { |
|
|
|
|
|
|
|
|
|
|
|
private final long nonce; |
|
|
|
private final long nonce; |
|
|
|
private final Wei gasPrice; |
|
|
|
@Nullable private final Wei maxFeePerGas; |
|
|
|
|
|
|
|
@Nullable private final Wei maxPriorityFeePerGas; |
|
|
|
|
|
|
|
@Nullable private final Wei gasPrice; |
|
|
|
@Nullable private final Address to; |
|
|
|
@Nullable private final Address to; |
|
|
|
|
|
|
|
|
|
|
|
private final KeyPair keys; |
|
|
|
private final KeyPair keys; |
|
|
@ -74,7 +76,9 @@ public class StateTestVersionedTransaction { |
|
|
|
* Constructor for populating a mock transaction with json data. |
|
|
|
* Constructor for populating a mock transaction with json data. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param nonce Nonce of the mock transaction. |
|
|
|
* @param nonce Nonce of the mock transaction. |
|
|
|
* @param gasPrice Gas price of the mock transaction. |
|
|
|
* @param gasPrice Gas price of the mock transaction, if not 1559 transaction. |
|
|
|
|
|
|
|
* @param maxFeePerGas Wei fee cap of the mock transaction, if a 1559 transaction. |
|
|
|
|
|
|
|
* @param maxPriorityFeePerGas Wei tip cap of the mock transaction, if a 1559 transaction. |
|
|
|
* @param gasLimit Gas Limit of the mock transaction. |
|
|
|
* @param gasLimit Gas Limit of the mock transaction. |
|
|
|
* @param to Recipient account of the mock transaction. |
|
|
|
* @param to Recipient account of the mock transaction. |
|
|
|
* @param value Amount of ether transferred in the mock transaction. |
|
|
|
* @param value Amount of ether transferred in the mock transaction. |
|
|
@ -86,6 +90,8 @@ public class StateTestVersionedTransaction { |
|
|
|
public StateTestVersionedTransaction( |
|
|
|
public StateTestVersionedTransaction( |
|
|
|
@JsonProperty("nonce") final String nonce, |
|
|
|
@JsonProperty("nonce") final String nonce, |
|
|
|
@JsonProperty("gasPrice") final String gasPrice, |
|
|
|
@JsonProperty("gasPrice") final String gasPrice, |
|
|
|
|
|
|
|
@JsonProperty("maxFeePerGas") final String maxFeePerGas, |
|
|
|
|
|
|
|
@JsonProperty("maxPriorityFeePerGas") final String maxPriorityFeePerGas, |
|
|
|
@JsonProperty("gasLimit") final String[] gasLimit, |
|
|
|
@JsonProperty("gasLimit") final String[] gasLimit, |
|
|
|
@JsonProperty("to") final String to, |
|
|
|
@JsonProperty("to") final String to, |
|
|
|
@JsonProperty("value") final String[] value, |
|
|
|
@JsonProperty("value") final String[] value, |
|
|
@ -95,7 +101,10 @@ public class StateTestVersionedTransaction { |
|
|
|
final List<List<AccessListEntry>> maybeAccessLists) { |
|
|
|
final List<List<AccessListEntry>> maybeAccessLists) { |
|
|
|
|
|
|
|
|
|
|
|
this.nonce = Long.decode(nonce); |
|
|
|
this.nonce = Long.decode(nonce); |
|
|
|
this.gasPrice = Wei.fromHexString(gasPrice); |
|
|
|
this.gasPrice = Optional.ofNullable(gasPrice).map(Wei::fromHexString).orElse(null); |
|
|
|
|
|
|
|
this.maxFeePerGas = Optional.ofNullable(maxFeePerGas).map(Wei::fromHexString).orElse(null); |
|
|
|
|
|
|
|
this.maxPriorityFeePerGas = |
|
|
|
|
|
|
|
Optional.ofNullable(maxPriorityFeePerGas).map(Wei::fromHexString).orElse(null); |
|
|
|
this.to = to.isEmpty() ? null : Address.fromHexString(to); |
|
|
|
this.to = to.isEmpty() ? null : Address.fromHexString(to); |
|
|
|
|
|
|
|
|
|
|
|
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithmFactory.getInstance(); |
|
|
|
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithmFactory.getInstance(); |
|
|
@ -118,14 +127,17 @@ public class StateTestVersionedTransaction { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Transaction get(final GeneralStateTestCaseSpec.Indexes indexes) { |
|
|
|
public Transaction get(final GeneralStateTestCaseSpec.Indexes indexes) { |
|
|
|
|
|
|
|
|
|
|
|
final Transaction.Builder transactionBuilder = |
|
|
|
final Transaction.Builder transactionBuilder = |
|
|
|
Transaction.builder() |
|
|
|
Transaction.builder() |
|
|
|
.nonce(nonce) |
|
|
|
.nonce(nonce) |
|
|
|
.gasPrice(gasPrice) |
|
|
|
|
|
|
|
.gasLimit(gasLimits.get(indexes.gas).asUInt256().toLong()) |
|
|
|
.gasLimit(gasLimits.get(indexes.gas).asUInt256().toLong()) |
|
|
|
.to(to) |
|
|
|
.to(to) |
|
|
|
.value(values.get(indexes.value)) |
|
|
|
.value(values.get(indexes.value)) |
|
|
|
.payload(payloads.get(indexes.data)); |
|
|
|
.payload(payloads.get(indexes.data)); |
|
|
|
|
|
|
|
Optional.ofNullable(gasPrice).ifPresent(transactionBuilder::gasPrice); |
|
|
|
|
|
|
|
Optional.ofNullable(maxFeePerGas).ifPresent(transactionBuilder::maxFeePerGas); |
|
|
|
|
|
|
|
Optional.ofNullable(maxPriorityFeePerGas).ifPresent(transactionBuilder::maxPriorityFeePerGas); |
|
|
|
maybeAccessLists.ifPresent( |
|
|
|
maybeAccessLists.ifPresent( |
|
|
|
accessLists -> |
|
|
|
accessLists -> |
|
|
|
transactionBuilder.accessList(accessLists.get(indexes.data)).chainId(BigInteger.ONE)); |
|
|
|
transactionBuilder.accessList(accessLists.get(indexes.data)).chainId(BigInteger.ONE)); |
|
|
|