Fix long type usage for jsontestsuite & gaslimit
This commit is contained in:
parent
a7b281007d
commit
6669523825
|
@ -507,7 +507,7 @@ public class TestRunner {
|
||||||
|
|
||||||
byte[] nonceBytes = ByteUtil.longToBytes(tx.nonce);
|
byte[] nonceBytes = ByteUtil.longToBytes(tx.nonce);
|
||||||
byte[] gasPriceBytes = ByteUtil.longToBytes(tx.gasPrice);
|
byte[] gasPriceBytes = ByteUtil.longToBytes(tx.gasPrice);
|
||||||
byte[] gasBytes = ByteUtil.longToBytes(tx.gasLimit);
|
byte[] gasBytes = tx.gasLimit;
|
||||||
byte[] valueBytes = ByteUtil.longToBytes(tx.value);
|
byte[] valueBytes = ByteUtil.longToBytes(tx.value);
|
||||||
byte[] toAddr = tx.getTo();
|
byte[] toAddr = tx.getTo();
|
||||||
byte[] data = tx.getData();
|
byte[] data = tx.getData();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.ethereum.jsontestsuite;
|
package org.ethereum.jsontestsuite;
|
||||||
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
import java.math.BigInteger;
|
||||||
import static org.ethereum.util.ByteUtil.toHexString;
|
import static org.ethereum.util.ByteUtil.toHexString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ import static org.ethereum.util.ByteUtil.toHexString;
|
||||||
public class Transaction {
|
public class Transaction {
|
||||||
|
|
||||||
byte[] data;
|
byte[] data;
|
||||||
long gasLimit;
|
byte[] gasLimit;
|
||||||
long gasPrice;
|
long gasPrice;
|
||||||
long nonce;
|
long nonce;
|
||||||
byte[] secretKey;
|
byte[] secretKey;
|
||||||
|
@ -40,9 +40,8 @@ public class Transaction {
|
||||||
String toStr = callCreateJSON.get("to").toString();
|
String toStr = callCreateJSON.get("to").toString();
|
||||||
String valueStr = callCreateJSON.get("value").toString();
|
String valueStr = callCreateJSON.get("value").toString();
|
||||||
|
|
||||||
|
|
||||||
this.data = Utils.parseData(dataStr);
|
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.gasPrice = Utils.parseLong(gasPriceStr);
|
||||||
this.nonce = Utils.parseLong(nonceStr);
|
this.nonce = Utils.parseLong(nonceStr);
|
||||||
this.secretKey = Utils.parseData(secretKeyStr);
|
this.secretKey = Utils.parseData(secretKeyStr);
|
||||||
|
@ -54,7 +53,7 @@ public class Transaction {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getGasLimit() {
|
public byte[] getGasLimit() {
|
||||||
return gasLimit;
|
return gasLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class GitHubStateTest {
|
||||||
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
|
GitHubJSONTestSuite.runGitHubJsonStateTest(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void stRefundTest() throws ParseException { // [V]
|
public void stRefundTest() throws ParseException { // [V]
|
||||||
|
|
||||||
|
@ -79,7 +78,6 @@ public class GitHubStateTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void stSpecialTest() throws ParseException { // [V]
|
public void stSpecialTest() throws ParseException { // [V]
|
||||||
|
|
||||||
|
@ -110,13 +108,13 @@ public class GitHubStateTest {
|
||||||
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
|
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test // todo: fix: excluded test
|
@Test // todo: fix: excluded test
|
||||||
public void stTransactionTest() throws ParseException {
|
public void stTransactionTest() throws ParseException {
|
||||||
|
|
||||||
Set<String> excluded = new HashSet<>();
|
Set<String> excluded = new HashSet<>();
|
||||||
//todo: it goes OOG, because no gasLimit is given. So it does not change the state.
|
//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");
|
String json = JSONReader.loadJSON("StateTests/stTransactionTest.json");
|
||||||
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
|
GitHubJSONTestSuite.runGitHubJsonStateTest(json, excluded);
|
||||||
|
|
Loading…
Reference in New Issue