test fixing
This commit is contained in:
parent
1bf087f9f7
commit
a2b00ff8dd
|
@ -1,6 +1,5 @@
|
|||
package org.ethereum.jsontestsuite;
|
||||
|
||||
import org.ethereum.crypto.HashUtil;
|
||||
import org.ethereum.db.ByteArrayWrapper;
|
||||
import org.ethereum.db.ContractDetails;
|
||||
import org.ethereum.db.RepositoryImpl;
|
||||
|
@ -228,7 +227,7 @@ public class TestRunner {
|
|||
|
||||
/* asset logs */
|
||||
List<LogInfo> logResult = program.getResult().getLogInfoList();
|
||||
Iterator<byte[]> itr = logs.getLogsRLPSHA3KeyIterator();
|
||||
Iterator<byte[]> itr = logs.getLogsBloomKeyIterator();
|
||||
while(itr.hasNext()) {
|
||||
byte[] expectedLogKey = itr.next();
|
||||
System.out.println("Expected key " + Hex.toHexString(expectedLogKey));
|
||||
|
|
|
@ -60,10 +60,10 @@ public enum OpCode {
|
|||
OR(0x17, 2),
|
||||
/** (0x18) Bitwise XOR operation */
|
||||
XOR(0x18, 2),
|
||||
/** (0x1a) Bitwise NOT operationr */
|
||||
NOT(0x19, 1),
|
||||
/** (0x19) Retrieve single byte from word */
|
||||
BYTE(0x1a, 2),
|
||||
BYTE(0x19, 2),
|
||||
/** (0x1a) Bitwise NOT operationr */
|
||||
NOT(0x1a, 1),
|
||||
|
||||
/* Cryptographic Operations */
|
||||
|
||||
|
|
|
@ -985,7 +985,7 @@ public class VM {
|
|||
|
||||
vmCounter++;
|
||||
} catch (RuntimeException e) {
|
||||
logger.warn("VM halted", e.getMessage());
|
||||
logger.warn("VM halted: [{}]", e.toString());
|
||||
program.spendAllGas();
|
||||
program.stop();
|
||||
throw e;
|
||||
|
|
|
@ -176,8 +176,9 @@ public class BlockTest {
|
|||
assertEquals(actualGasLimit, calcGasLimit);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testScenario1() throws URISyntaxException, IOException {
|
||||
public void testScenario5() throws URISyntaxException, IOException {
|
||||
|
||||
BlockchainImpl blockchain = (BlockchainImpl)worldManager.getBlockchain();
|
||||
|
||||
|
@ -198,90 +199,13 @@ public class BlockTest {
|
|||
|
||||
logger.info("asserting root state is: {}", Hex.toHexString( root ));
|
||||
|
||||
//expected root: 13a5e615365c86438d98df5a2ca5bf1173ab4ea33be808fde7b94e47e9534549
|
||||
assertArrayEquals(root, worldManager.getRepository().getRoot());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScenario2() throws URISyntaxException, IOException {
|
||||
|
||||
BlockchainImpl blockchain = (BlockchainImpl)worldManager.getBlockchain();
|
||||
|
||||
URL scenario1 = ClassLoader
|
||||
.getSystemResource("blockload/scenario2.dmp");
|
||||
|
||||
File file = new File(scenario1.toURI());
|
||||
List<String> strData = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
|
||||
|
||||
byte[] root = Genesis.getInstance().getStateRoot();
|
||||
for(String blockRLP : strData){
|
||||
Block block = new Block(
|
||||
Hex.decode(blockRLP));
|
||||
logger.info("sending block.hash: {}", Hex.toHexString( block.getHash() ));
|
||||
blockchain.tryToConnect(block);
|
||||
root = block.getStateRoot();
|
||||
}
|
||||
|
||||
logger.info("asserting root state is: {}", Hex.toHexString( root ));
|
||||
|
||||
//expected root: 8bbff862199ccf5411c9505598eeba3d76b51e4d391ac1189903b0fcbdd3733b
|
||||
assertArrayEquals(root, worldManager.getRepository().getRoot());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScenario3() throws URISyntaxException, IOException {
|
||||
|
||||
BlockchainImpl blockchain = (BlockchainImpl)worldManager.getBlockchain();
|
||||
|
||||
URL scenario1 = ClassLoader
|
||||
.getSystemResource("blockload/scenario3.dmp");
|
||||
|
||||
File file = new File(scenario1.toURI());
|
||||
List<String> strData = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
|
||||
|
||||
byte[] root = Genesis.getInstance().getStateRoot();
|
||||
for(String blockRLP : strData){
|
||||
Block block = new Block(
|
||||
Hex.decode(blockRLP));
|
||||
logger.info("sending block.hash: {}", Hex.toHexString( block.getHash() ));
|
||||
blockchain.tryToConnect(block);
|
||||
root = block.getStateRoot();
|
||||
}
|
||||
|
||||
logger.info("asserting root state is: {}", Hex.toHexString( root ));
|
||||
|
||||
//expected root: 8bbff862199ccf5411c9505598eeba3d76b51e4d391ac1189903b0fcbdd3733b
|
||||
assertArrayEquals(root, worldManager.getRepository().getRoot());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScenario4() throws URISyntaxException, IOException {
|
||||
|
||||
BlockchainImpl blockchain = (BlockchainImpl)worldManager.getBlockchain();
|
||||
|
||||
URL scenario1 = ClassLoader
|
||||
.getSystemResource("blockload/scenario4.dmp");
|
||||
|
||||
File file = new File(scenario1.toURI());
|
||||
List<String> strData = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
|
||||
|
||||
byte[] root = Genesis.getInstance().getStateRoot();
|
||||
for(String blockRLP : strData){
|
||||
Block block = new Block(
|
||||
Hex.decode(blockRLP));
|
||||
logger.info("sending block.hash: {}", Hex.toHexString( block.getHash() ));
|
||||
blockchain.tryToConnect(block);
|
||||
root = block.getStateRoot();
|
||||
}
|
||||
|
||||
logger.info("asserting root state is: {}", Hex.toHexString( root ));
|
||||
|
||||
//expected root: dedd258f4cee2d1b45f137a2a74a2052e14a6d7fe1b1184be0a6adcec6a1d1d3
|
||||
assertEquals(Hex.toHexString(root),
|
||||
Hex.toHexString(worldManager.getRepository().getRoot()));
|
||||
Hex.toHexString(worldManager.getRepository().getRoot()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testUncleValidGenerationGap() {
|
||||
|
|
|
@ -17,7 +17,7 @@ public class MachineCompileTest {
|
|||
public void test1() {
|
||||
|
||||
String code = "a=2";
|
||||
String expected = "6005600c60003960056000f26002600052";
|
||||
String expected = "6005600c60003960056000f36002600052";
|
||||
String asm = SerpentCompiler.compile(code);
|
||||
byte[] machineCode = SerpentCompiler.compileAssemblyToMachine(asm);
|
||||
byte[] vmReadyCode = SerpentCompiler.encodeMachineCodeForVMRun(machineCode, null);
|
||||
|
@ -30,7 +30,7 @@ public class MachineCompileTest {
|
|||
public void test2() {
|
||||
|
||||
String code = "a=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\na=2\n[asm PUSH10 asm]";
|
||||
String expected = "610100600e6000396101006000f260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005269";
|
||||
String expected = "610100600e6000396101006000f360026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005260026000526002600052600260005269";
|
||||
String asm = SerpentCompiler.compile(code);
|
||||
byte[] machineCode = SerpentCompiler.compileAssemblyToMachine(asm);
|
||||
byte[] vmReadyCode = SerpentCompiler.encodeMachineCodeForVMRun(machineCode, null);
|
||||
|
|
|
@ -1725,10 +1725,12 @@ public class VMTest {
|
|||
public void testJUMP_2() {
|
||||
|
||||
VM vm = new VM();
|
||||
program = new Program(Hex.decode("600C5660CC60DD60EE60FF"), invoke);
|
||||
program = new Program(Hex.decode("600C600C905660CC60DD60EE60FF"), invoke);
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} finally {
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
|
@ -1789,11 +1791,13 @@ public class VMTest {
|
|||
public void testJUMPI_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
program = new Program(Hex.decode("6001602257"), invoke);
|
||||
program = new Program(Hex.decode("60016022909057"), invoke);
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} finally {
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
|
@ -2365,7 +2369,7 @@ public class VMTest {
|
|||
long gas = program.getResult().getGasUsed();
|
||||
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
|
||||
assertEquals(2, gas);
|
||||
assertEquals(3, gas);
|
||||
}
|
||||
|
||||
@Test // EXP OP
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue