Roman Khimov
e5d0125a3f
network: do async broadcast when processing P2P TX
...
It can lead to some goroutine explosion, but supposedly it's better than
stalling other processing and eventually all of these goroutines should finish
their sends. Note that this doesn't change the behavior for RPC-relayed
transactions that are still waiting for the broadcast to finish ensuring
proper transaction distribution before returning the result to the client.
2020-01-30 14:03:52 +03:00
Roman Khimov
0fcbc697ca
network: only tell consensus service about new valid transactions
...
Transactions can be bad and can duplicate each other, consensus service
shouldn't be bothered with that.
2020-01-30 14:03:52 +03:00
Roman Khimov
fdbaac7a30
network: prevent broadcast queue starving, share time with p2p
...
Blocked broadcast queue of one peer may affect broadcasting capabilities of
the server, so prevent total blocking of it by p2p queue.
2020-01-30 14:03:52 +03:00
Roman Khimov
b2c4587dad
network: fix PeerAddr() for not-yet-handshaked case
...
If we have already got Version message, we don't need the rest of handshake to
complete before being able to properly answer the PeerAddr() requests. Fixes
some duplicate connections between machines.
2020-01-30 14:03:52 +03:00
Roman Khimov
49bd7aada5
network: log peerCount on connection registration
...
Symmetrical to disconnects, make it easier to look through the logs.
2020-01-30 14:03:52 +03:00
Roman Khimov
32695b4f40
network: don't unregister connected peers
...
If we drop connection because we're already connected don't unregister this
connected address because it's connected anyway!
2020-01-30 14:03:52 +03:00
Roman Khimov
eb4ec61b8b
network: register connected addr in handleVersionCmd()
...
Prevent useless attempts to connect to this peer if the peer has already made
a connection to us.
2020-01-30 14:03:52 +03:00
Roman Khimov
9eafec0d1d
network: introduce peer-to-peer message queue
...
This one is designed to give more priority to direct nodes communication, that
is that their messaging would have more priority than generic broadcasts. It
should improve consensus process under TX pressure and allow to handle
pings in time (preventing disconnects).
2020-01-30 14:03:52 +03:00
Roman Khimov
72e4eb7172
network: fix wrong NewPing() parameters
...
They have the opposite order, height first and nonce second. It was done wrong
in 4e6ed902
and never fixed since. Fixes sending wrong peer state leading to
useless getheaders messages (and disconnects when the other side is lagging
behind).
2020-01-30 14:03:52 +03:00
Roman Khimov
da09fda575
network: add debug on message receival
2020-01-30 14:03:52 +03:00
Roman Khimov
1c28dd2567
network: add message type to disconnect error message
...
If it was caused by message processing, but only after the handshake to
preserve errIdenticalID and other handshaking errors.
2020-01-30 14:03:52 +03:00
Roman Khimov
b79abd1e27
network: detect duplicate connections before handshake completes
...
We can have more than one connection attempt in progress and not yet completed
the handshake, so if there is a Version already received we should look it.
2020-01-30 14:03:52 +03:00
Roman Khimov
b1b660c779
rpc: fix getaccountstate/getunspents for unknown addresses
...
Returning error string as a result (not an error) is utterly wrong, but C#
implementation just returns a zero balance for unknown addresses, so we should
follow that.
2020-01-29 19:01:00 +03:00
Roman Khimov
0ccc59628c
Merge pull request #631 from nspcc-dev/fix/return3
...
compiler: fix a bug with assignment to underscore
2020-01-29 18:32:43 +03:00
Evgenii Stratonikov
390bf58f97
consensus: use our implementations of Recovery* messages
...
While decoding payload, local implementations of Recovery*
messages were used, but when creating RecoveryMessage inside dBFT
library default NewRecoveryMessage was invoked. This lead to parsing
errors.
2020-01-29 17:56:26 +03:00
Evgenii Stratonikov
8b922c057c
compiler: fix a bug with assignment to underscore
...
When using underscore it does not appear in the list
of local variables, so it can't be assigned.
In this commit the value is dropped.
2020-01-29 17:07:55 +03:00
Evgenii Stratonikov
7053b3b2c0
compiler: optimize append argument processing
...
Append should leave it's result on top of the stack.
Thus we need to transform top of the stack:
(top) a . b --> (top) a . b . b
It can be done with just OVER + SWAP.
2020-01-29 12:28:38 +03:00
Evgenii Stratonikov
b6629fb6bd
compiler: refactor argument handling for builtins
...
It is more convenient to have all unusual logic in one place.
2020-01-29 12:28:38 +03:00
Evgenii Stratonikov
d2326a8b96
compiler: support panic
in source
...
In situations where VM's FAULT state needs to be reached,
panic function can be used. It compiles to THROW instruction.
2020-01-29 12:28:38 +03:00
Evgenii Stratonikov
e0f47decc7
compiler: replace ROLL(2) with equivalent ROT
2020-01-29 09:56:16 +03:00
Evgenii Stratonikov
28571bd3dc
compiler: implement switch statement support
2020-01-29 09:56:16 +03:00
Roman Khimov
0ce0ecb95e
Merge pull request #624 from nspcc-dev/feature/bigint
...
compiler: emit integers correctly
2020-01-28 18:04:32 +03:00
Roman Khimov
ab03aee2cf
Merge pull request #627 from nspcc-dev/fix-getdata-and-pings
...
Fix getdata and pings
2020-01-28 17:43:13 +03:00
Roman Khimov
06c3fbe455
network: rework ping sends, fix overpinging
...
Our node was too pingy because of wrong timer setups (that divided timeout
Duration by time.Second), it also was wrong in its time calculations (using
UTC time to calculate intervals). At the same time missing block is a
server-wide problem, so it's better solved with server-wide protocol loop.
2020-01-28 17:39:52 +03:00
Roman Khimov
39800aecb3
network: fix getdata
handling
...
It was broken by 0ba6b2a7
, the peer only responded with one message instead of
full requested set.
2020-01-28 17:39:52 +03:00
Evgenii Stratonikov
d190b3a2e0
compiler: emit integers correctly
...
A while ago VM serialization format for Integer items was changed
but compiler continued to emit Integers in old format.
This commit changes compiler behaviour to be compatible with VM.
2020-01-28 16:39:19 +03:00
Evgenii Stratonikov
f15ceff592
vm: make IntToBytes, BytesToInt public
...
VM serialization format should be able to be reused.
2020-01-28 16:39:19 +03:00
Evgenii Stratonikov
77f9a2ee26
compiler: convert AppCall parameter from string properly
2020-01-27 15:34:03 +03:00
Evgenii Stratonikov
d65d6ab08d
compiler: allow to convert string constants to []byte
...
Also load constant directly into stack, not by name.
2020-01-27 15:29:52 +03:00
Evgenii Stratonikov
097d35b9d5
compiler: fix a bug with FromAddress handling
...
Conversion of string to address with FromAddress is performed
at compile time so there is no need to push parameters on stack.
2020-01-27 13:14:40 +03:00
Evgenii Stratonikov
330db36168
compiler: implement engine.AppCall interop
2020-01-27 13:14:36 +03:00
Evgenii Stratonikov
4fd766fe09
compiler: allow usage of string literals in index expressions
2020-01-23 17:28:35 +03:00
Evgenii Stratonikov
058958729d
compiler: support map literals
2020-01-23 17:06:15 +03:00
Evgenii Stratonikov
def73db8e9
compiler: support variables in slice literals
2020-01-23 15:51:16 +03:00
Evgeniy Kulikov
eb59460032
Merge pull request #614 from nspcc-dev/configurable-mempool-size
...
config: add MemPoolSize configuration parameter
2020-01-23 13:25:27 +03:00
Roman Khimov
67fe99b0ba
Merge pull request #618 from nspcc-dev/feature/for
...
compiler: support for loops with no init/post condition
2020-01-23 13:19:55 +03:00
Roman Khimov
04db87c770
Merge pull request #617 from nspcc-dev/feature/checksig
...
compiler: implement ECDSA signature verification
2020-01-23 13:18:21 +03:00
Roman Khimov
9aa5d0cf1e
Merge pull request #615 from nspcc-dev/network-peer-updates
...
Network peer updates
2020-01-23 13:15:43 +03:00
Roman Khimov
d6784e8f45
config: add MemPoolSize configuration parameter
...
Allow tuning/experimenting with mempool.
2020-01-23 13:10:44 +03:00
Evgenii Stratonikov
328267ca6f
compiler: support for loops with no init/post condition
...
Make it possible to use `for` loop with a single condition.
2020-01-23 11:48:43 +03:00
Evgenii Stratonikov
bd37359393
compiler: implement ECDSA signature verification
...
Add VerifySignature interop for signature verification.
It is converted to VERIFY opcode.
2020-01-23 10:56:15 +03:00
Evgenii Stratonikov
303b82cc44
core: set free GAS limit via config
2020-01-22 14:32:21 +03:00
Evgenii Stratonikov
54e0b5a4a7
rpc: set MaxGasInvoke in config
...
Implement ability to restrict maximum amount of GAS
available for free RPC calls.
2020-01-22 14:31:57 +03:00
Evgenii Stratonikov
4718375db1
rpc: return amount of consumed GAS in invoke*
2020-01-22 14:31:57 +03:00
Evgenii Stratonikov
2f865480d3
util: add YAML marshaler to Fixed8
2020-01-22 14:31:57 +03:00
Evgenii Stratonikov
7a6d6f43ce
vm: get rid of recursive (*VM).execute calls
...
Recursive execute() calls can affect gas calculation.
This commit makes execute() be called only for real opcodes
and moves duplicate logic for CALL/JMP into a separate function.
2020-01-22 14:31:57 +03:00
Evgenii Stratonikov
4eae55143f
core: restrict GAS available for invocation transactions
...
There are 10 GAS available for free plus any amount of GAS
attached to a transaction.
2020-01-22 14:31:54 +03:00
Evgenii Stratonikov
d72d978a19
vm: abstract out GetInterop() function
2020-01-22 14:04:40 +03:00
Evgenii Stratonikov
c22d09adad
vm: set GAS limit
...
Make it possible to set maximum amount of GAS which can be spent
during execution.
2020-01-22 14:04:40 +03:00
Evgenii Stratonikov
0662a7e3c2
vm: calculate GAS spent during execution
...
If getPrice callback is provided, accumulate spent GAS.
2020-01-22 14:04:40 +03:00