Commit graph

93 commits

Author SHA1 Message Date
Roman Khimov
4e40467dc3 pkg/vm/stack: fix S1008 gosimple warning from GolangCI
S1008: should use 'return ' instead of 'if { return }; return ' (from gosimple)
2019-08-12 18:05:04 +03:00
Roman Khimov
bab187f4a8 pkg/vm: drop bogus err check in BoolAnd() and BoolOr()
GolangCI:
  nilness: impossible condition: nil != nil (from govet)
2019-08-12 18:00:54 +03:00
Roman Khimov
613bad36e0 pkg/vm/stack: fix unused binary.Read() result in testReadInt64()
GolangCI:
  Error return value of binary.Read is not checked (from errcheck)
2019-08-12 17:56:51 +03:00
Roman Khimov
d6c3f74e3c pkg/vm/stack: make some use of testReadInt64()
GolangCI complains:
  testReadInt64 is unused (from deadcode)

Fix it to always provide correctly-sized buffer for the binary.Read().
2019-08-12 17:53:19 +03:00
Roman Khimov
6be27ad4b0 pkg/vm/stack: s,testPeakInteger,testPeakInteger,
Fix obvious typo.
2019-08-12 17:16:47 +03:00
Roman Khimov
1fb66d6b73 pkg/vm/stack: improve Array testing code slightly
GolangCI complained:
  testArray is unused (from deadcode)

But this function was actually wrong being a copy-paste of testMakeStackMap(),
it also didn't conform to testMake... naming scheme, so this fixes it. To make
thing more uniform NewArray() was also changed to return error, map_test.go
code adjusted to this changes and finally array_test.go was added as a stub
for future Array testing.
2019-08-12 17:12:05 +03:00
Roman Khimov
3bc195659a pkg/vm: fix error handling in XDROP()
Found by GolangCI:
  Error return value of ctx.Estack.Remove is not checked (from errcheck)
  nilness: impossible condition: nil != nil (from govet)
2019-08-12 16:40:19 +03:00
Roman Khimov
06f9e1d123 pkg/(crypto|vm): fix GolangCI errcheck warnings
Like:
  Error return value of alg.Write is not checked (from errcheck)

Actually even though the hash.Hash implements an io.Writer interface (that
return meaningful things on .Write()) it has this comment in its
documentation:

// Write (via the embedded io.Writer interface) adds more data to the running hash.
// It never returns an error.

so it should be OK to ignore return results here.
2019-08-12 16:36:06 +03:00
Roman Khimov
a976c4d04f pkg/vm: go fmt
Some errors were introduced by github merges.
2019-08-12 16:29:42 +03:00
Roman Khimov
0258fa48f8 pkg/vm: fix all GolangCI warnings about v.executeOp errcheck
Fixes lots of warnings like this in the test code:
  Error return value of v.executeOp is not checked (from errcheck)
