Undo #6819 - make yParity and v match (#7139)

Undo PR #6819 -
for 2030 and 1559 transactions both v and yParity will be provided,
and they will be the same number.

Signed-off-by: Danno Ferrin <danno@numisight.com>
pull/7172/head
Danno Ferrin 6 months ago committed by GitHub
parent 812886660f
commit e68c4e1d80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 9
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/pojoadapter/TransactionAdapter.java
  3. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionCompleteResult.java
  4. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPendingResult.java
  5. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/pending/PendingTransactionDetailResult.java
  6. 29
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/graphql/eth_getBlock_frontier.json
  7. 10
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/graphql/eth_getBlock_shanghai.json
  8. 2
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/graphql/eth_getTransaction_type2.json
  9. 2
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getBlockByNumber_complete_shanghai.json
  10. 8
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java

@ -28,6 +28,7 @@
### Bug fixes
- Fix parsing `gasLimit` parameter when its value is > `Long.MAX_VALUE` [#7116](https://github.com/hyperledger/besu/pull/7116)
- Skip validation of withdrawals when importing BFT blocks since withdrawals don't apply to BFT chains [#7115](https://github.com/hyperledger/besu/pull/7115)
- Make `v` abd `yParity` match in type 1 and 2 transactions in JSON-RPC and GraphQL [#7139](https://github.com/hyperledger/besu/pull/7139)
### Download Links
https://github.com/hyperledger/besu/releases/tag/24.5.2

@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.api.graphql.internal.pojoadapter;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.VersionedHash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLContextType;
@ -248,7 +249,13 @@ public class TransactionAdapter extends AdapterBase {
}
public Optional<BigInteger> getV() {
return Optional.ofNullable(transactionWithMetadata.getTransaction().getV());
BigInteger v = transactionWithMetadata.getTransaction().getV();
return Optional.ofNullable(
v == null
&& (transactionWithMetadata.getTransaction().getType().getEthSerializedType()
< TransactionType.BLOB.getEthSerializedType())
? transactionWithMetadata.getTransaction().getYParity()
: v);
}
public Optional<BigInteger> getYParity() {

@ -126,7 +126,7 @@ public class TransactionCompleteResult implements TransactionResult {
this.v =
(transactionType == TransactionType.ACCESS_LIST
|| transactionType == TransactionType.EIP1559)
? Quantity.create(transaction.getV())
? Quantity.create(transaction.getYParity())
: null;
}
this.value = Quantity.create(transaction.getValue());

@ -116,7 +116,7 @@ public class TransactionPendingResult implements TransactionResult {
this.v =
(transactionType == TransactionType.ACCESS_LIST
|| transactionType == TransactionType.EIP1559)
? Quantity.create(transaction.getV())
? Quantity.create(transaction.getYParity())
: null;
}
this.value = Quantity.create(transaction.getValue());

@ -73,7 +73,7 @@ public class PendingTransactionDetailResult implements JsonRpcResult {
this.v =
(transactionType == TransactionType.ACCESS_LIST
|| transactionType == TransactionType.EIP1559)
? Quantity.create(tx.getV())
? Quantity.create(tx.getYParity())
: null;
}
this.value = Quantity.create(tx.getValue());

@ -0,0 +1,29 @@
{
"request": "{block (number: 32) { difficulty extraData miner { address } mixHash nonce stateRoot totalDifficulty transactions { gasPrice type yParity v r s} }} ",
"response": {
"data": {
"block": {
"difficulty": "0x207c0",
"extraData": "0x",
"miner": {
"address": "0x8888f1f195afa192cfee860698584c030f4c9db1"
},
"mixHash": "0x4edd77bfff565659bb0ae09421918e4def65d938a900eb94230eb01f5ce80c99",
"nonce": "0xdb063000b00e8026",
"stateRoot": "0xf65f3dd13f72f5fa5607a5224691419969b4f4bae7a00a6cdb853f2ca9eeb1be",
"totalDifficulty": "0x427c00",
"transactions": [
{
"gasPrice": "0x1",
"type": "0x0",
"yParity": null,
"v": "0x1b",
"r": "0x705b002a7df60707d33812e0298411721be20ea5a2f533707295140d89263b79",
"s": "0x78024390784f24160739533b3ceea2698289a02afd9cc768581b4aa3d5f4b105"
}
]
}
}
},
"statusCode": 200
}

@ -1,5 +1,5 @@
{
"request": "{block (number : 33) { baseFeePerGas difficulty extraData miner { address } mixHash nonce stateRoot totalDifficulty withdrawalsRoot withdrawals { address amount index validator } }} ",
"request": "{block (number : 33) { baseFeePerGas difficulty extraData miner { address } mixHash nonce stateRoot totalDifficulty transactions { r s v yParity } withdrawalsRoot withdrawals { address amount index validator } }} ",
"response": {
"data": {
"block": {
@ -13,6 +13,14 @@
"nonce": "0x0000000000000000",
"stateRoot": "0x0d3c456bb68669bad05da3a1a766daab236c9df1da8f74edf5ebe9383f00084c",
"totalDifficulty": "0x427c00",
"transactions": [
{
"r": "0x8abbfbd4c5f2a13a8d5ed394ac50bac7d678f83a23f645818492f76e8ee17ab3",
"s": "0x7bd38c6929235f775d68b45bd7dea7981264f9a265b6bea97b070e15be88389c",
"v": "0x0",
"yParity": "0x0"
}
],
"withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3",
"withdrawals": [
{

@ -17,7 +17,7 @@
"type": "0x2",
"status": "0x1",
"yParity": "0x0",
"v": "0x25"
"v": "0x0"
}
}
},

@ -58,7 +58,7 @@
"type": "0x2",
"value": "0x0",
"yParity": "0x0",
"v" : "0x25",
"v" : "0x0",
"r": "0x8abbfbd4c5f2a13a8d5ed394ac50bac7d678f83a23f645818492f76e8ee17ab3",
"s": "0x7bd38c6929235f775d68b45bd7dea7981264f9a265b6bea97b070e15be88389c"
}

@ -495,14 +495,10 @@ public class Transaction
@Override
public BigInteger getV() {
if (transactionType != null
&& transactionType != TransactionType.FRONTIER
&& transactionType != TransactionType.ACCESS_LIST
&& transactionType != TransactionType.EIP1559) {
// Newer transaction type lacks V, so return null
if (transactionType != null && transactionType != TransactionType.FRONTIER) {
// EIP-2718 typed transaction, use yParity:
return null;
} else {
// Mandatory for legacy, optional for EIP-2930 and EIP-1559 TXes, prohibited for all others.
final BigInteger recId = BigInteger.valueOf(signature.getRecId());
return chainId
.map(bigInteger -> recId.add(REPLAY_PROTECTED_V_BASE).add(TWO.multiply(bigInteger)))

Loading…
Cancel
Save