Commit graph

1466 commits

Author SHA1 Message Date
Roman Khimov
c6894bfb3f vm/cli: fix load commands help 2020-06-26 00:13:58 +03:00
Roman Khimov
7e5533e77e
Merge pull request #1114 from nspcc-dev/fix-test-failures-2.x
Fix test failures 2.x
2020-06-25 22:01:16 +03:00
Roman Khimov
8f1ddc0651 rpc/server: fix error reporting in Start
This error message makes no sense when shutting down the server:
2020-06-25T19:29:53.251+0300    ERROR   failed to start RPC server      {"error": "http: Server closed"}

And ListenAndServer is documented to always return non-nil error one of which
is http.ErrServerClosed. This should also fix the following test failure:

==================
WARNING: DATA RACE
Read at 0x00c000254243 by goroutine 49:
  testing.(*common).logDepth()
      /usr/local/go/src/testing/testing.go:665 +0xa1
  testing.(*common).Logf()
      /usr/local/go/src/testing/testing.go:658 +0x8f
  testing.(*T).Logf()
      <autogenerated>:1 +0x75
  go.uber.org/zap/zaptest.testingWriter.Write()
      /go/pkg/mod/go.uber.org/zap@v1.10.0/zaptest/logger.go:130 +0x11f
  go.uber.org/zap/zaptest.(*testingWriter).Write()
      <autogenerated>:1 +0xa9
  go.uber.org/zap/zapcore.(*ioCore).Write()
      /go/pkg/mod/go.uber.org/zap@v1.10.0/zapcore/core.go:90 +0x1c3
  go.uber.org/zap/zapcore.(*CheckedEntry).Write()
      /go/pkg/mod/go.uber.org/zap@v1.10.0/zapcore/entry.go:215 +0x1e7
  go.uber.org/zap.(*Logger).Error()
      /go/pkg/mod/go.uber.org/zap@v1.10.0/logger.go:203 +0x95
  github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).Start()
      /go/src/github.com/nspcc-dev/neo-go/pkg/rpc/server/server.go:179 +0x5c5

Previous write at 0x00c000254243 by goroutine 44:
  testing.tRunner.func1()
      /usr/local/go/src/testing/testing.go:900 +0x353
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:913 +0x1bb

Goroutine 49 (running) created at:
  github.com/nspcc-dev/neo-go/pkg/rpc/server.initClearServerWithInMemoryChain()
      /go/src/github.com/nspcc-dev/neo-go/pkg/rpc/server/server_helper_test.go:69 +0x305
  github.com/nspcc-dev/neo-go/pkg/rpc/server.initServerWithInMemoryChain()
      /go/src/github.com/nspcc-dev/neo-go/pkg/rpc/server/server_helper_test.go:78 +0x3c
  github.com/nspcc-dev/neo-go/pkg/rpc/server.testRPCProtocol()
      /go/src/github.com/nspcc-dev/neo-go/pkg/rpc/server/server_test.go:805 +0x53
  github.com/nspcc-dev/neo-go/pkg/rpc/server.TestRPC.func1()
      /go/src/github.com/nspcc-dev/neo-go/pkg/rpc/server/server_test.go:793 +0x44
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:909 +0x199

Goroutine 44 (finished) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:960 +0x651
  github.com/nspcc-dev/neo-go/pkg/rpc/server.TestRPC()
      /go/src/github.com/nspcc-dev/neo-go/pkg/rpc/server/server_test.go:792 +0x5d
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:909 +0x199
==================
2020-06-25 19:41:29 +03:00
Roman Khimov
c489f975d4 core: fix TestSubscriptions occasional failures
panic: Log in goroutine after TestSubscriptions has completed

goroutine 1079 [running]:
testing.(*common).logDepth(0xc00057a100, 0xc00039e210, 0xa4, 0x3)
	/usr/local/go/src/testing/testing.go:634 +0x51a
testing.(*common).log(...)
	/usr/local/go/src/testing/testing.go:614
testing.(*common).Logf(0xc00057a100, 0xe32eaa, 0x2, 0xc0009560e0, 0x1, 0x1)
	/usr/local/go/src/testing/testing.go:649 +0x91
go.uber.org/zap/zaptest.testingWriter.Write(0xf64120, 0xc00057a100, 0x0, 0xc0003fe400, 0xa5, 0x400, 0xc000958e40, 0xc0009560d0, 0xc000958e60)
	/go/pkg/mod/go.uber.org/zap@v1.10.0/zaptest/logger.go:130 +0x120
