Fix long type usage for jsontestsuite & gaslimit

This commit is contained in:
Faiz Khan 2015-02-07 06:36:42 -06:00
parent a7b281007d
commit 6669523825
3 changed files with 6 additions and 9 deletions

View File

@ -507,7 +507,7 @@ public class TestRunner {
byte[] nonceBytes = ByteUtil.longToBytes(tx.nonce);
byte[] gasPriceBytes = ByteUtil.longToBytes(tx.gasPrice);
byte[] gasBytes = ByteUtil.longToBytes(tx.gasLimit);
byte[] gasBytes = tx.gasLimit;
byte[] valueBytes = ByteUtil.longToBytes(tx.value);
byte[] toAddr = tx.getTo();
byte[] data = tx.getData();

View File

@ -1,7 +1,7 @@
package org.ethereum.jsontestsuite;
import org.json.simple.JSONObject;
import java.math.BigInteger;
import static org.ethereum.util.ByteUtil.toHexString;
/**
@ -11,7 +11,7 @@ import static org.ethereum.util.ByteUtil.toHexString;
public class Transaction {
byte[] data;
long gasLimit;
byte[] gasLimit;
long gasPrice;
long nonce;
byte[] secretKey;
@ -40,9 +40,8 @@ public class Transaction {
String toStr = callCreateJSON.get("to").toString();
String valueStr = callCreateJSON.get("value").toString();
this.data = Utils.parseData(dataStr);
this.gasLimit = Utils.parseLong(gasLimitStr);
this.gasLimit = !gasLimitStr.isEmpty() ? new BigInteger(gasLimitStr).toByteArray() : new byte[]{0};
this.gasPrice = Utils.parseLong(gasPriceStr);
this.nonce = Utils.parseLong(nonceStr);
this.secretKey = Utils.parseData(secretKeyStr);
@ -54,7 +53,7 @@ public class Transaction {
return data;
}
public long getGasLimit() {
public byte[] getGasLimit() {
return gasLimit;
}

View File

@ -70,7 +70,6 @@ public class GitHubStateTest {
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
}
@Ignore
@Test
public void stRefundTest() throws ParseException { // [V]
@ -79,7 +78,6 @@ public class GitHubStateTest {
}
@Ignore
@Test
public void stSpecialTest() throws ParseException { // [V]
@ -110,13 +108,13 @@ public class GitHubStateTest {
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
}
@Ignore
@Test // todo: fix: excluded test
public void stTransactionTest() throws ParseException {
Set<String> excluded = new HashSet<>();
//todo: it goes OOG, because no gasLimit is given. So it does not change the state.
excluded.add("TransactionFromCoinbaseHittingBlockGasLimit1");
String json = JSONReader.loadJSON("StateTests/stTransactionTest.json");
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);