Skip to content

Commit

Permalink
Update Reference Tests (hyperledger#1928)
Browse files Browse the repository at this point in the history
Upgrade to Berlin reference tests and activate Berlin in those tests.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
  • Loading branch information
shemnon authored Feb 19, 2021
1 parent 34858df commit 3e6700e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package org.hyperledger.besu.ethereum.mainnet;

import static org.hyperledger.besu.ethereum.core.Address.BLS12_MAP_FP2_TO_G2;
import static org.hyperledger.besu.ethereum.core.Address.BLAKE2B_F_COMPRESSION;

import org.hyperledger.besu.ethereum.core.AccessList;
import org.hyperledger.besu.ethereum.core.Account;
Expand Down Expand Up @@ -69,7 +69,7 @@ protected BerlinGasCalculator(final int maxPrecompile) {
}

public BerlinGasCalculator() {
this(BLS12_MAP_FP2_TO_G2.toArrayUnsafe()[19]);
this(BLAKE2B_F_COMPRESSION.toArrayUnsafe()[19]);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public class BlockchainReferenceTestTools {

// Don't do time consuming tests
params.ignore("CALLBlake2f_MaxRounds.*");

params.ignore(".*[_-]Berlin");
}

public static Collection<Object[]> generateTestParametersForConfig(final String[] filePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ private static MainnetTransactionProcessor transactionProcessor(final String nam

// Don't do time consuming tests
params.ignore("CALLBlake2f_MaxRounds.*");

params.ignore(".*[_-]Berlin");
}

public static Collection<Object[]> generateTestParametersForConfig(final String[] filePath) {
Expand Down
26 changes: 18 additions & 8 deletions ethereum/referencetests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ dependencies {
}

task ('validateReferenceTestSubmodule') {
description = "Checks that the reference tests submodule is not accidentially changed"
description = "Checks that the reference tests submodule is not accidentally changed"
doLast {
def expectedHash = 'b8abaebf5949877ead03e8f74ac03c0ede41d5f7'
def result = new ByteArrayOutputStream()
try {
exec {
Expand All @@ -53,22 +52,33 @@ task ('validateReferenceTestSubmodule') {
// The CI servers have git and that is the only critical place for this failure
expectedHash = ''
}
if (!result.toString().contains(expectedHash)) {
throw new GradleException("""For the Ethereum Reference Tests the git commit did not match what was expected.
def submoduleHashes = [
[
'2fe00d76d97e35aa2df6449b5f567c41cf6f58fc',
'ethereum/referencetests/src/test/resources'
],
[
'1508126ea04cd61495b60db2f036ac823de274b1',
'ethereum/referencetests/src/test/resources']
]
for (def expectedHash : submoduleHashes) {
if (!result.toString().contains(expectedHash[0])) {
throw new GradleException("""For the Ethereum Reference Tests the git commit did not match what was expected.
If this is a deliberate change where you are updating the reference tests
then update "expectedHash" in `ethereum/referencetests/build.gradle` as the
commit hash for this task.
Expected hash : ${expectedHash}
Expected hash : ${expectedHash[0]}
Full git output : ${result}
If this is accidental you can correct the reference test versions with the
following commands:
pushd ethereum/referencetests/src/test/resources
git checkout ${expectedHash}
pushd ${expectedHash[1]}
git checkout ${expectedHash[0]}
cd ..
git add resources
popd""")
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ethereum/referencetests/src/test/resources
Submodule resources updated 8070 files

0 comments on commit 3e6700e

Please sign in to comment.