Commit graph

579 commits

Author SHA1 Message Date
Roman Khimov
b4e284f301 discovery: make pool management more reliable
Just drop excessive addresses, otherwise we can block for no good reason.
2019-09-16 16:26:30 +03:00
Roman Khimov
85f19936dd network: implement connection retries
It's worth to try a bit more than once.
2019-09-16 16:26:30 +03:00
Roman Khimov
be6c905e5d network: use and improve discovery mechanism for reconnections
This makes our node reconnect to other nodes if connection drops for some
reason. Fixes #390.
2019-09-16 16:26:30 +03:00
Roman Khimov
b263c97bbb core: add some mechanism to drop bad blocks from cache
If we can't persist anything from our cache there is something wrong with
it. Try to remediate some possible problems.
2019-09-16 16:26:30 +03:00
Roman Khimov
521a707e33 core: don't print contracts in persistBlock()
Yeah, this really needs more love, but for now just don't spit 'em out on the
screen, please.
2019-09-12 16:12:12 +03:00
Roman Khimov
d0ffd165fd
Merge pull request #393 from nspcc-dev/assorted-db-handling-fixes-and-optimizations
Assorted db handling fixes and optimizations based on the testnet
connection experience.
2019-09-11 22:31:19 +03:00
Roman Khimov
4395cea344 storage: fix reading overlapping hash blocks from the DB
In the unlikely event of overlapping hash block written to the DB we might end
up with wrong hash list. That happened to me for some reason when synching
with the testnet leading to the following keys with respective values:
  150000 -> 2000 hashes
  152000 -> 2000 hashes
  153999 -> 2000 hashes

