New Repositroy management:

+ VMComplex test 4 fixed
This commit is contained in:
romanman 2014-06-25 00:27:39 +01:00
parent 415f87c727
commit 59ff195854
3 changed files with 8 additions and 9 deletions

View File

@ -238,7 +238,7 @@ public class Repository {
state.setCodeHash(codeHash);
if (logger.isInfoEnabled())
logger.info("Program code saved: account: [ {} ] codeHash: [ {} ] \n code: [ {} ]",
logger.info("Program code saved:\n account: [ {} ]\n codeHash: [ {} ] \n code: [ {} ]",
Hex.toHexString(address),
Hex.toHexString(codeHash),
Hex.toHexString(code));

View File

@ -244,6 +244,7 @@ public class Program {
// 2.2 CREATE THE CONTRACT ADDRESS
byte[] nonce = trackRepository.getNonce(senderAddress).toByteArray();
byte[] newAddress = HashUtil.calcNewAddr(this.getOwnerAddress().getNoLeadZeroesData(), nonce);
trackRepository.createAccount(newAddress);
// 2.3 UPDATE THE NONCE
// (THIS STAGE IS NOT REVERTED BY ANY EXCEPTION)
@ -251,7 +252,7 @@ public class Program {
// 3. COOK THE INVOKE AND EXECUTE
ProgramInvoke programInvoke =
ProgramInvokeFactory.createProgramInvoke(this, DataWord.ZERO, DataWord.ZERO,
ProgramInvokeFactory.createProgramInvoke(this, new DataWord(newAddress), DataWord.ZERO,
gas, BigInteger.ZERO, null, trackRepository);
VM vm = new VM();

View File

@ -304,15 +304,15 @@ public class VMComplexTest {
contract A: 77045e71a7a2c50903d88e564cd72fab11e82051
-----------
a = 0x7f60c860005461012c6020540000000000000000000000000000000000000000
b = 0x0060005460206000f20000000000000000000000000000000000000000000000
create(100, 0 41)
a = 0x7f60c860005461012c6020540000000000000000000000000000000000000000
b = 0x0060005460206000f20000000000000000000000000000000000000000000000
create(100, 0 41)
contract B: (the contract to be created the addr will be defined to: 8e45367623a2865132d9bf875d5cfa31b9a0cd94)
-----------
a = 200
b = 300
a = 200
b = 300
*/
@ -355,11 +355,9 @@ public class VMComplexTest {
program.setRuntimeFailure(e);
}
System.out.println();
System.out.println("============ Results ============");
System.out.println("*** Used gas: " + program.result.getGasUsed());
// todo: check that the value pushed after exec is the new address
repository.close();