Update GeneralStateTestCaseEipSpec for use in linea-arithmetization (#7377)

* Update GeneralStateTestCaseEipSpec for use in linea-arithmetization

Signed-off-by: Gaurav Ahuja <gauravahuja9@gmail.com>

* formatting

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Gaurav Ahuja <gauravahuja9@gmail.com>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/7385/head
Gaurav Ahuja 4 months ago committed by GitHub
parent 30dfa66c1e
commit cf358c0e7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java
  2. 15
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/GeneralStateTestCaseEipSpec.java
  3. 5
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/GeneralStateTestCaseSpec.java
  4. 2
      ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/vm/GeneralStateReferenceTestTools.java

@ -232,7 +232,7 @@ public class StateTestSubCommand implements Runnable {
}
final BlockHeader blockHeader = spec.getBlockHeader();
final Transaction transaction = spec.getTransaction();
final Transaction transaction = spec.getTransaction(0);
final ObjectNode summaryLine = objectMapper.createObjectNode();
if (transaction == null) {
if (parentCommand.showJsonAlloc || parentCommand.showJsonResults) {

@ -18,6 +18,7 @@ import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Transaction;
import java.util.List;
import java.util.function.Supplier;
public class GeneralStateTestCaseEipSpec {
@ -33,7 +34,7 @@ public class GeneralStateTestCaseEipSpec {
// anything
// is run, which isn't friendly and 2) this makes it harder to parallelize this step. Anyway, this
// is why this is a supplier: calling get() actually does the signing.
private final Supplier<Transaction> transactionSupplier;
private final List<Supplier<Transaction>> transactionSuppliers;
private final ReferenceTestWorldState initialWorldState;
@ -51,7 +52,7 @@ public class GeneralStateTestCaseEipSpec {
GeneralStateTestCaseEipSpec(
final String fork,
final Supplier<Transaction> transactionSupplier,
final List<Supplier<Transaction>> transactionSuppliers,
final ReferenceTestWorldState initialWorldState,
final Hash expectedRootHash,
final Hash expectedLogsHash,
@ -61,7 +62,7 @@ public class GeneralStateTestCaseEipSpec {
final int valueIndex,
final String expectException) {
this.fork = fork;
this.transactionSupplier = transactionSupplier;
this.transactionSuppliers = transactionSuppliers;
this.initialWorldState = initialWorldState;
this.expectedRootHash = expectedRootHash;
this.expectedLogsHash = expectedLogsHash;
@ -88,9 +89,13 @@ public class GeneralStateTestCaseEipSpec {
return expectedLogsHash;
}
public Transaction getTransaction() {
public int getTransactionsCount() {
return transactionSuppliers.size();
}
public Transaction getTransaction(final int txIndex) {
try {
return transactionSupplier.get();
return transactionSuppliers.get(txIndex).get();
} catch (RuntimeException re) {
// some tests specify invalid transactions. We throw exceptions in
// GeneralStateTests but they are encoded in BlockchainTests, so we

@ -72,11 +72,12 @@ public class GeneralStateTestCaseSpec {
.stateRoot(p.rootHash)
.blockHeaderFunctions(MAINNET_FUNCTIONS)
.buildBlockHeader();
final Supplier<Transaction> txSupplier = () -> versionedTransaction.get(p.indexes);
final List<Supplier<Transaction>> txSupplierList =
List.of(() -> versionedTransaction.get(p.indexes));
specs.add(
new GeneralStateTestCaseEipSpec(
eip,
txSupplier,
txSupplierList,
initialWorldState,
p.rootHash,
p.logsHash,

@ -120,7 +120,7 @@ public class GeneralStateReferenceTestTools {
public static void executeTest(final GeneralStateTestCaseEipSpec spec) {
final BlockHeader blockHeader = spec.getBlockHeader();
final ReferenceTestWorldState initialWorldState = spec.getInitialWorldState();
final Transaction transaction = spec.getTransaction();
final Transaction transaction = spec.getTransaction(0);
ProtocolSpec protocolSpec = protocolSpec(spec.getFork());
BlockchainReferenceTestTools.verifyJournaledEVMAccountCompatability(initialWorldState, protocolSpec);

Loading…
Cancel
Save