Reading it hashes number 153999 and 154000 got the same values and the chain
couldn't sync correctly.
2019-09-11 20:33:41 +03:00
Roman Khimov
4f60fd3e8e core: optimize persist() for the case when no next block found
If there is no next block in the cache, looping through the whole cache won't
help.
2019-09-11 20:32:30 +03:00
Roman Khimov
7812fb28ea core: optimize blockchain init with existing DB
There is no need to generate genesis block (it's already in the DB) and we can
add all hashes at once without iterating over them.
2019-09-11 20:28:49 +03:00
Roman Khimov
6855e4e07a
Merge pull request #392 from nspcc-dev/fix/bug-append
VM: APPEND should push no value on stack. Fixes #391.
2019-09-11 19:02:05 +03:00
Evgenii Stratonikov
68c6c93980 vm: do not allow APPEND to operate on bytearray 2019-09-11 17:17:37 +03:00
Evgenii Stratonikov
723dcc6e25 vm: make APPEND push no value on stack 2019-09-11 17:17:34 +03:00
Roman Khimov
6f7e565b45
Merge pull request #389 from nspcc-dev/update-config-seeds
config: update mainnet and testnet seed lists
2019-09-11 15:15:06 +03:00
Roman Khimov
9281348846 config: update mainnet and testnet seed lists
Sync with neo-cli (master-2.x) branch.
2019-09-11 15:10:02 +03:00
Roman Khimov
794d375bfd
Merge pull request #388 from nspcc-dev/substr-left-indexes
VM: harden substr/left/right against bad indexes and improve
PUSHDATA along the way. Fixes #387.
2019-09-11 14:52:48 +03:00
Roman Khimov
8311bda355 vm: harden LEFT and RIGHT implementations against negative indexes 2019-09-11 14:51:04 +03:00
Roman Khimov
17f3a21e27 vm: harden SUBSTR implementation against bad index/offset values
The upper index bound for slices is capacity, not length. Check for negative
values also. Fixes #387.
2019-09-11 14:37:41 +03:00
Roman Khimov
fc1075bf75 vm: protect PUSHDATA from short reads
Same thing done in a2a8981979 for PUSHBYTES,
failing to read the amount of bytes specified should lead to FAULT. Also
makes readUint16() and readUint32() panic as this is the behavior we want in
these cases. Add some tests along the way.
2019-09-11 12:35:37 +03:00
Roman Khimov
14c02cb3b1
Merge pull request #385 from nspcc-dev/vm-contract-invoke-parameters-332-part1
VM CLI improvements, part 1 of #332 work.
2019-09-10 23:55:23 +03:00
Roman Khimov
9193ec45de
Merge pull request #383 from nspcc-dev/fix_blockchain_test
unitTests: fix for failing test
2019-09-10 23:53:50 +03:00
Roman Khimov
392a4c4f39 vm/cli: add some convenience heuristic to ease 'run' use 2019-09-10 23:31:06 +03:00
Roman Khimov
c5911c2f10 vm/cli: add support for bool type as 'run' parameter 2019-09-10 23:31:06 +03:00
Roman Khimov
982bdcd704 vm/cli: make operation mandatory if anything added to run
Matches neo-cli behavior.
2019-09-10 23:31:06 +03:00
Roman Khimov
5bd666b786 vm: return NOP as current instruction for just loaded VM
Before:
NEO-GO-VM > loadgo h.go
READY: loaded 16 instructions
NEO-GO-VM > ip
instruction pointer at -1 (PUSH0)

After:
NEO-GO-VM > loadgo h.go
READY: loaded 16 instructions
NEO-GO-VM > ip
instruction pointer at -1 (NOP)

I think NOP is a little less scary.
2019-09-10 23:31:06 +03:00
Roman Khimov
e872b6b421 vm/cli: redo the whole thing using abiosoft/ishell
Adds history support, better editing and way better help system. Expand on
some helps while at it.
2019-09-10 23:31:06 +03:00
Vsevolod Brekelov
0f31e7bf7f unitTests: fix for failing test
should fix circleCI and now these tests using inmemory db
2019-09-10 23:21:26 +03:00
Roman Khimov
d51ab52a5e
Merge pull request #386 from nspcc-dev/drop-go-1.11-support
update minimum supported version of Go to 1.12
2019-09-10 22:55:44 +03:00
Roman Khimov
00a290de07 update minimum supported version of Go to 1.12
Go 1.11 is not supported upstream and it also breaks our precious VM for some
reason, so use better versions of Go. Fixes #384.
2019-09-10 20:30:54 +03:00
Roman Khimov
4d7456903b
Merge pull request #377 from nspcc-dev/config_for_db
storage: support of Redis and configuration for DB

Closes #336.
2019-09-10 17:46:31 +03:00
Roman Khimov
c6d3313f82
Merge pull request #382 from nspcc-dev/feature/implicit-stackitem-conversion
VM: implement stack item conversion

Fixes #372.

Also added tests for NOT and SIGN to check new behavior.
Also fixed a bug with Bool casting: it should be != 0 instead of == 1.
2019-09-10 17:42:40 +03:00
Evgenii Stratonikov
31f4c7486b vm: add tests for CAT 2019-09-10 17:33:42 +03:00
Evgenii Stratonikov
1289d0f7e9 vm: add tests for NOT 2019-09-10 17:29:10 +03:00
Evgenii Stratonikov
f2393e5efc vm: implement * -> Boolean conversion 2019-09-10 17:29:10 +03:00
Evgenii Stratonikov
7e14c5a274 vm: implement * -> ByteArray conversion 2019-09-10 17:29:07 +03:00
Vsevolod Brekelov
06ecb1855e storage: redis db unit test 2019-09-10 17:22:45 +03:00
Vsevolod Brekelov
4f680703a4 storage: multiple DB support and Redis support
add config which closes #336
add redis db support
2019-09-10 17:22:21 +03:00
Evgenii Stratonikov
9b10b4c4d8 vm: add tests for SIGN 2019-09-10 15:08:42 +03:00
Evgenii Stratonikov
52b0d661e0 vm: implement BigInt -> Boolean conversion 2019-09-10 14:19:36 +03:00
Roman Khimov
33bb371f9b
Merge pull request #380 from nspcc-dev/drop-endpoint-fix-321
util: drop Endpoint structure, fix #321
2019-09-09 19:39:49 +03:00
Roman Khimov
8d9bc83214 util: drop Endpoint structure, fix #321
I think it's useless, buggy and hides parsing errors for no good reason.
2019-09-09 17:54:38 +03:00
Roman Khimov
0055701ec0
Merge pull request #379 from nspcc-dev/fix/left-with-big-index
vm: do not fault on LEFT with big index
2019-09-09 17:39:59 +03:00
Evgenii
0b58ed4a22 vm: do not fault on LEFT with big index
Fixes #378.
2019-09-09 17:29:31 +03:00
Roman Khimov
a039ae6cdb
Merge pull request #374 from nspcc-dev/makefile-and-gofmt
Makefile convenience targets and gofmt
2019-09-09 15:05:12 +03:00
Roman Khimov
b5d3c37a01
Merge pull request #375 from nspcc-dev/pushbytes-short-read-fix-361
vm: fix not failing PUSHBYTES* on short read
2019-09-09 15:02:56 +03:00
Roman Khimov
c59b51e7ab
Merge pull request #376 from nspcc-dev/use-mr-tron-base58-fix-355
crypto: use mr-tron/base58 for base58
2019-09-09 15:02:24 +03:00
Roman Khimov
bd2e347928 circleci: add Go 1.13 support, use as a reference for coverage
But don't use it for binary builds at the moment.
2019-09-09 14:59:09 +03:00
Roman Khimov
b8b26d8e79 core: fix 'implementation' misspell in test code
Found in the Go report card.
2019-09-09 14:53:50 +03:00
Roman Khimov
8db9d2a976 crypto: use mr-tron/base58 for base58
Use more fast and reliable implementation. Add some tests for our wrappers,
deduplicate code in PublicKey.Adress(). Fixes #355.
2019-09-09 13:12:55 +03:00
Roman Khimov
a2a8981979 vm: fix not failing PUSHBYTES* on short read
Add some tests also. Fixes #361.
2019-09-09 12:09:05 +03:00
Roman Khimov
fabd11699a *: gofmt -s
Appy gofmt for all the source tree.
2019-09-09 12:02:24 +03:00