Commit graph

839 commits

Author SHA1 Message Date
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
Roman Khimov
e859e03240 network: split Peer's NetAddr into RemoteAddr and PeerAddr
As they are different things used for different purposes.
2019-11-06 15:26:24 +03:00
Vsevolod
f48b19a305
Merge pull request #471 from nspcc-dev/rpc-minor-fixes
Minor RPC fixes
2019-11-02 22:13:17 +03:00
Roman Khimov
de2eeb4671 rpc: add one to the block height for the getblockcount response
There is a difference in interpretation of what a block count is. neo-go nodes
currently respond to this request with the latest block number which is the
same number that neoscan.io shows. However, C# nodes deliberately do add one
to this number when answering to the getblockcount request to account for the
genesis block number 0.

This patch makes us consistent with C# nodes wrt to getblockcount behaviour.
2019-11-01 20:13:00 +03:00
Roman Khimov
70e4529848 rpc: add 0x prefix to the getbestblockhash answer
For consistency with C# nodes that do add it to their answers.
2019-11-01 20:12:44 +03:00
Roman Khimov
54bb9b94c7 CHANGELOG: fix Prometheus bug number 2019-11-01 15:33:46 +03:00
Roman Khimov
8730f56785 update CHANGELOG and ROADMAP, release 0.61.0 2019-11-01 14:36:53 +03:00
Roman Khimov
29b097eb31
Merge pull request #469 from nspcc-dev/cors-and-minpeers
Better variant of #464 and a fix for unconfigured MinPeers.
2019-11-01 13:47:31 +03:00
Roman Khimov
e9f8b25776 network: add default MinPeers
If there is nothing specified in the configuration, set it to some reasonable
value.
2019-11-01 13:39:47 +03:00
Roman Khimov
b46dd295bc rpc: add CORS workaround for RPC
This one enables our RPC to be called from the browser if there is a
need. It's insecure and not standards-compliant, thus this behaviour is
configurable is not enabled by default. It makes our node with this workaround
enabled compatible with neo-mon monitoring.