2019-08-12 16:25:16 +03:00
Roman Khimov
18d32a33a2
Merge branch 'vm' into dauTT/vm-ROLL-ROT-SWAP-TUCK-opcode 2019-08-12 15:37:58 +03:00
Roman Khimov
e9f4a0739f
Merge branch 'vm' into dauTT/vm-DUP-NIP-OVER-PICK-opcode 2019-08-12 13:35:08 +03:00
Roman Khimov
5167c37255
Merge branch 'vm' into dauTT/vm-XSWAP-XTUCK-DEPTH-DROP-opcode 2019-08-12 13:02:24 +03:00
Roman Khimov
c0a0749d80
Merge branch 'vm' into dauTT/vm-DUPFROMALTSTACK-TOALTSTACK-FROMALTSTACK-XDROP-opcode 2019-08-12 12:47:24 +03:00
Roman Khimov
3a7cfe26ac
Merge branch 'vm' into dauTT/vm-NOP-JMP-JMPIF-JMPIFNOT-opcodes 2019-08-12 12:42:21 +03:00
Roman Khimov
b46439d8d4
Merge branch 'vm' into dauTT/vm-crypto-opcode-194 2019-08-12 12:36:23 +03:00
Roman Khimov
03939bb8ba
Merge branch 'vm' into dauTT/vm-bitwise-opcodes-191 2019-08-12 12:21:52 +03:00
Roman Khimov
eeecbf96bf
Merge branch 'vm' into dauTT/vm-implement-Map-Struct-167 2019-08-12 12:11:29 +03:00
Roman Khimov
e52f78165e
Merge pull request #261 from dauTT/dauTT/vm-implement-MIN-MAX-WITHIN-opcodes-230
Implemented MIN, MAX WITHIN opcode
2019-08-12 12:06:24 +03:00
Roman Khimov
e99d916b04
Merge pull request #286 from nspcc-dev/interop-test-dummy
neo-vm test reusage sample, merging as per #283 discussion.
2019-08-12 12:05:36 +03:00
DauTT
458e6f922b Clean up comments 2019-04-12 22:34:28 +02:00
DauTT
d36d8b456c Implemented following opcodes:
1) ROLL
2) ROT
3) SWAP
4) TUCK
2019-04-12 22:27:52 +02:00
DauTT
d43dcf03cb Implemented following opcodes:
1) DUP
2) NIP
3) OVER
4) PICK
2019-04-12 20:25:20 +02:00
DauTT
aa67e98726 Implemented following opcodes:
1) XSWAP
2) XTUCK
3) DEPTH
4) DROP
2019-04-12 00:38:57 +02:00
DauTT
7e20b604b4 Implemented following opcodes:
1) DUPFROMALTSTACK
2) TOALTSTACK
3) FROMALTSTACK
4) XDROP
2019-04-11 00:07:17 +02:00
DauTT
4dc11ee48f Implemented following control flow opcodes:
1) NOP
2) JMP
3) JMPIF
4) JMPIFNOT
2019-04-09 01:07:15 +02:00
DauTT
51f8351723 Used consistently assert.Nil for checking absence of error 2019-04-05 21:13:23 +02:00
DauTT
3c8448ed40 Simplied code by using help method PopByteArray 2019-04-05 20:34:02 +02:00
DauTT
2897c3cbc1 Implemented crypto opcodes:
1) SHA1
2) SHA256
3) HASH160
4) HASH256
2019-04-04 22:46:06 +02:00
DauTT
de1c4e01a1 Implemented bitwise opcodes:
1) AND
2) XOR
3) OR
4) INVERT
2019-04-04 00:34:21 +02:00
dauTT
6d2fb5d89f
Merge branch 'vm' into dauTT/vm-implement-MIN-MAX-WITHIN-opcodes-230 2019-04-03 20:36:54 +02:00
dauTT
045db09af2 Implemented LTE, GTE opcode (#260)
* Implemented LTE, GTE opcode
2019-04-02 23:43:52 +01:00
DauTT
c6cd0e0c21 Implemented Map Stack Item:
1) Added new file map.go, map_test.go
2) Added Map, Hash Method to Item interface
3) Implemented Hash Method for every stack items (Boolean, Array, Int, ...)
2019-04-02 22:38:41 +02:00
dauTT
7bf4d691a9 Implemented NUMEQUAL, NUMNOTEQUAL opcode (#256) 2019-03-30 15:01:06 +00:00
dauTT
1fbc0af5db VM: Implement BOOLAND, BOOLOR opcode (#251)
* Implemented BOOLAND, BOOLOR opcode
2019-03-29 21:22:44 +00:00
dauTT
9402540c3a Implemented LT, GT opcode (#259)
* Implemented LT, GT opcode
2019-03-29 19:35:16 +00:00
DauTT
d818c16297 Implemented MIN, MAX WITHIN opcode 2019-03-29 17:43:16 +01:00
dauTT
955bb373fc Implemented SHL, SHR opcode (#250) 2019-03-28 22:28:20 +00:00
dauTT
84b4b41288 Implemented DIV, MOD opcode (#237) 2019-03-28 20:32:32 +00:00
dauTT
139b770712 Implemented NZ, MUL opcode (#235) 2019-03-28 19:47:47 +00:00
dauTT
afe670f178 VM: Implement, ABS, NOT opcode (#233)
* Implemented, ABS, NOT opcode
2019-03-28 19:26:55 +00:00
dauTT
14e0ab48dd VM: Implemented SIGN, NEGATE opcode (#232)
* Implemented SIGN, NEGATE opcode
2019-03-28 18:30:36 +00:00
dauTT
d8e399f67d VM: Implement INC, DEC opcode (#231)
[VM]

- Implemented INC, DEC opcode
2019-03-26 23:15:13 +00:00
dauTT
24cd21bd8c VM:Implement THROW opcode (#219)
[VM]

- Changed vmstate from HALT to FAULT in Sub opcode
- Implemented THROW opcode + tests
- Renamed TestSimpleRun test to TestThrowIfNot
2019-03-26 21:19:41 +00:00
BlockChainDev
bab5d370bb Interop 2019-03-18 21:58:51 +00:00
BlockChainDev
9951f04099 [Stall]
Change seconds to milliseconds in test
2019-03-18 21:33:07 +00:00
BlockChainDev
a2bdc076d2 [VM] fix typo 2019-03-18 21:17:43 +00:00
BlockChainDev
8809be183e [VM]
Add Result stack len check in simple run test
2019-03-18 21:15:40 +00:00
BlockChainDev
da27c2b3f0 [Stack]
- Change RemoveCurrentContext for PopCurrentContext
- Add CopTo method to stack
2019-03-18 21:15:09 +00:00
BlockChainDev
c177e5577e [VM]
refactor handlers to have rstack as argument
2019-03-18 21:14:03 +00:00