fixes #27 (a number of setStorage failing tests)
This commit is contained in:
parent
9fc80cb6c9
commit
f705a60dc1
288
VMTests.md
288
VMTests.md
|
@ -2,36 +2,36 @@ VMTests
|
||||||
===
|
===
|
||||||
## vmArithmeticTest
|
## vmArithmeticTest
|
||||||
```diff
|
```diff
|
||||||
- add0.json Fail
|
+ add0.json OK
|
||||||
- add1.json Fail
|
+ add1.json OK
|
||||||
+ add2.json OK
|
+ add2.json OK
|
||||||
+ add3.json OK
|
+ add3.json OK
|
||||||
+ add4.json OK
|
+ add4.json OK
|
||||||
- addmod0.json Fail
|
+ addmod0.json OK
|
||||||
- addmod1.json Fail
|
+ addmod1.json OK
|
||||||
+ addmod1_overflow2.json OK
|
+ addmod1_overflow2.json OK
|
||||||
+ addmod1_overflow3.json OK
|
+ addmod1_overflow3.json OK
|
||||||
- addmod1_overflow4.json Fail
|
+ addmod1_overflow4.json OK
|
||||||
- addmod1_overflowDiff.json Fail
|
+ addmod1_overflowDiff.json OK
|
||||||
- addmod2.json Fail
|
+ addmod2.json OK
|
||||||
+ addmod2_0.json OK
|
+ addmod2_0.json OK
|
||||||
- addmod2_1.json Fail
|
+ addmod2_1.json OK
|
||||||
- addmod3.json Fail
|
+ addmod3.json OK
|
||||||
+ addmod3_0.json OK
|
+ addmod3_0.json OK
|
||||||
+ addmodBigIntCast.json OK
|
+ addmodBigIntCast.json OK
|
||||||
+ addmodDivByZero.json OK
|
+ addmodDivByZero.json OK
|
||||||
+ addmodDivByZero1.json OK
|
+ addmodDivByZero1.json OK
|
||||||
+ addmodDivByZero2.json OK
|
+ addmodDivByZero2.json OK
|
||||||
- addmodDivByZero3.json Fail
|
+ addmodDivByZero3.json OK
|
||||||
arith1.json Skip
|
arith1.json Skip
|
||||||
+ div1.json OK
|
+ div1.json OK
|
||||||
- divBoostBug.json Fail
|
+ divBoostBug.json OK
|
||||||
- divByNonZero0.json Fail
|
+ divByNonZero0.json OK
|
||||||
+ divByNonZero1.json OK
|
+ divByNonZero1.json OK
|
||||||
+ divByNonZero2.json OK
|
+ divByNonZero2.json OK
|
||||||
- divByNonZero3.json Fail
|
+ divByNonZero3.json OK
|
||||||
+ divByZero.json OK
|
+ divByZero.json OK
|
||||||
- divByZero_2.json Fail
|
+ divByZero_2.json OK
|
||||||
- exp0.json Fail
|
- exp0.json Fail
|
||||||
- exp1.json Fail
|
- exp1.json Fail
|
||||||
- exp2.json Fail
|
- exp2.json Fail
|
||||||
|
@ -118,37 +118,37 @@ VMTests
|
||||||
- expXY.json Fail
|
- expXY.json Fail
|
||||||
- expXY_success.json Fail
|
- expXY_success.json Fail
|
||||||
+ fibbonacci_unrolled.json OK
|
+ fibbonacci_unrolled.json OK
|
||||||
- mod0.json Fail
|
+ mod0.json OK
|
||||||
- mod1.json Fail
|
+ mod1.json OK
|
||||||
+ mod2.json OK
|
+ mod2.json OK
|
||||||
+ mod3.json OK
|
+ mod3.json OK
|
||||||
- mod4.json Fail
|
+ mod4.json OK
|
||||||
- modByZero.json Fail
|
+ modByZero.json OK
|
||||||
- mul0.json Fail
|
+ mul0.json OK
|
||||||
- mul1.json Fail
|
+ mul1.json OK
|
||||||
+ mul2.json OK
|
+ mul2.json OK
|
||||||
- mul3.json Fail
|
+ mul3.json OK
|
||||||
- mul4.json Fail
|
+ mul4.json OK
|
||||||
+ mul5.json OK
|
+ mul5.json OK
|
||||||
- mul6.json Fail
|
+ mul6.json OK
|
||||||
+ mul7.json OK
|
+ mul7.json OK
|
||||||
- mulUnderFlow.json Fail
|
- mulUnderFlow.json Fail
|
||||||
+ mulmod0.json OK
|
+ mulmod0.json OK
|
||||||
- mulmod1.json Fail
|
+ mulmod1.json OK
|
||||||
- mulmod1_overflow.json Fail
|
- mulmod1_overflow.json Fail
|
||||||
+ mulmod1_overflow2.json OK
|
+ mulmod1_overflow2.json OK
|
||||||
- mulmod1_overflow3.json Fail
|
+ mulmod1_overflow3.json OK
|
||||||
- mulmod1_overflow4.json Fail
|
+ mulmod1_overflow4.json OK
|
||||||
- mulmod2.json Fail
|
+ mulmod2.json OK
|
||||||
+ mulmod2_0.json OK
|
+ mulmod2_0.json OK
|
||||||
- mulmod2_1.json Fail
|
+ mulmod2_1.json OK
|
||||||
- mulmod3.json Fail
|
+ mulmod3.json OK
|
||||||
+ mulmod3_0.json OK
|
+ mulmod3_0.json OK
|
||||||
- mulmod4.json Fail
|
- mulmod4.json Fail
|
||||||
+ mulmoddivByZero.json OK
|
+ mulmoddivByZero.json OK
|
||||||
+ mulmoddivByZero1.json OK
|
+ mulmoddivByZero1.json OK
|
||||||
+ mulmoddivByZero2.json OK
|
+ mulmoddivByZero2.json OK
|
||||||
- mulmoddivByZero3.json Fail
|
+ mulmoddivByZero3.json OK
|
||||||
+ not1.json OK
|
+ not1.json OK
|
||||||
+ sdiv0.json OK
|
+ sdiv0.json OK
|
||||||
+ sdiv1.json OK
|
+ sdiv1.json OK
|
||||||
|
@ -162,24 +162,24 @@ VMTests
|
||||||
+ sdiv9.json OK
|
+ sdiv9.json OK
|
||||||
+ sdivByZero0.json OK
|
+ sdivByZero0.json OK
|
||||||
+ sdivByZero1.json OK
|
+ sdivByZero1.json OK
|
||||||
- sdivByZero2.json Fail
|
+ sdivByZero2.json OK
|
||||||
- sdiv_dejavu.json Fail
|
- sdiv_dejavu.json Fail
|
||||||
+ sdiv_i256min.json OK
|
+ sdiv_i256min.json OK
|
||||||
+ sdiv_i256min2.json OK
|
+ sdiv_i256min2.json OK
|
||||||
+ sdiv_i256min3.json OK
|
+ sdiv_i256min3.json OK
|
||||||
- signextendInvalidByteNumber.json Fail
|
+ signextendInvalidByteNumber.json OK
|
||||||
+ signextend_00.json OK
|
+ signextend_00.json OK
|
||||||
- signextend_0_BigByte.json Fail
|
+ signextend_0_BigByte.json OK
|
||||||
- signextend_AlmostBiggestByte.json Fail
|
+ signextend_AlmostBiggestByte.json OK
|
||||||
- signextend_BigByteBigByte.json Fail
|
+ signextend_BigByteBigByte.json OK
|
||||||
- signextend_BigBytePlus1_2.json Fail
|
+ signextend_BigBytePlus1_2.json OK
|
||||||
+ signextend_BigByte_0.json OK
|
+ signextend_BigByte_0.json OK
|
||||||
- signextend_BitIsNotSet.json Fail
|
+ signextend_BitIsNotSet.json OK
|
||||||
- signextend_BitIsNotSetInHigherByte.json Fail
|
+ signextend_BitIsNotSetInHigherByte.json OK
|
||||||
- signextend_BitIsSetInHigherByte.json Fail
|
+ signextend_BitIsSetInHigherByte.json OK
|
||||||
- signextend_Overflow_dj42.json Fail
|
- signextend_Overflow_dj42.json Fail
|
||||||
- signextend_bigBytePlus1.json Fail
|
+ signextend_bigBytePlus1.json OK
|
||||||
- signextend_bitIsSet.json Fail
|
+ signextend_bitIsSet.json OK
|
||||||
+ smod0.json OK
|
+ smod0.json OK
|
||||||
+ smod1.json OK
|
+ smod1.json OK
|
||||||
+ smod2.json OK
|
+ smod2.json OK
|
||||||
|
@ -188,25 +188,25 @@ VMTests
|
||||||
+ smod5.json OK
|
+ smod5.json OK
|
||||||
+ smod6.json OK
|
+ smod6.json OK
|
||||||
+ smod7.json OK
|
+ smod7.json OK
|
||||||
- smod8_byZero.json Fail
|
+ smod8_byZero.json OK
|
||||||
+ smod_i256min1.json OK
|
+ smod_i256min1.json OK
|
||||||
- smod_i256min2.json Fail
|
+ smod_i256min2.json OK
|
||||||
+ stop.json OK
|
+ stop.json OK
|
||||||
- sub0.json Fail
|
+ sub0.json OK
|
||||||
- sub1.json Fail
|
+ sub1.json OK
|
||||||
- sub2.json Fail
|
+ sub2.json OK
|
||||||
- sub3.json Fail
|
+ sub3.json OK
|
||||||
- sub4.json Fail
|
+ sub4.json OK
|
||||||
```
|
```
|
||||||
OK: 56/195 Fail: 138/195 Skip: 1/195
|
OK: 104/195 Fail: 90/195 Skip: 1/195
|
||||||
## vmBitwiseLogicOperation
|
## vmBitwiseLogicOperation
|
||||||
```diff
|
```diff
|
||||||
- and0.json Fail
|
+ and0.json OK
|
||||||
+ and1.json OK
|
+ and1.json OK
|
||||||
- and2.json Fail
|
+ and2.json OK
|
||||||
- and3.json Fail
|
+ and3.json OK
|
||||||
- and4.json Fail
|
+ and4.json OK
|
||||||
- and5.json Fail
|
+ and5.json OK
|
||||||
- byte0.json Fail
|
- byte0.json Fail
|
||||||
- byte1.json Fail
|
- byte1.json Fail
|
||||||
- byte10.json Fail
|
- byte10.json Fail
|
||||||
|
@ -220,31 +220,31 @@ OK: 56/195 Fail: 138/195 Skip: 1/195
|
||||||
- byte8.json Fail
|
- byte8.json Fail
|
||||||
- byte9.json Fail
|
- byte9.json Fail
|
||||||
+ eq0.json OK
|
+ eq0.json OK
|
||||||
- eq1.json Fail
|
+ eq1.json OK
|
||||||
- eq2.json Fail
|
+ eq2.json OK
|
||||||
- gt0.json Fail
|
+ gt0.json OK
|
||||||
+ gt1.json OK
|
+ gt1.json OK
|
||||||
- gt2.json Fail
|
+ gt2.json OK
|
||||||
+ gt3.json OK
|
+ gt3.json OK
|
||||||
+ iszeo2.json OK
|
+ iszeo2.json OK
|
||||||
+ iszero0.json OK
|
+ iszero0.json OK
|
||||||
- iszero1.json Fail
|
+ iszero1.json OK
|
||||||
+ lt0.json OK
|
+ lt0.json OK
|
||||||
- lt1.json Fail
|
+ lt1.json OK
|
||||||
+ lt2.json OK
|
+ lt2.json OK
|
||||||
- lt3.json Fail
|
+ lt3.json OK
|
||||||
- not0.json Fail
|
+ not0.json OK
|
||||||
- not1.json Fail
|
+ not1.json OK
|
||||||
+ not2.json OK
|
+ not2.json OK
|
||||||
- not3.json Fail
|
+ not3.json OK
|
||||||
- not4.json Fail
|
+ not4.json OK
|
||||||
- not5.json Fail
|
+ not5.json OK
|
||||||
- or0.json Fail
|
+ or0.json OK
|
||||||
- or1.json Fail
|
+ or1.json OK
|
||||||
- or2.json Fail
|
+ or2.json OK
|
||||||
- or3.json Fail
|
+ or3.json OK
|
||||||
- or4.json Fail
|
+ or4.json OK
|
||||||
- or5.json Fail
|
+ or5.json OK
|
||||||
+ sgt0.json OK
|
+ sgt0.json OK
|
||||||
+ sgt1.json OK
|
+ sgt1.json OK
|
||||||
+ sgt2.json OK
|
+ sgt2.json OK
|
||||||
|
@ -256,13 +256,13 @@ OK: 56/195 Fail: 138/195 Skip: 1/195
|
||||||
+ slt3.json OK
|
+ slt3.json OK
|
||||||
+ slt4.json OK
|
+ slt4.json OK
|
||||||
+ xor0.json OK
|
+ xor0.json OK
|
||||||
- xor1.json Fail
|
+ xor1.json OK
|
||||||
- xor2.json Fail
|
+ xor2.json OK
|
||||||
- xor3.json Fail
|
+ xor3.json OK
|
||||||
- xor4.json Fail
|
+ xor4.json OK
|
||||||
- xor5.json Fail
|
+ xor5.json OK
|
||||||
```
|
```
|
||||||
OK: 20/60 Fail: 40/60 Skip: 0/60
|
OK: 48/60 Fail: 12/60 Skip: 0/60
|
||||||
## vmBlockInfoTest
|
## vmBlockInfoTest
|
||||||
```diff
|
```diff
|
||||||
- blockhash257Block.json Fail
|
- blockhash257Block.json Fail
|
||||||
|
@ -558,82 +558,82 @@ OK: 0/46 Fail: 0/46 Skip: 46/46
|
||||||
OK: 0/18 Fail: 0/18 Skip: 18/18
|
OK: 0/18 Fail: 0/18 Skip: 18/18
|
||||||
## vmPushDupSwapTest
|
## vmPushDupSwapTest
|
||||||
```diff
|
```diff
|
||||||
- dup1.json Fail
|
+ dup1.json OK
|
||||||
- dup10.json Fail
|
+ dup10.json OK
|
||||||
- dup11.json Fail
|
+ dup11.json OK
|
||||||
- dup12.json Fail
|
+ dup12.json OK
|
||||||
- dup13.json Fail
|
+ dup13.json OK
|
||||||
- dup14.json Fail
|
+ dup14.json OK
|
||||||
- dup15.json Fail
|
+ dup15.json OK
|
||||||
- dup16.json Fail
|
+ dup16.json OK
|
||||||
- dup2.json Fail
|
+ dup2.json OK
|
||||||
+ dup2error.json OK
|
+ dup2error.json OK
|
||||||
- dup3.json Fail
|
+ dup3.json OK
|
||||||
- dup4.json Fail
|
+ dup4.json OK
|
||||||
- dup5.json Fail
|
+ dup5.json OK
|
||||||
- dup6.json Fail
|
+ dup6.json OK
|
||||||
- dup7.json Fail
|
+ dup7.json OK
|
||||||
- dup8.json Fail
|
+ dup8.json OK
|
||||||
- dup9.json Fail
|
+ dup9.json OK
|
||||||
- push1.json Fail
|
+ push1.json OK
|
||||||
- push10.json Fail
|
+ push10.json OK
|
||||||
- push11.json Fail
|
+ push11.json OK
|
||||||
- push12.json Fail
|
+ push12.json OK
|
||||||
- push13.json Fail
|
+ push13.json OK
|
||||||
- push14.json Fail
|
+ push14.json OK
|
||||||
- push15.json Fail
|
+ push15.json OK
|
||||||
- push16.json Fail
|
+ push16.json OK
|
||||||
- push17.json Fail
|
+ push17.json OK
|
||||||
- push18.json Fail
|
+ push18.json OK
|
||||||
- push19.json Fail
|
+ push19.json OK
|
||||||
+ push1_missingStack.json OK
|
+ push1_missingStack.json OK
|
||||||
- push2.json Fail
|
+ push2.json OK
|
||||||
- push20.json Fail
|
+ push20.json OK
|
||||||
- push21.json Fail
|
+ push21.json OK
|
||||||
- push22.json Fail
|
+ push22.json OK
|
||||||
- push23.json Fail
|
+ push23.json OK
|
||||||
- push24.json Fail
|
+ push24.json OK
|
||||||
- push25.json Fail
|
+ push25.json OK
|
||||||
- push26.json Fail
|
+ push26.json OK
|
||||||
- push27.json Fail
|
+ push27.json OK
|
||||||
- push28.json Fail
|
+ push28.json OK
|
||||||
- push29.json Fail
|
+ push29.json OK
|
||||||
- push3.json Fail
|
+ push3.json OK
|
||||||
- push30.json Fail
|
+ push30.json OK
|
||||||
- push31.json Fail
|
+ push31.json OK
|
||||||
- push32.json Fail
|
+ push32.json OK
|
||||||
+ push32AndSuicide.json OK
|
+ push32AndSuicide.json OK
|
||||||
+ push32FillUpInputWithZerosAtTheEnd.json OK
|
+ push32FillUpInputWithZerosAtTheEnd.json OK
|
||||||
+ push32Undefined.json OK
|
+ push32Undefined.json OK
|
||||||
- push32Undefined2.json Fail
|
+ push32Undefined2.json OK
|
||||||
+ push32Undefined3.json OK
|
+ push32Undefined3.json OK
|
||||||
+ push33.json OK
|
+ push33.json OK
|
||||||
- push4.json Fail
|
+ push4.json OK
|
||||||
- push5.json Fail
|
+ push5.json OK
|
||||||
- push6.json Fail
|
+ push6.json OK
|
||||||
- push7.json Fail
|
+ push7.json OK
|
||||||
- push8.json Fail
|
+ push8.json OK
|
||||||
- push9.json Fail
|
+ push9.json OK
|
||||||
- swap1.json Fail
|
+ swap1.json OK
|
||||||
- swap10.json Fail
|
+ swap10.json OK
|
||||||
- swap11.json Fail
|
+ swap11.json OK
|
||||||
- swap12.json Fail
|
+ swap12.json OK
|
||||||
- swap13.json Fail
|
+ swap13.json OK
|
||||||
- swap14.json Fail
|
+ swap14.json OK
|
||||||
- swap15.json Fail
|
+ swap15.json OK
|
||||||
- swap16.json Fail
|
+ swap16.json OK
|
||||||
- swap2.json Fail
|
+ swap2.json OK
|
||||||
+ swap2error.json OK
|
+ swap2error.json OK
|
||||||
- swap3.json Fail
|
+ swap3.json OK
|
||||||
- swap4.json Fail
|
+ swap4.json OK
|
||||||
- swap5.json Fail
|
+ swap5.json OK
|
||||||
- swap6.json Fail
|
+ swap6.json OK
|
||||||
- swap7.json Fail
|
+ swap7.json OK
|
||||||
- swap8.json Fail
|
+ swap8.json OK
|
||||||
- swap9.json Fail
|
+ swap9.json OK
|
||||||
+ swapjump1.json OK
|
+ swapjump1.json OK
|
||||||
```
|
```
|
||||||
OK: 9/74 Fail: 65/74 Skip: 0/74
|
OK: 74/74 Fail: 0/74 Skip: 0/74
|
||||||
## vmRandomTest
|
## vmRandomTest
|
||||||
```diff
|
```diff
|
||||||
201503102037PYTHON.json Skip
|
201503102037PYTHON.json Skip
|
||||||
|
|
|
@ -12,11 +12,11 @@ import
|
||||||
|
|
||||||
type
|
type
|
||||||
AccountStateDB* = ref object
|
AccountStateDB* = ref object
|
||||||
db*: Table[string, Bytes]
|
db*: Table[string, BytesRange]
|
||||||
rootHash*: string # TODO trie
|
rootHash*: string # TODO trie
|
||||||
|
|
||||||
proc newAccountStateDB*(db: Table[string, string], readOnly: bool = false): AccountStateDB =
|
proc newAccountStateDB*(db: Table[string, string], readOnly: bool = false): AccountStateDB =
|
||||||
result = AccountStateDB(db: initTable[string, Bytes]())
|
result = AccountStateDB(db: initTable[string, BytesRange]())
|
||||||
|
|
||||||
proc logger*(db: AccountStateDB): Logger =
|
proc logger*(db: AccountStateDB): Logger =
|
||||||
logging.getLogger("db.State")
|
logging.getLogger("db.State")
|
||||||
|
@ -69,7 +69,7 @@ proc setStorage*(db: var AccountStateDB, address: string, slot: UInt256, value:
|
||||||
# TODO fix
|
# TODO fix
|
||||||
if value > 0:
|
if value > 0:
|
||||||
let encodedValue = rlp.encode value.intToBigEndian
|
let encodedValue = rlp.encode value.intToBigEndian
|
||||||
storage[slotAsKey] = encodedValue.decode(Bytes)
|
storage[slotAsKey] = encodedValue
|
||||||
else:
|
else:
|
||||||
storage.del(slotAsKey)
|
storage.del(slotAsKey)
|
||||||
#storage[slotAsKey] = value
|
#storage[slotAsKey] = value
|
||||||
|
@ -91,7 +91,9 @@ proc getStorage*(db: var AccountStateDB, address: string, slot: UInt256): (UInt2
|
||||||
var storage = db.db
|
var storage = db.db
|
||||||
if storage.hasKey(slotAsKey):
|
if storage.hasKey(slotAsKey):
|
||||||
#result = storage[slotAsKey]
|
#result = storage[slotAsKey]
|
||||||
result = (storage[slotAsKey].bigEndianToInt, true)
|
# XXX: `bigEndianToInt` can be refactored to work with a BytesRange/openarray
|
||||||
|
# Then we won't need to call `toSeq` here.
|
||||||
|
result = (storage[slotAsKey].toSeq.bigEndianToInt, true)
|
||||||
else:
|
else:
|
||||||
result = (0.u256, false)
|
result = (0.u256, false)
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,6 @@ import ./test_code_stream,
|
||||||
./test_gas_meter,
|
./test_gas_meter,
|
||||||
./test_memory,
|
./test_memory,
|
||||||
./test_stack,
|
./test_stack,
|
||||||
./test_opcode
|
./test_opcode,
|
||||||
# ./test_vm
|
./test_vm
|
||||||
|
# ./test_vm_json
|
||||||
|
|
Loading…
Reference in New Issue