Commit graph

950 commits

Author SHA1 Message Date
Roman Khimov
01082a8988 core: fix nondeterministic txGetReferences() behavior
Ranging over map is nondeterministic and contracts may be unprepared for
that. Fixes #454.
2019-11-15 18:04:59 +03:00
Roman Khimov
5e8122bfac core: add contract hash into the error output for checkStorageContext()
Makes debugging things easier.
2019-11-15 18:04:59 +03:00
Roman Khimov
64e20508e0 vm: use hex for ByteArray JSON marshallization
It's way more convenient for different purposes.
2019-11-15 18:04:59 +03:00
Roman Khimov
5ce269c035 core: change notify implementation to save notifications
Fixes #453 and makes it possible to refer to these notifications later.
2019-11-15 18:04:59 +03:00
Roman Khimov
9134cc1c37
Merge pull request #496 from nspcc-dev/fix/serialize
vm: fix a bug in collection serialize
2019-11-15 16:03:41 +03:00
Evgenii Stratonikov
7080b78a6b vm: fix a bug in collection serialize
When encountering already seen stack item we should fail
only if it is a collection. Duplicate Integers or ByteArrays are ok
because they can't lead to recursion.
2019-11-15 12:48:00 +03:00
Roman Khimov
e740fbe708
Merge pull request #495 from nspcc-dev/feature/494
io: implement io.Serializable for Uint256

This PR implements the first item from #494.
2019-11-14 17:52:40 +03:00
Evgenii Stratonikov
1a08ad19aa sc: implement io.Serializable for ParamType 2019-11-14 14:20:38 +03:00
Evgenii Stratonikov
2be18f91df util: implement io.Serializable for Uint256 2019-11-14 14:20:38 +03:00
Evgenii Stratonikov
b16e56a47b io: refactor BinReader.ReadArray()
Make it accept arbitrary slice pointer.
2019-11-14 14:19:58 +03:00
Roman Khimov
2f838df585
Merge pull request #490 from nspcc-dev/feature/431
network: implement ConsensusPayload decoding

Closes #431, it is also needed to validate payloads.
2019-11-13 18:55:20 +03:00
Evgenii Stratonikov
085ca7b770 network: implement Consensus payloads 2019-11-13 17:27:25 +03:00
Evgenii Stratonikov
ad9091d13d io: implement generic array (de-)serialization
It is done through reflection and panics
in every unexpected situation.
2019-11-13 17:27:23 +03:00
Evgenii Stratonikov
61fdd5cde5 util: make Uint256Size public 2019-11-13 17:09:55 +03:00
Roman Khimov
d45a9f84f6
Merge pull request #479 from nspcc-dev/feature/systemd-unit
added systemd unit file and target for make
2019-11-13 15:57:03 +03:00
anastasia prasolova
2afb1851d6 service file templating 2019-11-13 15:05:13 +03:00
Roman Khimov
5f8edc3e54
Merge pull request #489 from nspcc-dev/claim-processing
core: add proper claim transactions processing
2019-11-11 16:33:10 +03:00
Roman Khimov
394346fc26 core: add proper claim transactions processing 2019-11-11 15:35:57 +03:00
Roman Khimov
85d0bc4544
Merge pull request #488 from nspcc-dev/dbdump_466
cli: compatible with NGD reading/writing blockchain dump
2019-11-11 13:31:32 +03:00
Vsevolod Brekelov
7b6756cb7e cli: compatible with NGD reading/writing blockchain dump 2019-11-11 13:15:34 +03:00
Roman Khimov
5c8fb1fc8e
Merge pull request #486 from nspcc-dev/dump-restore-skip-fix
cli: fix skip usage in DB dump/restore
2019-11-08 17:24:17 +03:00
Roman Khimov
4736dad8f0 cli: fix skip usage in DB dump/restore
It was failing to process any blocks at all when (skip >= count) and in other
cases it processed wrong number of blocks.
2019-11-08 17:00:02 +03:00
Roman Khimov
4d770e3c37
Merge pull request #485 from nspcc-dev/close-blockchain
core: add Close() to blockchainer, implement it to properly close chain
2019-11-08 12:24:42 +03:00
Roman Khimov
b05754deac core: add Close() to blockchainer, implement it to properly close chain
Before it the deferred function in Run() was actually never able to properly
close the Store, so we weren't synching the latest state to the disk.
2019-11-08 12:19:54 +03:00
Roman Khimov
d33083e1e1 update CHANGELOG and ROADMAP, release 0.62.0 2019-11-07 17:18:43 +03:00
Roman Khimov
52a78d8c3d
Merge pull request #484 from nspcc-dev/feature/max_integer
The last VM limit we need to implement is the restriction of BigInteger size.
This PR implements it.
Closes #373 .
2019-11-07 16:02:43 +03:00
anastasia prasolova
a00275bebd fixes after review 2019-11-07 14:57:02 +03:00
Evgenii Stratonikov
816d78b5ee vm: redefine SHL/SHR limits based on integer size 2019-11-07 12:50:11 +03:00
Evgenii Stratonikov
439cd72294 vm: restrict BigInteger item size 2019-11-07 12:34:27 +03:00
Vsevolod
f686069f37
Merge pull request #481 from nspcc-dev/core-fix-init-corner-cases
Fix init corner cases
2019-11-06 18:36:40 +03:00
Vsevolod
11b372b45d
Merge pull request #480 from nspcc-dev/handshake-wait-for-version
network: wait for both Version messages before ACKing
2019-11-06 18:33:20 +03:00
Roman Khimov
c567307748 core: fix potential issue with header list init
If we're to receive some 500 headers (less than `headerBatchCount`) and quit
before receiving more of them we end up with clean `bc.headerList` that will
be inited going backwards to the `targetHash`, but code path doesn't add add
the `targetHash` itself which it should do in this particular case, otherwise
we end with no genesis block hash in the list.
2019-11-06 18:13:45 +03:00
Roman Khimov
d7f747fa9a network: wait for both Version messages before ACKing
Otherwise the node might crash in `startProtocol` because of missing Version
field in the peer. And it also keeps the sequence correct, Version MUST be
sent first and ACKs can only follow it.
2019-11-06 18:05:50 +03:00
Roman Khimov
b5199625cd core: init genesis block header if there are no other headers in DB
Fixes crash when restarted after the DB initialization and no blocks written
into the DB.
2019-11-06 17:58:19 +03:00
Roman Khimov
c16c2bf102 core: store current header reference on clean init
Missing it the following line could fail on subsequent restarts:

        currHeaderHeight, currHeaderHash, err := storage.CurrentHeaderHeight(bc.store)

