Commit graph

6233 commits

Author SHA1 Message Date
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
db41a397cd
Merge pull request #120 from hal0x2328/master
Merging as a reminder as discussed in #283.
2019-08-12 15:41:48 +03:00
Roman Khimov
a4b2bb268e
Merge pull request #279 from dauTT/dauTT/vm-ROLL-ROT-SWAP-TUCK-opcode
VM: Implement ROLL, ROT, SWAP, TUCK opcode

Closes #278, merging as per #283 discussion.
2019-08-12 15:40:03 +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
f2f9a37d3f
Merge pull request #277 from dauTT/dauTT/vm-DUP-NIP-OVER-PICK-opcode
VM: Implement DUP, NIP, OVER, PICK opcode

Closes #276, merging as per #283 discussion.
2019-08-12 13:37:23 +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
37d7198877
Merge pull request #275 from dauTT/dauTT/vm-XSWAP-XTUCK-DEPTH-DROP-opcode
VM: Implement XSWAP, XTUCK, DEPTH, DROP opcode

Closes #274, merging as per #283 discussion.
2019-08-12 13:05:30 +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
6c3634cdb8
Merge pull request #273 from dauTT/dauTT/vm-DUPFROMALTSTACK-TOALTSTACK-FROMALTSTACK-XDROP-opcode
VM: Implement DUPFROMALTSTACK, TOALTSTACK, FROMALTSTACK, XDROP opcodes

Closes #272, merging as per #283 discussion.
2019-08-12 12:49:34 +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
6ffb4b6a5e
Merge pull request #271 from dauTT/dauTT/vm-NOP-JMP-JMPIF-JMPIFNOT-opcodes
VM: Implement NOP, JMP, JMPIF, JMPIFNOT opcode, closes #270.

Merging as per #283 discussion.
2019-08-12 12:44:02 +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
cdb92ebaa2
Merge pull request #267 from dauTT/dauTT/vm-crypto-opcode-194
VM: Implement SHA1, SHA256, HASH160, HASH256 opcode, closes #268.

Implemented
1) SHA1
2) SHA256
3) HASH160
4) HASH256
2019-08-12 12:40:18 +03:00
Roman Khimov
b46439d8d4
Merge branch 'vm' into dauTT/vm-crypto-opcode-194 2019-08-12 12:36:23 +03:00
Roman Khimov
b50411b057
Merge pull request #266 from dauTT/dauTT/vm-bitwise-opcodes-191
VM: Implement bitwise opcodes, closes #191

Implemented following opcodes:
    AND
    XOR
    OR
    INVERT
2019-08-12 12:28:51 +03:00
Roman Khimov
03939bb8ba
Merge branch 'vm' into dauTT/vm-bitwise-opcodes-191 2019-08-12 12:21:52 +03:00
Roman Khimov
ce0d6d97dc
Merge pull request #265 from dauTT/dauTT/vm-implement-Map-Struct-167
VM: Implement Map, Struct Stack Item:

Closes #167, merging as per discussion in #283.
2019-08-12 12:13:25 +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
Roman Khimov
03629a31c7
Merge pull request #264 from nspcc-dev/blockPool
syncmgr : Add blockpool to syncmgr
2019-08-12 12:02:09 +03:00
dauTT
b9b118d3ea Add ReverseString, ToReverseScriptHash method (#281)
* Added
1) ReverseString method to the Uint160 type
2) ToReverseScriptHash method to convert a base58 address to a reverse script hash

* Simplified ToScriptHash method
2019-08-05 09:34:31 +02: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
BlockChainDev
2477ead072 Merge branch 'dev' into blockPool 2019-03-31 00:25:00 +00:00
BlockChainDev
12149c9379 [server]
- remove extra call after adding a peer
- switched endian for headers endian switch
2019-03-31 00:24:10 +00:00
decentralisedkev
fb672c00ad
[travis] add verbose flag to test 2019-03-30 23:52:28 +00:00
BlockChainDev
336fc02ad5 [syncmgr]
- Fix bug; accounts for a fresh database startup and we only have the genesis block
2019-03-30 22:42:07 +00:00
BlockChainDev
06e71d9b7e [syncmgr]
- update comment
2019-03-30 21:44:24 +00:00
BlockChainDev
68b0e2e3f2 [server]
- modified server to pass the syncmgr the lastBlock.Index+1 so that
syncmgr knows what blockIndex it should be looking for upon
initialisation
2019-03-30 21:39:39 +00:00
BlockChainDev
751d2711d4 [syncmgr]
- refactored OnBlockBlockMode to use blockPool
- syncmgr now checks for future blocks, instead of looking for a
FutureBlockErr from the Chain. This makes it so that syncmgr does not
depend on the Chain package.
- removed GetBestBlockHash function from config(unused)
- refactored all tests in the syncmgr package
2019-03-30 21:36:50 +00:00
BlockChainDev
c401247af9 [syncmgr]
- refactor syncmgr for blockpool
- add nextBlockIndex so that we can add blocks to the blockPool by
comparing their index
- add processBlock helper method,wraps around cfg.ProcessBlock and increments the nextBlockIndex
internally
2019-03-30 21:34:27 +00:00
BlockChainDev
5ed61ff389 [syncmgr]
- add blockpool plus test
2019-03-30 21:32:44 +00:00
decentralisedkev
abb4da9cbd
[PeerMgr] Add Caching and Re-processing system (#263)
[peermgr]

- Add request cache with tests
- Add requestCache to peermgr
- refactored peer manager tests
- Added blockInfo struct, to allow sorting on the blockIndex
- added helper methods for cache, pickItem, pickFirstItem, removeHash,
findHash and refactored tests
- renamed requestcache to blockcache
- refactored peer manager to use block cache for block requests *only*
- added blockCallPeer function to handle block requests only
- refactored onDisconnect to add back any pending peer requests that the
disconnected peer did not complete into the peer manager queue

[peermgr/server]

- Modify onBlock handler in server, to send peermgr a BlockInfo struct

[peermgr/syncmgr/server]

- Modified blockIndex in BlockInfo to be uint32 and not uint64
- RequestBlocks in syncmgr now takes an index along with the hash
- modified syncmgr code to pass index along with hash in all methods
2019-03-30 18:10:27 +00:00
dauTT
7bf4d691a9 Implemented NUMEQUAL, NUMNOTEQUAL opcode (#256) 2019-03-30 15:01:06 +00:00