Skip to content

Commit

Permalink
Merge branch 'main' into blockchain-metrics-counters
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarla authored May 31, 2024
2 parents f88daef + 64de9f2 commit fb50ac0
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 36 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

env:
GRADLE_OPTS: "-Xmx6g"
total-runners: 10
total-runners: 12

jobs:
acceptanceTestEthereum:
Expand All @@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: true
matrix:
runner_index: [0,1,2,3,4,5,6,7,8,9]
runner_index: [0,1,2,3,4,5,6,7,8,9,10,11]
steps:
- name: Checkout Repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
Expand All @@ -45,15 +45,6 @@ jobs:
run: ./gradlew acceptanceTestNotPrivacy --test-dry-run -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: Extract current test list
run: mkdir tmp; find . -type f -name TEST-*.xml | xargs -I{} bash -c "xmlstarlet sel -t -v '/testsuite/@name' '{}'; echo ' acceptanceTestNotPrivacy'" | tee tmp/currentTests.list
- name: Get acceptance test reports (Support transition) # can be removed after PR is merged
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
with:
branch: main
name_is_regexp: true
name: 'acceptance-node-\d+-test-results'
path: tmp/junit-xml-reports-downloaded
if_no_artifact_found: true
- name: Get acceptance test reports
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/pre-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,6 @@ jobs:
run: ./gradlew test --test-dry-run -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: Extract current test list
run: mkdir tmp; find . -type f -name TEST-*.xml | xargs -I{} bash -c "xmlstarlet sel -t -v '/testsuite/@name' '{}'; echo '{}' | sed 's#\./\(.*\)/build/test-results/.*# \1#'" | tee tmp/currentTests.list
- name: Get unit test reports (Support transition) # can be removed after PR is merged
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
with:
branch: main
name_is_regexp: true
name: 'unit-.*-test-results'
path: tmp/junit-xml-reports-downloaded
if_no_artifact_found: true
- name: Get unit test reports
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/splitTestsByTime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ for line in "${sorted[@]}"; do
module_dir=${line_parts[2]}
test_with_module="$test_name $module_dir"

# temp deduplication during the transition phase
# deduplication check to avoid executing a test multiple time
if grep -F -q --line-regexp "$test_with_module" tmp/processedTests.list
then
continue
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

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;
Expand Down Expand Up @@ -248,7 +249,13 @@ public BigInteger getS() {
}

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public TransactionCompleteResult(final TransactionWithMetadata tx) {
this.v =
(transactionType == TransactionType.ACCESS_LIST
|| transactionType == TransactionType.EIP1559)
? Quantity.create(transaction.getV())
? Quantity.create(transaction.getYParity())
: null;
}
this.value = Quantity.create(transaction.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public TransactionPendingResult(final Transaction transaction) {
this.v =
(transactionType == TransactionType.ACCESS_LIST
|| transactionType == TransactionType.EIP1559)
? Quantity.create(transaction.getV())
? Quantity.create(transaction.getYParity())
: null;
}
this.value = Quantity.create(transaction.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public PendingTransactionDetailResult(final Transaction tx) {
this.v =
(transactionType == TransactionType.ACCESS_LIST
|| transactionType == TransactionType.EIP1559)
? Quantity.create(tx.getV())
? Quantity.create(tx.getYParity())
: null;
}
this.value = Quantity.create(tx.getValue());
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -13,6 +13,14 @@
"nonce": "0x0000000000000000",
"stateRoot": "0x0d3c456bb68669bad05da3a1a766daab236c9df1da8f74edf5ebe9383f00084c",
"totalDifficulty": "0x427c00",
"transactions": [
{
"r": "0x8abbfbd4c5f2a13a8d5ed394ac50bac7d678f83a23f645818492f76e8ee17ab3",
"s": "0x7bd38c6929235f775d68b45bd7dea7981264f9a265b6bea97b070e15be88389c",
"v": "0x0",
"yParity": "0x0"
}
],
"withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3",
"withdrawals": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"type": "0x2",
"status": "0x1",
"yParity": "0x0",
"v": "0x25"
"v": "0x0"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"type": "0x2",
"value": "0x0",
"yParity": "0x0",
"v" : "0x25",
"v" : "0x0",
"r": "0x8abbfbd4c5f2a13a8d5ed394ac50bac7d678f83a23f645818492f76e8ee17ab3",
"s": "0x7bd38c6929235f775d68b45bd7dea7981264f9a265b6bea97b070e15be88389c"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,10 @@ public BigInteger getS() {

@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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public void headerNewerThanCurrentSystemFailsValidation() {
final BlockHeader parent = headerBuilder.buildHeader();

// Create header for validation with a timestamp in the future (1 second too far away)
headerBuilder.timestamp(parent.getTimestamp() + acceptableClockDrift + 1);
// (+1 to avoid spurious failures)
headerBuilder.timestamp(parent.getTimestamp() + acceptableClockDrift + 2);
final BlockHeader header = headerBuilder.buildHeader();

assertThat(uut00.validate(header, parent)).isFalse();
Expand All @@ -124,7 +125,7 @@ public void futureHeadersAreValidIfTimestampWithinTolerance() {
TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS));
final BlockHeader parent = headerBuilder.buildHeader();

// Create header for validation with a timestamp in the future (1 second too far away)
// Create header for validation with a timestamp an acceptable amount in the future
// (-1) to prevent spurious failures
headerBuilder.timestamp(parent.getTimestamp() + acceptableClockDrift - 1);
final BlockHeader header = headerBuilder.buildHeader();
Expand Down

0 comments on commit fb50ac0

Please sign in to comment.