Originally debugged by @anatoly-bogatyrev in #464.
2019-11-01 13:39:47 +03:00
Roman Khimov
e5205d26a3
Merge pull request #468 from nspcc-dev/configurable-minpeers
network: make minpeers configurable
2019-10-31 15:12:09 +03:00
Roman Khimov
b12a68994d network: make minpeers configurable
Without it node in privnet tries to reconnect to four existing nodes
indefinitely for no good reason.
2019-10-31 15:10:00 +03:00
Roman Khimov
2f6e678a19
Merge pull request #463 from nspcc-dev/smartcontract-fixes
Smartcontract RPC fixes
2019-10-29 20:54:46 +03:00
Roman Khimov
6d1a09183b
Merge pull request #455 from nspcc-dev/prometheus_441
add prometheus monitoring, fix #441
2019-10-29 20:54:29 +03:00
Vsevolod Brekelov
d374175170 monitoring: add prometheus monitoring
add init metrics service which uses prometheus;
add configuration for metrics service;
add monitoring metrics for blockchain,rpc,server;
2019-10-29 20:51:17 +03:00
Roman Khimov
ebc1ba4f38 rpc/core: implement invokescript method, fix #348
Extend Blockchainer with one more method to spawn a VM for test runs and use
it to run scripts. Gas consumption is not counted or limited in any way at the
moment (see #424).
2019-10-29 18:31:39 +03:00
Roman Khimov
94776b8a1f vm: add MarshalJSON to the Stack
To easily dump it in a known format.
2019-10-29 18:26:59 +03:00
Roman Khimov
47f66dfbf3 vm: add State() method to get a state description 2019-10-29 18:26:04 +03:00
Roman Khimov
a568740f56 core: deduplicate a part of VM setup into spawnVMWithInterops() 2019-10-29 17:10:50 +03:00
Roman Khimov
3d6cf3a647 rpc: drop useless cases from server
Let them be handled by `default` statement returning a proper error instead of
plaintext message.
2019-10-29 16:48:14 +03:00
Roman Khimov
2b3fb14a4a smartcontract: allow RPC endpoint to be specified, fix #363
We already have support for running scripts inside VM CLI, so here we can just
make RPC endpoint configurable and be done with it. It also allows to use
local RPC endpoint if there is a need to.
2019-10-29 16:32:49 +03:00
Roman Khimov
9a86b2dc62
Merge pull request #461 from nspcc-dev/feature/stack_limits
vm: restrict max invocation stack size
2019-10-29 15:49:43 +03:00
c7f0b7bd68 vm: restrict max invocation stack size 2019-10-29 15:09:17 +03:00
Roman Khimov
579aa31ddd compiler: drop useless options parameter to Compile()
It's not used in any way there.
2019-10-29 13:02:54 +03:00
Roman Khimov
e319c6c638 cli: move avm inspect from vm to contract command
Make inspect work with avms by default and with go files if told so. In the
end this makes our CLI interface more consistent and usable. Drop useless
CompileAndInspect() compiler method along the way.
2019-10-29 12:56:44 +03:00
Roman Khimov
ae7687422c vm: clear state in Load()
Make VM usable after the first run.
2019-10-29 12:53:09 +03:00
Roman Khimov
0ea7568caa
Merge pull request #459 from nspcc-dev/network-fix-445
Fix discoverer races (#445)
2019-10-28 16:12:15 +03:00
Roman Khimov
006337b1f8 network: rework discovery with rwmutex, add test
Keeping run() as the owner of all maps would mean adding at least three more
channels to keep address getters with thread-safety. But then there also is a
race between requestToWork() and run() which is way harder to solve with
channels because there are lots of possibilities for deadlocks. So rework all
of this with good old mutexes.

While at it, fix `requestCh` handling in the inner select of run, it will waste
one loop to handle it, so we should add one to the `requested`.

Fixes #445.
2019-10-28 13:37:27 +03:00
Roman Khimov
77a50d6dc6 network: remove useless checks in discovery
These are useless.
2019-10-27 16:11:32 +03:00
Roman Khimov
0ed5dca9a2 ROADMAP: update, we'll need to push some more releases
Now that our nodes are running on mainnet, we need to update them with fixes
more often.
2019-10-26 12:00:22 +03:00
Roman Khimov
7235e9b459 update CHANGELOG and ROADMAP, release 0.60.0 2019-10-25 18:30:17 +03:00
Roman Khimov
a48e297252
Merge pull request #451 from nspcc-dev/call-isolation
vm: implement stack isolation opcodes, fix #192
2019-10-25 18:27:08 +03:00
Roman Khimov
f0cffe0d3f vm: implement stack isolation opcodes, fix #192
No tests yet.
2019-10-25 18:25:12 +03:00
Roman Khimov
d900be2585
Merge pull request #450 from nspcc-dev/tx-processing-fixes
TX processing fixes
2019-10-25 17:37:43 +03:00
Roman Khimov
99bbad331d core: add issue tx processing
Count available asset quantity, match C# code.
2019-10-25 17:20:12 +03:00
Roman Khimov
2611e9ab5c smartcontract: fix PropertyState definitions
Wrong bits were used to represent flags which is important for contracts
created via interop. Fixes contracts failing to store things:

WARN[16278] contract invocation failed                    block=3773025 err="error encountered at instruction 3435 (SYSCALL): failed to invoke syscall: contract c9d870d7857e956d82290d5df19de3133c107815 can't have storage" tx=fa695eea240b7b4dbb6f42ea6335447a764d8b629c40b7812ea3bca16b1f098d
WARN[16278] contract invocation failed                    block=3773025 err="error encountered at instruction 1279 (SYSCALL): failed to invoke syscall: contract 97210e7c98582151ceb37f9748c9a1d27d9ae6fd can't have storage" tx=0144d84038149fa0cf1f7912f7d5854fa5f3670f5b4217789c1441f9fd52d27b
2019-10-25 11:05:58 +03:00
Vsevolod
2e99d65554
Merge pull request #448 from nspcc-dev/tx-processing-fixes
TX relaying fixes
2019-10-24 13:54:42 +03:00
Roman Khimov
9ff55ac02c network: move inventory semantic check into common code
As per @volekerb suggestion.
2019-10-24 13:12:02 +03:00
Roman Khimov
45cac07643 core: remove transactions from MemPool when they're stored in block
Extend MemPool with Remove() and use it. Fixes #446.
2019-10-24 13:12:02 +03:00
Roman Khimov
184d8a0180 core: fix missing unlock in MemPool TryAdd()
Fixes deadlock on subsequent MemPool operations.
2019-10-24 13:12:01 +03:00
Roman Khimov
257ba1c2ad network: implement getdata message handling in server
To properly implement relaying we need to answer these requests from other
nodes.
2019-10-24 13:12:01 +03:00
Roman Khimov
8d0ed9259c transaction: fix invocation TX consistency in NewInvocationTX()
NewInvocationTX() returned a version number one transaction that actually
failed to pass that version down to the invocation data which lead to
serialization/deserialization inconsistency.
2019-10-23 14:50:24 +03:00
Vsevolod
3fcf0922ea
Merge pull request #444 from nspcc-dev/logo
add new neo logo with gopher
2019-10-22 20:19:19 +03:00
Vsevolod Brekelov
2781166f6c add new neo logo with gopher 2019-10-22 19:48:22 +03:00
Roman Khimov
1250bf9579
Merge pull request #443 from nspcc-dev/spellcheck
spellcheck and comments fix
2019-10-22 18:01:40 +03:00
Vsevolod Brekelov
8ee421db14 fix spelling and godoc comments 2019-10-22 17:56:03 +03:00
Vsevolod
d34ad8d0de
Merge pull request #442 from nspcc-dev/vm-fix-run
vm: fix tests failing, follow-up to #426
2019-10-22 15:51:25 +03:00
Roman Khimov
a9a2a3c711 vm: fix tests failing, follow-up to #426
Deal with input and transitional VM states properly.
2019-10-22 15:20:44 +03:00