Skip to content

Commit

Permalink
Update Reference Tests
Browse files Browse the repository at this point in the history
* update submodule to include test for PR ethereum/tests#603
* update code to support Constantinople and ConstantinopleFix
* update RevertPrecompiledTouch blacklist specification
  • Loading branch information
shemnon committed Jul 3, 2019
1 parent ddb9196 commit e3e1582
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public void constantinople() {
milestone("Constantinople");
}

@Test
public void constantinopleFix() {
milestone("ConstantinopleFix");
}

public void milestone(final String milestone) {

final TransactionTestCaseSpec.Expectation expected = spec.expectation(milestone);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import tech.pegasys.pantheon.util.bytes.BytesValue;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down Expand Up @@ -61,26 +62,22 @@ public Address getSender() {

private final BytesValue rlp;

@SuppressWarnings("unchecked")
@JsonCreator
public TransactionTestCaseSpec(
@JsonProperty("Frontier") final Expectation frontierExpectation,
@JsonProperty("Homestead") final Expectation homesteadExpectation,
@JsonProperty("EIP150") final Expectation EIP150Expectation,
@JsonProperty("EIP158") final Expectation EIP158Expectation,
@JsonProperty("Byzantium") final Expectation byzantiumExpectation,
@JsonProperty("Constantinople") final Expectation constantinopleExpectation,
@JsonProperty("rlp") final String rlp) {
public TransactionTestCaseSpec(final Map<String, Object> props) {
expectations = new HashMap<>();
expectations.put("Frontier", frontierExpectation);
expectations.put("Homestead", homesteadExpectation);
expectations.put("EIP150", EIP150Expectation);
expectations.put("EIP158", EIP158Expectation);
expectations.put("Byzantium", byzantiumExpectation);
expectations.put("Constantinople", constantinopleExpectation);
for (final Map.Entry<String, Object> entry : props.entrySet()) {
if ("rlp".equals(entry.getKey())) continue;

final Map<String, Object> expectation = (Map<String, Object>) entry.getValue();
expectations.put(
entry.getKey(),
new Expectation((String) expectation.get("hash"), (String) expectation.get("sender")));
}

BytesValue parsedRlp = null;
try {
parsedRlp = BytesValue.fromHexString(rlp);
parsedRlp = BytesValue.fromHexString(props.get("rlp").toString());
} catch (final IllegalArgumentException e) {
// Some test cases include rlp "hex strings" with invalid characters
// In this case, just set rlp to null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ public ParsedExtraData parseExtraData(final BlockHeader header) {
@JsonIgnoreProperties({
"expectExceptionByzantium",
"expectExceptionConstantinople",
"expectExceptionConstantinopleFix",
"expectExceptionIstanbul",
"expectExceptionEIP150",
"expectExceptionEIP158",
"expectExceptionFrontier",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class BlockchainReferenceTestTools {
}

// Known bad test.
params.blacklist("RevertPrecompiledTouch_d0g0v0_(EIP158|Byzantium)");
params.blacklist("RevertPrecompiledTouch(_storage)?_d(0|3)g0v0_(EIP158|Byzantium|Constantinople|ConstantinopleFix)");

// Consumes a huge amount of memory
params.blacklist(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private static TransactionProcessor transactionProcessor(final String name) {
params.blacklistAll();
}
// Known incorrect test.
params.blacklist("RevertPrecompiledTouch-(EIP158|Byzantium)");
params.blacklist("RevertPrecompiledTouch(_storage)?-(EIP158|Byzantium|Constantinople|ConstantinopleFix)");
// Gas integer value is too large to construct a valid transaction.
params.blacklist("OverflowGasRequire");
// Consumes a huge amount of memory
Expand Down

0 comments on commit e3e1582

Please sign in to comment.