go.uber.org/zap/zapcore.(*ioCore).Write(0xc0005cd050, 0x0, 0xbfb54ffc0626aba2, 0x916de700, 0x1485500, 0x0, 0x0, 0xe43fb0, 0x1c, 0x0, ...)
	/go/pkg/mod/go.uber.org/zap@v1.10.0/zapcore/core.go:90 +0x1c5
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc000102d10, 0xc00039a000, 0x5, 0x5)
	/go/pkg/mod/go.uber.org/zap@v1.10.0/zapcore/entry.go:215 +0x1e8
go.uber.org/zap.(*Logger).Info(0xc00035eba0, 0xe43fb0, 0x1c, 0xc00039a000, 0x5, 0x5)
	/go/pkg/mod/go.uber.org/zap@v1.10.0/logger.go:187 +0x96
github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).persist(0xc00000cb40, 0xc00017c2c0, 0xbe8a00)
	/go/src/github.com/nspcc-dev/neo-go/pkg/core/blockchain.go:839 +0x6c9
github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).Run.func2(0xc00000cb40, 0xc0005c6c30)
	/go/src/github.com/nspcc-dev/neo-go/pkg/core/blockchain.go:302 +0x54
created by github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).Run
	/go/src/github.com/nspcc-dev/neo-go/pkg/core/blockchain.go:301 +0x25d
FAIL	github.com/nspcc-dev/neo-go/pkg/core	2.463s
2020-06-25 19:41:17 +03:00
Roman Khimov
d12258e79c
Merge pull request #1106 from nspcc-dev/fix/rpc
Add missing neox rpc client wrappers
2020-06-25 17:11:02 +03:00
Evgenii Stratonikov
eb37f92881 rpc/client: support verifyproof RPC 2020-06-25 17:07:23 +03:00
Evgenii Stratonikov
654877fb1b rpc/client: support getproof RPC 2020-06-25 17:04:23 +03:00
Evgenii Stratonikov
d8dddabc86 rpc/client: support getstateheight RPC 2020-06-25 16:19:47 +03:00
Evgenii Stratonikov
b4b0ae0f51 rpc/client: support getstateroot RPC 2020-06-25 16:19:47 +03:00
Evgenii Stratonikov
45a95b5242 rpc/server: remove debug fmt.Println() from tests 2020-06-25 16:19:47 +03:00
Roman Khimov
d8556b80bc interop: fix key recovery functions documentation
Follow 7d786fac79 update.
2020-06-25 14:30:53 +03:00
Evgenii Stratonikov
2b21102c14 core,dao: use MPT only if it is enabled in config 2020-06-24 16:13:27 +03:00
Roman Khimov
fbadb317f5
Merge pull request #1096 from nspcc-dev/neox-2.x
Neox 2.x
2020-06-24 16:08:19 +03:00
Roman Khimov
25fdc62203 core: add state height to prometheus metrics 2020-06-24 14:47:08 +03:00
Roman Khimov
ea17793aee core: fix unconditional MPT collapsing
It should depend on EnableStateRoot.
2020-06-24 14:41:57 +03:00
Roman Khimov
03977083c0
Merge pull request #1095 from nspcc-dev/update-dbft-neox-2.x
consensus: update dbft library (neox-2.x)
2020-06-24 14:32:06 +03:00
Roman Khimov
86110445a6 consensus: update dbft library
Pick up the following changes:
 * recovery message sending fix
 * tx re-requests on sendRecoveryRequest
 * proposed block checks fix
 * timeout calculation fix for InitializeConsensus
 * removal of TxPerBlock which is irrelevant for neo-go (policying is done by
   the node, not dbft library)
