Move to canon ES-1.

Minor fix for contracts.
This commit is contained in:
Gav Wood 2014-02-18 13:27:13 +00:00
parent 815cb1392b
commit 34b1ba4814

26
vm.cpp
View File

@ -36,13 +36,19 @@ template <> class UnitTest<1>
public: public:
int operator()() int operator()()
{ {
c_genesisDifficulty = (u256)1;
KeyPair p = KeyPair::create(); KeyPair p = KeyPair::create();
Overlay o; Overlay o(State::openDB("/tmp/vmTest", true));
State s(p.address(), o); State s(p.address(), o);
BlockChain bc("/tmp/vmTest", true);
cout << s; cout << s;
s.addBalance(p.address(), Uether); s.commitToMine(bc);
s.mine(1000000);
bc.attemptImport(s.blockData(), o);
s.sync(bc);
cout << s; cout << s;
@ -50,7 +56,7 @@ public:
c.receiveAddress = Address(); c.receiveAddress = Address();
c.nonce = 0; c.nonce = 0;
c.data = assemble("txsender load txvalue add txsender store stop"); c.data = assemble("txsender sload txvalue add txsender sstore stop");
c.value = ether; c.value = ether;
c.sign(p.secret()); c.sign(p.secret());
s.execute(c.rlp()); s.execute(c.rlp());
@ -58,11 +64,14 @@ public:
cout << s; cout << s;
s.commit(); s.commitToMine(bc);
s.mine(1000000);
bc.attemptImport(s.blockData(), o);
s.sync(bc);
cout << s; cout << s;
cout << s.m_db; // cout << s.m_db;
c.receiveAddress = ca; c.receiveAddress = ca;
c.nonce = 1; c.nonce = 1;
@ -73,6 +82,13 @@ public:
cout << s; cout << s;
s.commitToMine(bc);
s.mine();
bc.attemptImport(s.blockData(), o);
s.sync(bc);
cout << s;
return 0; return 0;
} }
}; };