Commit graph

7914 commits

Author SHA1 Message Date
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
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
decentralisedkev
1a6bdd4099
[Server] Implements Orchestration server (#252)
* [pubsub]

- remove pubsub package

* [chain]

- Add height to chain

* [peer]

- remove unnecesary println

* [server]

- Implement server package

* Add main.go to run node
2019-03-28 22:49:34 +00:00
dauTT
955bb373fc Implemented SHL, SHR opcode (#250) 2019-03-28 22:28:20 +00:00
decentralisedkev
cb21c66316
Syncmgr: Implement synchronisation manager (#249)
* [syncmgr]

- Add blockmode, normal mode, headermode
- Add config file
- Add test files
- removed RequestBlocks and RequestHeaders from peers, as we will use
the peermanager for this
- OnHeaders and OnBlock in syncmgr, now return errors
- refactored all tests to use a convenience method to return a syncmgr
and testHelper
2019-03-28 21:22:17 +00:00
dauTT
84b4b41288 Implemented DIV, MOD opcode (#237) 2019-03-28 20:32:32 +00:00
decentralisedkev
493d8f3d95
[chain] Refactor, add chaincfg and database initialisation (#243)
* [chain]

- Add basic chain cfg parameters

- Added logic to insert genesis block, if it is a fresh database

- changed SaveBlock to ProcessBlock
- changed SaveHeaders to ProcessHeaders

- Changed parameter from a wire message to the payload, for header and
block processing

- Added check in chain for when the block is in the future, i.e. not at
the tip of the chain

- Added custom error returns, to distinguish between a database error
and a validation error
2019-03-28 20:23:50 +00:00
dauTT
139b770712 Implemented NZ, MUL opcode (#235) 2019-03-28 19:47:47 +00:00
decentralisedkev
8afec1ea45
[Peer] Add peer manager (#241)
* [PeerMgr]

- Add basic peer manager
2019-03-28 19:46:31 +00:00
dauTT
afe670f178 VM: Implement, ABS, NOT opcode (#233)
* Implemented, ABS, NOT opcode
2019-03-28 19:26:55 +00:00
decentralisedkev
dc5de1fa6d
[Peer] Refactor (#240)
[Peer]

- Closes #239

- moved response handlers to their own functions

- removed DefaultConfig from LocalConfig file

- passed peer as a parameter to all response handlers

- added peer start height

- refactored NewPeer function to be more concise and clear

- removed empty lines at end of functions

- Added AddMessage/RemoveMessage for Detector in outgoing and ingoing
requests for Block and Headers
2019-03-28 19:09: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
dauTT
ce1fe72607 Finalized size calculation methodology (#215)
- Simplified Transactioner interface
-  Added size calculation test
- Added utility methods in the address pkg: FromUint160, Uint160Decode
2019-03-25 01:04:54 +00:00
dauTT
beab4d186f Fixed Txn Attribute econding/decoding (issue: #216) (#217) 2019-03-24 23:11:54 +00:00
decentralisedkev
7d84d44b08
[chain] (#209)
- Add basic skeleton for chain struct
2019-03-23 19:09:25 +00:00
decentralisedkev
30e5aa8f48
Add Chain saving functionality to Database (#206)
* [database]

- Add Prefix method to interface
- Convert leveldb error to `database error`
- Be explicit with prefixedKey in `Table` as slices can be pointers

* [protocol]
- Add stringer method to protocol

* [Chaindb]

- Added saveBlock() which will allow us to save a block into the
database. The block is broken up into transactions and Headers. The
headers are saved as is. The transactions are saved as is, then the
utxos in the transactions are collected to make the utxo db.

- Verification for blocks and transactions will reside in the same
package. Note that the save methods are all unexported, while the Get
methods are exported. Making it so that any can call a get method, but
only code in this package may save to the database. The other code which
will reside in this package will be code verification logic.

* [chaindb]

- Added saveHeader function which saveHeaders  uses

- Update the latest header, each time we save a header instead of after a batch. This is so that we can call saveHeader without saveHeaders. This functionality can be rolled back if the performance of updating the header after a batch is significant

- small refactor in test code
2019-03-23 16:57:05 +00:00