2020-06-24 13:39:12 +03:00
Evgenii Stratonikov
9ee9cb8e39 core: provide key recovery interops only if neox is enabled 2020-06-24 12:37:27 +03:00
Evgenii Stratonikov
b5fb63d091 *: specify first state root index in config 2020-06-24 12:37:27 +03:00
Evgenii Stratonikov
d128b55dbf *: add config flag for enabling state root feature 2020-06-24 12:37:27 +03:00
Evgenii Stratonikov
c06b3b669d io: make maxArraySize public 2020-06-24 12:14:33 +03:00
Evgenii Stratonikov
bc81b56708 consensus: fix decodeData doc-comment 2020-06-24 10:47:44 +03:00
Evgenii Stratonikov
2863343f03 consensus: use a method function for NewPayload() 2020-06-22 17:06:28 +03:00
Roman Khimov
3a6186af54
Merge pull request #1083 from nspcc-dev/fix/stateroot
Request verified state roots
2020-06-22 16:42:41 +03:00
Evgenii Stratonikov
ad0cf146e8 consensus: restrict invocation script size 2020-06-22 15:36:12 +03:00
Evgenii Stratonikov
511d18d409 io: allow to restrict slice size in ReadVarBytes 2020-06-22 15:35:42 +03:00
Evgenii Stratonikov
aebed3826b consensus: fix commitCompact payload
Add state root signature to `commitCompact` in `recoveryMessage`.
2020-06-22 14:30:21 +03:00
Evgenii Stratonikov
caf53740d3 network: do not process state roots below verified height
Implement fast path to skip state root retrieval and decoding.
2020-06-22 12:33:35 +03:00
Evgenii Stratonikov
e2e1bd09ae network: request state roots if needed 2020-06-22 12:33:35 +03:00
Evgenii Stratonikov
f8051da0bd core: extend Blockchainer interface with StateHeight()
Allow to query current verified state root height.
2020-06-22 10:53:13 +03:00
Evgenii Stratonikov
f665843887 core: update verified state root height 2020-06-22 10:53:12 +03:00
Evgenii Stratonikov
cc5b5bff2e compiler: emit NOTEQUAL only for numbers
Dispatch based on types similarly to EQUAL.
2020-06-11 17:41:52 +03:00
Evgenii Stratonikov
9d6b0ee4a8 compiler: disallow comparing slices with nil
NEO VM does not distinguish between empty and nil slices. Supporting
this is not easy and requires changing lots of other opcodes.
Pointers are not supported anyway and slices can be checked for
emptiness by inspecting their `len`.
2020-06-11 17:40:02 +03:00
Evgenii Stratonikov
bf6aa02dcf compiler: set default values for complex struct fields
Set default value also for complex (struct, map) types.
Note: because VM does not distinguish empty array and nil array,
comparison 'a == nil' can't be handled properly without substantial
effort. This will be fixed in NEO3.
2020-06-11 17:40:02 +03:00
Roman Khimov
d5ba2e49a2
Merge pull request #1045 from nspcc-dev/fix/stateroot
consensus: verify state root in PrepareRequest
2020-06-11 11:25:02 +03:00
Evgenii Stratonikov
8614867439 consensus: verify state root in PrepareRequest
Fixes #1042.
2020-06-11 10:18:12 +03:00
Roman Khimov
7d786fac79 core: fix key recovery interops return value
It's uncompressed coordinate, both X and Y, not just X. Fix #1043.
2020-06-10 19:20:57 +03:00
Roman Khimov
a6541c4514 keys: add support for uncompressed serialization in PublicKey 2020-06-10 19:17:08 +03:00
Roman Khimov
788304ec49
Merge pull request #1021 from nspcc-dev/feature/remove
compiler: implement Remove builtin (2.x)
2020-06-10 11:09:56 +03:00
Roman Khimov
edd60e656e consensus: fix processing changeview payloads from recovery message
Using view number from the recovery message is just plain wrong, it's gonna be
higher than our current view and these messages will be treated as coming from
the future, even though they have their original view number included.
2020-06-09 18:17:01 +03:00
Roman Khimov
76f71ab1ef
Merge pull request #1012 from nspcc-dev/feature/mptrpc
rpc: implement MPT-related RPC (2.x)
2020-06-09 17:25:55 +03:00
Evgenii Stratonikov
1fd7938fd8 network: process state roots properly 2020-06-08 17:31:59 +03:00
Evgenii Stratonikov
519a98039c rpc: implement verifyproof RPC
Test getproof and verifyproof together.
2020-06-08 17:31:59 +03:00
Evgenii Stratonikov
8cbbddddaf rpc: implement getproof RPC 2020-06-08 17:31:58 +03:00
Evgenii Stratonikov
fe8038e8b7 rpc/server: implement getstateheight RPC 2020-06-08 16:40:37 +03:00
Evgenii Stratonikov
53dc7f27b6 rpc/server: implement getstateroot RPC 2020-06-08 16:40:37 +03:00
Evgenii Stratonikov
dcaa82b32b rpc: convert null value to a defaultT
Right now we convert it is unmarshaler into a float64(0)
so an error is supressed.
2020-06-08 16:39:02 +03:00
Roman Khimov
6437f4b32e core: respect MaxFreeTransactionsPerBlock setting
Fix #1019.
2020-06-08 12:35:39 +03:00
Evgenii Stratonikov
9f7f94a6fb compiler: implement Remove builtin
Support removing items from collections via REMOVE opcode.
2020-06-08 12:05:44 +03:00
Anna Shaleva
4f1cf07075 compiler: add public key recovering syscalls
Added Secp256r1Recover and Secp256k1Recover syscalls.
2020-06-05 22:13:17 +03:00