if the node was stopped before any headers had been received.
2019-11-06 17:56:06 +03:00
Roman Khimov
c062a8e288
Merge pull request #470 from nspcc-dev/config_updates_460
config: use logpath and address for server/rpc/monitoring, fix #460.
2019-11-06 17:30:01 +03:00
Vsevolod Brekelov
d799c98cfe io: move common function and add unit tests for it 2019-11-06 17:12:33 +03:00
Roman Khimov
aeef395c45
Merge pull request #476 from nspcc-dev/feature/neoUT
VM: Use JSON-based tests from neoVM

After the implementation of stack limits nothing is needed for us to pass reference JSON tests :)
The only thing that differs --- we do not compare stack in case of FAULT (which matches NEO 3 behavior).
Also two commits were reverted to match 2.x VM behavior.
2019-11-06 16:42:06 +03:00
Evgenii Stratonikov
6c002297cd vm: implement json tests from neoVM
Add neo-vm submodule @master2.x .
Closes #196.
2019-11-06 16:22:56 +03:00
Roman Khimov
9f7625d699 core: don't do useless DB reads if nothing was persisted 2019-11-06 16:10:37 +03:00
Roman Khimov
90d4299f0b core: gofmt blockchain.go 2019-11-06 16:09:45 +03:00
anastasia prasolova
95345b673a added systemd unit file and target for make 2019-11-06 16:09:07 +03:00
Vsevolod Brekelov
11ce73af28 server: add log-path and address configuration
- LogPath can be configured through config
- node,rpc and monitoring address can be configured thought command line
or config
2019-11-06 15:58:54 +03:00
Vsevolod Brekelov
1c08753915 gomod: fix 2019-11-06 15:56:24 +03:00
Roman Khimov
79d0c7446a
Merge pull request #478 from nspcc-dev/handshake-and-peers-fix
Fixes #458, MaxPeers handling and some other related things.
2019-11-06 15:42:02 +03:00
Roman Khimov
7cf9a40468 network: fix MaxPeers, introduce AttemptConnPeers
Our node didn't respect the MaxPeers setting, fix it with a drop of random
connection when this limit is reached (to give a chance for newcomers to
communicate), but also introduce AttemptConnPeers setting to tune the number
of attempted connections.

This also raises the default MaxPeers for testnet/mainnet to 100, because
neo-go nodes love making friends.
2019-11-06 15:29:58 +03:00
Roman Khimov
31954bb20c network: disallow double connections to the same peer
Makes no sense and C# node does it too.
2019-11-06 15:29:58 +03:00
Roman Khimov
d5a7ad2c47 network: fix data race in server peers map access 2019-11-06 15:29:58 +03:00
Roman Khimov
19918f471d config: fix mainnet config ports
Reference: https://docs.neo.org/docs/en-us/node/introduction.html
2019-11-06 15:29:58 +03:00
Roman Khimov
ec76ed23a5 network: rework peer handshaking, fix #458
This allows to start handshaking from both client and server (mainnet/testnet
nodes were seen to not care about string ordering for it), but still maintains
some sane checks in the process. It also makes functions thread-safe because
we have two goroutines servicing read and write side of the Peer connection,
so they can clash on access to the struct fields.

Add a test for it also.
2019-11-06 15:29:58 +03:00