mirror of
https://github.com/status-im/ethereumj-personal.git
synced 2025-02-13 12:16:23 +00:00
Merge pull request #57 from nicksavers/master
Fix bug in Blockchain and update logging
This commit is contained in:
commit
0f2b74ebf2
@ -2,7 +2,6 @@ package org.ethereum.core;
|
||||
|
||||
import org.ethereum.db.DatabaseImpl;
|
||||
import org.ethereum.manager.WorldManager;
|
||||
import org.ethereum.net.message.StaticMessages;
|
||||
import org.ethereum.net.submit.WalletTransaction;
|
||||
import org.ethereum.util.ByteUtil;
|
||||
import org.iq80.leveldb.DBIterator;
|
||||
@ -86,8 +85,8 @@ public class Blockchain {
|
||||
}
|
||||
|
||||
public Block getByNumber(long blockNr) {
|
||||
return new Block(chainDb.get(ByteUtil.longToBytes(blockNr)));
|
||||
}
|
||||
return new Block(index.get(blockNr));
|
||||
}
|
||||
|
||||
public void addBlocks(List<Block> blocks) {
|
||||
|
||||
@ -99,7 +98,7 @@ public class Blockchain {
|
||||
// if it is the first block to add
|
||||
// check that the parent is the genesis
|
||||
if (index.isEmpty()
|
||||
&& !Arrays.equals(StaticMessages.GENESIS_HASH,
|
||||
&& !Arrays.equals(Genesis.getInstance().getHash(),
|
||||
firstBlockToAdd.getParentHash())) {
|
||||
return;
|
||||
}
|
||||
@ -130,7 +129,7 @@ public class Blockchain {
|
||||
WorldManager.getInstance().applyBlock(block);
|
||||
|
||||
this.chainDb.put(ByteUtil.longToBytes(block.getNumber()), block.getEncoded());
|
||||
this.index.put(block.getNumber(), block.getParentHash());
|
||||
this.index.put(block.getNumber(), block.getEncoded());
|
||||
|
||||
this.wallet.processBlock(block);
|
||||
this.updateGasPrice(block);
|
||||
@ -184,7 +183,7 @@ public class Blockchain {
|
||||
|
||||
public byte[] getLatestBlockHash() {
|
||||
if (index.isEmpty())
|
||||
return StaticMessages.GENESIS_HASH;
|
||||
return Genesis.getInstance().getHash();
|
||||
else
|
||||
return getLastBlock().getHash();
|
||||
}
|
||||
@ -201,7 +200,7 @@ public class Blockchain {
|
||||
logger.debug("Displaying blocks stored in DB sorted on blocknumber");
|
||||
for (iterator.seekToFirst(); iterator.hasNext();) {
|
||||
this.lastBlock = new Block(iterator.next().getValue());
|
||||
this.index.put(lastBlock.getNumber(), lastBlock.getParentHash());
|
||||
this.index.put(lastBlock.getNumber(), lastBlock.getEncoded());
|
||||
logger.debug("Block #{} -> {}", lastBlock.getNumber(), lastBlock.toFlatString());
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ public class Repository {
|
||||
}
|
||||
bw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ package org.ethereum.gui;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
@ -12,6 +14,8 @@ import org.fife.ui.rsyntaxtextarea.*;
|
||||
* Created on: 24/04/14 11:52
|
||||
*/
|
||||
public class ConsoleTokenMaker extends AbstractTokenMaker {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("gui");
|
||||
|
||||
protected final String operators = "+-*/%!=<>^&|?:";
|
||||
|
||||
@ -75,8 +79,7 @@ public class ConsoleTokenMaker extends AbstractTokenMaker {
|
||||
break;
|
||||
|
||||
default:
|
||||
new Exception("Unknown tokenType: '" + tokenType + "'").
|
||||
printStackTrace();
|
||||
logger.error("Unknown tokenType: '" + tokenType + "'");
|
||||
tokenType = Token.IDENTIFIER;
|
||||
break;
|
||||
|
||||
|
@ -460,8 +460,6 @@ class ContractCallDialog extends JDialog implements MessageAwareDialog {
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
WorldManager.getInstance().getWallet();
|
||||
WorldManager.getInstance().loadBlockChain();
|
||||
ContractCallDialog ccd = new ContractCallDialog(null);
|
||||
ccd.setVisible(true);
|
||||
ccd.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
|
@ -3,6 +3,8 @@ package org.ethereum.gui;
|
||||
import org.ethereum.serpent.SerpentCompiler;
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
import org.fife.ui.rtextarea.RTextScrollPane;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@ -23,6 +25,8 @@ import static org.ethereum.config.SystemProperties.CONFIG;
|
||||
*/
|
||||
public class SerpentEditor extends JFrame {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("gui");
|
||||
|
||||
private String codeSample = "\n\n\n" +
|
||||
"" +
|
||||
"if !contract.storage[msg.data[0]]:\n" +
|
||||
@ -181,7 +185,7 @@ public class SerpentEditor extends JFrame {
|
||||
asmResult = SerpentCompiler.compile(codeArea.getText());
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
logger.error(th.getMessage(), th);
|
||||
|
||||
splitPanel.setDividerLocation(0.8);
|
||||
result.setVisible(true);
|
||||
@ -218,7 +222,7 @@ public class SerpentEditor extends JFrame {
|
||||
machineCode = SerpentCompiler.encodeMachineCodeForVMRun(machineCode, null);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
logger.error(th.getMessage(), th);
|
||||
splitPanel.setDividerLocation(0.7);
|
||||
result.setVisible(true);
|
||||
result.setText(th.getMessage());
|
||||
@ -266,7 +270,7 @@ public class SerpentEditor extends JFrame {
|
||||
String content = new Scanner(file).useDelimiter("\\Z").next();
|
||||
codeArea.setText(content);
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error(e1.getMessage(), e1);
|
||||
} catch (java.util.NoSuchElementException e2) {
|
||||
// don't worry it's just the file is empty
|
||||
codeArea.setText("");
|
||||
@ -334,7 +338,7 @@ public class SerpentEditor extends JFrame {
|
||||
out.write(codeArea.getText());
|
||||
out.close();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error(e1.getMessage(), e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -226,9 +226,7 @@ public class ToolBar extends JFrame {
|
||||
cp.add(chainToggle);
|
||||
cp.add(walletToggle);
|
||||
|
||||
WorldManager.getInstance().getWallet();
|
||||
WorldManager.getInstance().loadBlockChain();
|
||||
|
||||
WorldManager.getInstance();
|
||||
MainData.instance.toString();
|
||||
}
|
||||
|
||||
|
@ -67,13 +67,10 @@ public class WorldManager {
|
||||
blockchain.setWallet(wallet);
|
||||
}
|
||||
|
||||
public void loadBlockChain() {
|
||||
this.blockchain.load();
|
||||
}
|
||||
|
||||
public static WorldManager getInstance() {
|
||||
if(instance == null) {
|
||||
instance = new WorldManager();
|
||||
instance.getBlockChain().load();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@ -199,15 +196,15 @@ public class WorldManager {
|
||||
|
||||
byte[] initCode = tx.getData();
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("running the init for contract: address={}",
|
||||
Hex.toHexString(tx.getContractAddress()));
|
||||
|
||||
Block lastBlock = blockchain.getLastBlock();
|
||||
|
||||
ProgramInvoke programInvoke = ProgramInvokeFactory
|
||||
.createProgramInvoke(tx, lastBlock, trackRepository);
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("running the init for contract: addres={}",
|
||||
Hex.toHexString(tx.getContractAddress()));
|
||||
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(initCode, programInvoke);
|
||||
vm.play(program);
|
||||
@ -217,23 +214,21 @@ public class WorldManager {
|
||||
|
||||
} else {
|
||||
|
||||
byte[] programCode = trackRepository.getCode(tx
|
||||
.getReceiveAddress());
|
||||
byte[] programCode = trackRepository.getCode(tx.getReceiveAddress());
|
||||
if (programCode != null) {
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("calling for existing contract: address={}",
|
||||
Hex.toHexString(tx.getReceiveAddress()));
|
||||
|
||||
Block lastBlock = blockchain.getLastBlock();
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("calling for existing contract: addres={}",
|
||||
Hex.toHexString(tx.getReceiveAddress()));
|
||||
|
||||
ProgramInvoke programInvoke = ProgramInvokeFactory
|
||||
.createProgramInvoke(tx, lastBlock, trackRepository);
|
||||
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(programCode, programInvoke);
|
||||
vm.play(program);
|
||||
|
||||
ProgramResult result = program.getResult();
|
||||
applyProgramResult(result, gasDebit, trackRepository,
|
||||
senderAddress, tx.getReceiveAddress(), coinbase);
|
||||
@ -246,7 +241,7 @@ public class WorldManager {
|
||||
trackRepository.commit();
|
||||
pendingTransactions.put(Hex.toHexString(tx.getHash()), tx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* After any contract code finish the run the certain result should take
|
||||
* place, according the given circumstances
|
||||
|
@ -314,7 +314,7 @@ public class EthereumProtocolHandler extends ChannelInboundHandlerAdapter {
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
this.tearDown = true;
|
||||
logger.info("Lost connection to the server");
|
||||
cause.printStackTrace();
|
||||
logger.error(cause.getMessage(), cause);
|
||||
ctx.close().sync();
|
||||
timer.cancel();
|
||||
}
|
||||
@ -359,7 +359,7 @@ public class EthereumProtocolHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private void sendGetChain(ChannelHandlerContext ctx) {
|
||||
|
||||
byte[] hash = WorldManager.getInstance().getBlockChain().getLatestBlockHash();
|
||||
byte[] hash = WorldManager.getInstance().getBlockChain().getLastBlock().getHash();
|
||||
GetChainMessage chainMessage = new GetChainMessage((byte)100, hash);
|
||||
chainMessage.toString();
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.ethereum.net.message;
|
||||
|
||||
import org.ethereum.core.Genesis;
|
||||
import org.ethereum.crypto.HashUtil;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
@ -17,7 +16,6 @@ public class StaticMessages {
|
||||
public static final byte[] GET_TRANSACTIONS = Hex.decode("2240089100000002C116");
|
||||
|
||||
public static final byte[] DISCONNECT_08 = Hex.decode("2240089100000003C20108");
|
||||
public static final byte[] GENESIS_HASH = Genesis.getInstance().getHash();
|
||||
|
||||
public static final byte[] MAGIC_PACKET = Hex.decode("22400891");
|
||||
|
||||
|
@ -7,6 +7,8 @@ import org.ethereum.net.Command;
|
||||
import org.ethereum.util.RLP;
|
||||
import org.ethereum.util.RLPItem;
|
||||
import org.ethereum.util.RLPList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -19,6 +21,8 @@ import java.util.List;
|
||||
* Created on: 06/04/14 14:56
|
||||
*/
|
||||
public class TransactionsMessage extends Message {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("wire");
|
||||
|
||||
private List<Transaction> transactions = new ArrayList<Transaction>();
|
||||
|
||||
@ -36,7 +40,7 @@ public class TransactionsMessage extends Message {
|
||||
try {
|
||||
baos.write(txPayload);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class EthereumPeerTasterHandler extends ChannelInboundHandlerAdapter {
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
this.tearDown = true;
|
||||
logger.info("Lost connection to the server");
|
||||
cause.printStackTrace();
|
||||
logger.error(cause.getMessage(), cause);
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
timer = null;
|
||||
|
@ -56,7 +56,7 @@ public class PeerTaster {
|
||||
try {
|
||||
workerGroup.shutdownGracefully().sync();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ import java.util.Stack;
|
||||
public class Program {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger("VM");
|
||||
private Logger gasLogger = null;
|
||||
private Logger gasLogger = LoggerFactory.getLogger("gas");
|
||||
private int invokeHash;
|
||||
private ProgramListener listener;
|
||||
|
||||
Stack<DataWord> stack = new Stack<DataWord>();
|
||||
@ -39,8 +40,7 @@ public class Program {
|
||||
|
||||
public Program(byte[] ops, ProgramInvoke invokeData) {
|
||||
|
||||
gasLogger = LoggerFactory.getLogger("gas - " + invokeData.hashCode());
|
||||
|
||||
this.invokeHash = invokeData.hashCode();
|
||||
result.setRepository(invokeData.getRepository());
|
||||
|
||||
if (ops == null) throw new RuntimeException("program can not run with ops: null");
|
||||
@ -408,7 +408,7 @@ public class Program {
|
||||
}
|
||||
|
||||
public void spendGas(int gasValue, String cause) {
|
||||
gasLogger.info("Spent for cause: [ {} ], gas: [ {} ]", cause, gasValue);
|
||||
gasLogger.info("[{}] Spent for cause: [ {} ], gas: [ {} ]", invokeHash, cause, gasValue);
|
||||
|
||||
long afterSpend = invokeData.getGas().longValue() - gasValue - result.getGasUsed();
|
||||
if (afterSpend < 0)
|
||||
@ -417,7 +417,7 @@ public class Program {
|
||||
}
|
||||
|
||||
public void refundGas(int gasValue, String cause) {
|
||||
gasLogger.info("Refund for cause: [ {} ], gas: [ {} ]", cause, gasValue);
|
||||
gasLogger.info("[{}] Refund for cause: [ {} ], gas: [ {} ]", invokeHash, cause, gasValue);
|
||||
result.refundGas(gasValue);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.ethereum.vm;
|
||||
|
||||
import org.ethereum.crypto.HashUtil;
|
||||
import org.ethereum.vm.Program.OutOfGasException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -556,8 +557,10 @@ public class VM {
|
||||
program.fullTrace();
|
||||
} catch (RuntimeException e) {
|
||||
program.stop();
|
||||
logger.info("VM halted: ", e);
|
||||
|
||||
if(e instanceof OutOfGasException)
|
||||
logger.warn("OutOfGasException occurred", e);
|
||||
else
|
||||
logger.error("VM halted", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -14,16 +14,18 @@ log4j.appender.file.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolic
|
||||
log4j.appender.file.RollingPolicy.FileNamePattern=./logs/ethereum_%d{yyyy-MM-dd}_h%d{HH}.log
|
||||
|
||||
# filter noisy classes
|
||||
log4j.logger.org.ethereum.net = INFO
|
||||
log4j.logger.peerdiscovery = FATAL
|
||||
log4j.logger.java.nio = WARN
|
||||
log4j.logger.io.netty = FATAL
|
||||
log4j.logger.org.ethereum.core = FATAL
|
||||
log4j.logger.wire = DEBUG
|
||||
log4j.logger.VM = DEBUG
|
||||
log4j.logger.org.ethereum.core = ERROR
|
||||
log4j.logger.org.ethereum.net = ERROR
|
||||
log4j.logger.org.ethereum.db = ERROR
|
||||
log4j.logger.peerdiscovery = ERROR
|
||||
log4j.logger.java.nio = ERROR
|
||||
log4j.logger.io.netty = ERROR
|
||||
log4j.logger.wire = ERROR
|
||||
log4j.logger.VM = ERROR
|
||||
log4j.logger.main = INFO
|
||||
log4j.logger.state = DEBUG
|
||||
log4j.logger.state = ERROR
|
||||
log4j.logger.repository = ERROR
|
||||
log4j.logger.blockchain = DEBUG
|
||||
log4j.logger.ui = DEBUG
|
||||
log4j.logger.gas = DEBUG
|
||||
log4j.logger.ui = ERROR
|
||||
log4j.logger.gas = ERROR
|
||||
|
||||
|
@ -5,19 +5,19 @@ server.acceptConnections = false
|
||||
# one default access point to start
|
||||
# discover the network e.g. ip: [54.201.28.117] port: [30303]
|
||||
# Peer Server Zero: peer discovery
|
||||
peer.discovery.ip = 54.72.69.180
|
||||
peer.discovery.port = 30303
|
||||
#peer.discovery.ip = 54.72.69.180
|
||||
#peer.discovery.port = 30303
|
||||
|
||||
# Peer Server One: peer discovery
|
||||
#peer.discovery.ip = 54.204.10.41
|
||||
#peer.discovery.port = 30303
|
||||
peer.discovery.ip = 54.204.10.41
|
||||
peer.discovery.port = 30303
|
||||
|
||||
# active peer ip and port
|
||||
# that is the peer through
|
||||
# we get the chain: [54.201.28.117] port: [30303]
|
||||
# ZeroGox
|
||||
#peer.active.ip = 54.204.10.41
|
||||
#peer.active.port = 30303
|
||||
peer.active.ip = 54.204.10.41
|
||||
peer.active.port = 30303
|
||||
|
||||
# Some dude in Canada
|
||||
#peer.active.ip = 131.104.247.135
|
||||
@ -28,8 +28,8 @@ peer.discovery.port = 30303
|
||||
#peer.active.port = 30303
|
||||
|
||||
# PoC-5 testnet
|
||||
peer.active.ip = 54.72.69.180
|
||||
peer.active.port = 30303
|
||||
#peer.active.ip = 54.72.69.180
|
||||
#peer.active.port = 30303
|
||||
|
||||
#peer.active.ip = 151.64.223.120
|
||||
#peer.active.port = 30304
|
||||
|
@ -468,7 +468,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase() );
|
||||
}
|
||||
|
||||
@Test // PUSHN OP mal data
|
||||
@Test(expected=RuntimeException.class) // PUSHN OP mal data
|
||||
public void testPUSHN_1() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -477,16 +477,14 @@ public class VMTest {
|
||||
try {
|
||||
program.fullTrace();
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // PUSHN OP mal data
|
||||
@Test(expected=RuntimeException.class) // PUSHN OP mal data
|
||||
public void testPUSHN_2() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -495,13 +493,11 @@ public class VMTest {
|
||||
try {
|
||||
program.fullTrace();
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
assertTrue(program.isStopped());
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // AND OP
|
||||
@ -534,7 +530,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase() );
|
||||
}
|
||||
|
||||
@Test // AND OP mal data
|
||||
@Test(expected=RuntimeException.class) // AND OP mal data
|
||||
public void testAND_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -543,13 +539,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // OR OP
|
||||
@ -582,7 +576,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase() );
|
||||
}
|
||||
|
||||
@Test // OR OP mal data
|
||||
@Test(expected=RuntimeException.class) // OR OP mal data
|
||||
public void testOR_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -591,13 +585,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // XOR OP
|
||||
@ -631,7 +623,7 @@ public class VMTest {
|
||||
}
|
||||
|
||||
|
||||
@Test // XOR OP mal data
|
||||
@Test(expected=RuntimeException.class) // XOR OP mal data
|
||||
public void testXOR_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -640,16 +632,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // BYTE OP
|
||||
public void testBYTE_1() {
|
||||
|
||||
@ -696,7 +685,7 @@ public class VMTest {
|
||||
}
|
||||
|
||||
|
||||
@Test // BYTE OP mal data
|
||||
@Test(expected=RuntimeException.class) // BYTE OP mal data
|
||||
public void testBYTE_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -705,13 +694,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // NOT OP
|
||||
@ -742,7 +729,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase() );
|
||||
}
|
||||
|
||||
@Test // NOT OP mal data
|
||||
@Test(expected=RuntimeException.class) // NOT OP mal data
|
||||
public void testNOT_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -751,13 +738,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // EQ OP
|
||||
@ -805,7 +790,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // EQ OP mal data
|
||||
@Test(expected=RuntimeException.class) // EQ OP mal data
|
||||
public void testEQ_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -814,13 +799,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // GT OP
|
||||
@ -868,7 +851,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // GT OP mal data
|
||||
@Test(expected=RuntimeException.class) // GT OP mal data
|
||||
public void testGT_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -877,16 +860,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // SGT OP
|
||||
public void testSGT_1() {
|
||||
|
||||
@ -938,7 +918,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // SGT OP mal
|
||||
@Test(expected=RuntimeException.class) // SGT OP mal
|
||||
public void testSGT_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -948,17 +928,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
assertTrue(program.isStopped());
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test // LT OP
|
||||
public void testLT_1() {
|
||||
|
||||
@ -1004,7 +980,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // LT OP mal data
|
||||
@Test(expected=RuntimeException.class) // LT OP mal data
|
||||
public void testLT_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1013,16 +989,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
assertTrue(program.isStopped());
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // SLT OP
|
||||
public void testSLT_1() {
|
||||
|
||||
@ -1074,7 +1047,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // SLT OP mal
|
||||
@Test(expected=RuntimeException.class) // SLT OP mal
|
||||
public void testSLT_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1084,18 +1057,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test // NEG OP
|
||||
public void testNEG_1() {
|
||||
|
||||
@ -1138,25 +1106,21 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // NEG OP
|
||||
@Test(expected=RuntimeException.class) // NEG OP
|
||||
public void testNEG_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(Hex.decode("09"), new ProgramInvokeMockImpl());
|
||||
try {
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // POP OP
|
||||
public void testPOP_1() {
|
||||
|
||||
@ -1190,7 +1154,7 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // POP OP mal data
|
||||
@Test(expected=RuntimeException.class) // POP OP mal data
|
||||
public void testPOP_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1203,13 +1167,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // DUP OP
|
||||
@ -1229,7 +1191,7 @@ public class VMTest {
|
||||
}
|
||||
|
||||
|
||||
@Test // DUP OP mal data
|
||||
@Test(expected=RuntimeException.class) // DUP OP mal data
|
||||
public void testDUP_2() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1238,16 +1200,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // SWAP OP
|
||||
public void testSWAP_1() {
|
||||
|
||||
@ -1359,22 +1318,19 @@ public class VMTest {
|
||||
assertEquals(expected, Hex.toHexString(program.memory.array()));
|
||||
}
|
||||
|
||||
|
||||
@Test // MSTORE OP
|
||||
@Test(expected=RuntimeException.class) // MSTORE OP
|
||||
public void testMSTORE_5() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(Hex.decode("61123454"), new ProgramInvokeMockImpl());
|
||||
try {
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // MLOAD OP
|
||||
@ -1469,24 +1425,20 @@ public class VMTest {
|
||||
assertEquals(s_expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // MLOAD OP mal data
|
||||
@Test(expected=RuntimeException.class) // MLOAD OP mal data
|
||||
public void testMLOAD_6() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(Hex.decode("53"), new ProgramInvokeMockImpl());
|
||||
try {
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
assertTrue(program.isStopped());
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // MSTORE8 OP
|
||||
public void testMSTORE8_1() {
|
||||
|
||||
@ -1534,7 +1486,7 @@ public class VMTest {
|
||||
assertEquals(m_expected, Hex.toHexString(program.memory.array()));
|
||||
}
|
||||
|
||||
@Test // MSTORE8 OP mal
|
||||
@Test(expected=RuntimeException.class) // MSTORE8 OP mal
|
||||
public void testMSTORE8_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1542,16 +1494,13 @@ public class VMTest {
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // SSTORE OP
|
||||
public void testSSTORE_1() {
|
||||
|
||||
@ -1598,25 +1547,21 @@ public class VMTest {
|
||||
assertEquals(s_expected_val, Hex.toHexString(val.getData()).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // SSTORE OP
|
||||
@Test(expected=RuntimeException.class) // SSTORE OP
|
||||
public void testSSTORE_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(Hex.decode("602257"), new ProgramInvokeMockImpl());
|
||||
try {
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // SLOAD OP
|
||||
public void testSLOAD_1() {
|
||||
|
||||
@ -1668,21 +1613,18 @@ public class VMTest {
|
||||
assertEquals(s_expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // SLOAD OP
|
||||
@Test(expected=RuntimeException.class) // SLOAD OP
|
||||
public void testSLOAD_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(Hex.decode("56"), new ProgramInvokeMockImpl());
|
||||
try {
|
||||
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // PC OP
|
||||
@ -1735,7 +1677,7 @@ public class VMTest {
|
||||
assertEquals(s_expected, Hex.toHexString(program.stack.peek().data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // JUMP OP mal data
|
||||
@Test(expected=RuntimeException.class) // JUMP OP mal data
|
||||
public void testJUMP_2() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1743,16 +1685,13 @@ public class VMTest {
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // JUMPI OP
|
||||
public void testJUMPI_1() {
|
||||
|
||||
@ -1792,7 +1731,7 @@ public class VMTest {
|
||||
assertEquals(s_expected_2, Hex.toHexString(item2.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // JUMPI OP mal
|
||||
@Test(expected=RuntimeException.class) // JUMPI OP mal
|
||||
public void testJUMPI_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1800,16 +1739,14 @@ public class VMTest {
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // JUMPI OP mal
|
||||
@Test(expected=RuntimeException.class) // JUMPI OP mal
|
||||
public void testJUMPI_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1818,12 +1755,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // ADD OP mal
|
||||
@ -1874,7 +1810,7 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // ADD OP mal
|
||||
@Test(expected=RuntimeException.class) // ADD OP mal
|
||||
public void testADD_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1882,13 +1818,11 @@ public class VMTest {
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // MULL OP
|
||||
@ -1939,7 +1873,7 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // MULL OP mal
|
||||
@Test(expected=RuntimeException.class) // MULL OP mal
|
||||
public void testMULL_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -1947,16 +1881,13 @@ public class VMTest {
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // DIV OP
|
||||
public void testDIV_1() {
|
||||
|
||||
@ -2039,24 +1970,21 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // DIV OP
|
||||
@Test(expected=RuntimeException.class) // DIV OP
|
||||
public void testDIV_6() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(Hex.decode("600704"), new ProgramInvokeMockImpl());
|
||||
try {
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // SDIV OP
|
||||
public void testSDIV_1() {
|
||||
|
||||
@ -2105,8 +2033,7 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // SDIV OP mal
|
||||
@Test(expected=RuntimeException.class) // SDIV OP mal
|
||||
public void testSDIV_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -2115,16 +2042,13 @@ public class VMTest {
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // SUB OP
|
||||
public void testSUB_1() {
|
||||
|
||||
@ -2173,7 +2097,7 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // SUB OP mal
|
||||
@Test(expected=RuntimeException.class) // SUB OP mal
|
||||
public void testSUB_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -2181,13 +2105,11 @@ public class VMTest {
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // MSIZE OP
|
||||
@ -2272,22 +2194,19 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // EXP OP mal
|
||||
@Test(expected=RuntimeException.class) // EXP OP mal
|
||||
public void testEXP_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program = new Program(Hex.decode("6212345608"), new ProgramInvokeMockImpl());
|
||||
try {
|
||||
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // RETURN OP
|
||||
@ -2442,8 +2361,7 @@ public class VMTest {
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
|
||||
|
||||
@Test // CODECOPY OP mal
|
||||
@Test(expected=RuntimeException.class) // CODECOPY OP mal
|
||||
public void testCODECOPY_5() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -2454,16 +2372,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // CODESIZE OP
|
||||
public void testCODESIZE_1() {
|
||||
|
||||
@ -2480,7 +2395,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATASIZE OP
|
||||
public void testCALLDATASIZE_1() {
|
||||
|
||||
@ -2585,26 +2499,22 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // CALLDATALOAD OP mal
|
||||
@Test(expected=RuntimeException.class) // CALLDATALOAD OP mal
|
||||
public void testCALLDATALOAD_6() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program =
|
||||
new Program(Hex.decode("35"),
|
||||
createProgramInvoke_1());
|
||||
|
||||
try {
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATACOPY OP
|
||||
public void testCALLDATACOPY_1() {
|
||||
|
||||
@ -2704,7 +2614,7 @@ public class VMTest {
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLDATACOPY OP mal
|
||||
@Test(expected=RuntimeException.class) // CALLDATACOPY OP mal
|
||||
public void testCALLDATACOPY_6() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -2716,16 +2626,13 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // ADDRESS OP
|
||||
public void testADDRESS_1() {
|
||||
|
||||
@ -2742,7 +2649,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // BALANCE OP
|
||||
public void testBALANCE_1() {
|
||||
|
||||
@ -2759,7 +2665,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // ORIGIN OP
|
||||
public void testORIGIN_1() {
|
||||
|
||||
@ -2776,7 +2681,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // CALLER OP
|
||||
public void testCALLER_1() {
|
||||
|
||||
@ -2809,7 +2713,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // SHA3 OP
|
||||
public void testSHA3_1() {
|
||||
|
||||
@ -2831,7 +2734,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // SHA3 OP
|
||||
public void testSHA3_2() {
|
||||
|
||||
@ -2853,30 +2755,26 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
@Test // SHA3 OP mal
|
||||
@Test(expected=RuntimeException.class) // SHA3 OP mal
|
||||
public void testSHA3_3() {
|
||||
|
||||
VM vm = new VM();
|
||||
Program program =
|
||||
new Program(Hex.decode("610201600054600220"),
|
||||
createProgramInvoke_1());
|
||||
|
||||
try {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
|
||||
@Test // MOD OP
|
||||
public void testMOD_1() {
|
||||
VM vm = new VM();
|
||||
@ -2922,8 +2820,7 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // MOD OP mal
|
||||
@Test(expected=RuntimeException.class) // MOD OP mal
|
||||
public void testMOD_4() {
|
||||
|
||||
VM vm = new VM();
|
||||
@ -2933,13 +2830,11 @@ public class VMTest {
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
vm.step(program);
|
||||
} catch (RuntimeException e) {
|
||||
fail();
|
||||
} finally {
|
||||
program.getResult().repository.close();
|
||||
assertTrue(program.isStopped());
|
||||
return;
|
||||
}
|
||||
program.getResult().repository.close();
|
||||
fail();
|
||||
}
|
||||
|
||||
@Test // SMOD OP
|
||||
@ -2974,7 +2869,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // SMOD OP
|
||||
public void testSMOD_3() {
|
||||
VM vm = new VM();
|
||||
@ -2992,7 +2886,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // SMOD OP mal
|
||||
public void testSMOD_4() {
|
||||
VM vm = new VM();
|
||||
@ -3026,7 +2919,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // COINBASE OP
|
||||
public void testCOINBASE_1() {
|
||||
|
||||
@ -3059,7 +2951,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // NUMBER OP
|
||||
public void testNUMBER_1() {
|
||||
|
||||
@ -3092,7 +2983,6 @@ public class VMTest {
|
||||
assertEquals(s_expected_1, Hex.toHexString(item1.data).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
@Test // GASPRICE OP
|
||||
public void testGASPRICE_1() {
|
||||
|
||||
|
@ -8,16 +8,18 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern= %d{HH:mm:ss} [%c{1}] %m%n
|
||||
|
||||
# filter noisy classes
|
||||
log4j.logger.org.ethereum.net = FATAL
|
||||
log4j.logger.peerdiscovery = FATAL
|
||||
log4j.logger.java.nio = FATAL
|
||||
log4j.logger.io.netty = FATAL
|
||||
log4j.logger.org.ethereum.core = FATAL
|
||||
log4j.logger.wire = FATAL
|
||||
log4j.logger.VM = DEBUG
|
||||
log4j.logger.main = DEBUG
|
||||
log4j.logger.state = FATAL
|
||||
log4j.logger.blockchain = FATAL
|
||||
log4j.logger.ui = FATAL
|
||||
log4j.logger.gas = DEBUG
|
||||
log4j.logger.org.ethereum.core = ERROR
|
||||
log4j.logger.org.ethereum.net = ERROR
|
||||
log4j.logger.org.ethereum.db = ERROR
|
||||
log4j.logger.peerdiscovery = ERROR
|
||||
log4j.logger.java.nio = ERROR
|
||||
log4j.logger.io.netty = ERROR
|
||||
log4j.logger.wire = ERROR
|
||||
log4j.logger.VM = OFF
|
||||
log4j.logger.main = INFO
|
||||
log4j.logger.state = ERROR
|
||||
log4j.logger.repository = ERROR
|
||||
log4j.logger.blockchain = DEBUG
|
||||
log4j.logger.ui = ERROR
|
||||
log4j.logger.gas = ERROR
|
||||
|
||||
|
@ -5,23 +5,23 @@ server.acceptConnections = false
|
||||
# one default access point to start
|
||||
# discover the network e.g. ip: [54.201.28.117] port: [30303]
|
||||
# Peer Server Zero: peer discovery
|
||||
peer.discovery.ip = 54.201.28.117
|
||||
peer.discovery.port = 30303
|
||||
#peer.discovery.ip = 54.201.28.117
|
||||
#peer.discovery.port = 30303
|
||||
|
||||
# Peer Server One: peer discovery
|
||||
#peer.discovery.ip = 54.204.10.41
|
||||
#peer.discovery.port = 30303
|
||||
peer.discovery.ip = 54.204.10.41
|
||||
peer.discovery.port = 30303
|
||||
|
||||
# active peer ip and port
|
||||
# that is the peer through
|
||||
# we get the chain: [54.201.28.117] port: [30303]
|
||||
# ZeroGox
|
||||
#peer.active.ip = 54.204.10.41
|
||||
#peer.active.port = 30303
|
||||
peer.active.ip = 54.204.10.41
|
||||
peer.active.port = 30303
|
||||
|
||||
# RomanJ
|
||||
peer.active.ip = 54.211.14.10
|
||||
peer.active.port = 50505
|
||||
#peer.active.ip = 54.211.14.10
|
||||
#peer.active.port = 50505
|
||||
|
||||
# PoC-5 testnet
|
||||
#peer.active.ip = 54.72.69.180
|
||||
|
Loading…
x
Reference in New Issue
Block a user