Commit graph

955 commits

Author SHA1 Message Date
Evgenii Stratonikov
f65545023d io: restrict ReadArray max array size 2019-11-15 22:39:21 +03:00
Roman Khimov
e4868cd429 core: implement EncodeBinary on value
Fixes panic:
panic: core.NotificationEvent does not have EncodeBinary(*BinWriter)

goroutine 97 [running]:
github.com/CityOfZion/neo-go/pkg/io.(*BinWriter).WriteArray(0xc004f7dda0, 0xabf820, 0xc004f7ddc0)
        /home/rik/dev/neo-go/pkg/io/binaryWriter.go:45 +0x4b7
github.com/CityOfZion/neo-go/pkg/core.(*AppExecResult).EncodeBinary(0xc000635498, 0xc004f7dda0)
        /home/rik/dev/neo-go/pkg/core/notification_event.go:73 +0x9c
github.com/CityOfZion/neo-go/pkg/core.putAppExecResultIntoStore(0xcf0020, 0xc001aafec0, 0xc000635498, 0xc004f81940, 0x40)
        /home/rik/dev/neo-go/pkg/core/notification_event.go:33 +0xab
github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).storeBlock(0xc000118000, 0xc006f89ea0, 0xc006f89ea0, 0x0)
        /home/rik/dev/neo-go/pkg/core/blockchain.go:534 +0x2539
github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).AddBlock(0xc000118000, 0xc006f89ea0, 0xc004f368b0, 0x1)
        /home/rik/dev/neo-go/pkg/core/blockchain.go:256 +0x91
github.com/CityOfZion/neo-go/pkg/network.(*blockQueue).run(0xc0048f4b80)
        /home/rik/dev/neo-go/pkg/network/blockqueue.go:39 +0x14c
created by github.com/CityOfZion/neo-go/pkg/network.(*Server).Start
        /home/rik/dev/neo-go/pkg/network/server.go:133 +0x272
2019-11-15 22:05:09 +03:00
Roman Khimov
1a5731e005 core: rework balance accounting
Store all unspents instead of balance values. Bump store version as this is an
incompatible change.
2019-11-15 22:05:09 +03:00
Vsevolod
2679d3fa35
Merge pull request #499 from nspcc-dev/fix-notifications-and-getreferences-bugs
Fix notifications and getreferences bugs
2019-11-15 19:11:49 +03:00
Roman Khimov
a16c2c3825 core: add NEP5 transfer tracking stub
See #498.
2019-11-15 18:04:59 +03:00
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