Commit graph

1398 commits

Author SHA1 Message Date
Roman Khimov
bb80ba9b9e
Merge pull request #456 from nspcc-dev/pingpong_430
add ping pong processing
2020-01-20 16:10:29 +03:00
Roman Khimov
faffd36e8c
Merge pull request #605 from nspcc-dev/feature/bigint
vm: convert big.Int to []byte properly, closes #501.
2020-01-17 18:02:13 +03:00
Evgenii Stratonikov
f0083b94c5 vm: use new big.Int (de-)serialization routines
Also fix a test with CAT.
2020-01-17 17:37:50 +03:00
Evgenii Stratonikov
f26bdae2c5 vm: implement proper big.Int to []byte conversions
Big.Int Bytes()/SetBytes() methods are not symmetric.
Moreover we need to mimic C# node behavior:
- if a positive number has MSB set, 0x00 byte should be appended
  to distinguish positive number from negatives
- negative numbers should serialize as two's-complement
2020-01-17 17:37:50 +03:00
Evgenii Stratonikov
55d98ab19a consensus: update keys from wallet after every block 2020-01-17 17:30:45 +03:00
Evgenii Stratonikov
940ac42ded docker: use wallets in config 2020-01-17 17:25:51 +03:00
Evgenii Stratonikov
aaefcdecae consensus: use wallet in service 2020-01-17 17:25:51 +03:00
Evgenii Stratonikov
36cfa5b1f4 wallet: add GetAccount() method to Wallet
It is useful to be able to get account specified by script hash.
2020-01-17 17:25:51 +03:00
Evgenii Stratonikov
a798e4e0fa wallet: add ScriptHash() method to Contract 2020-01-17 17:25:51 +03:00
Evgenii Stratonikov
a871f75063 wallet: use a script instead a hash
NEO wallets (e.g. used in privnet setup) use hex-encoded
script inside the wallet, not a script hash.
2020-01-17 17:25:51 +03:00
Roman Khimov
2b02c145c3
Merge pull request #604 from nspcc-dev/rfc6979-update
Update rfc6979 package to the latest version
2020-01-17 17:23:02 +03:00
Roman Khimov
46b82b4fb5 keys: don't return error from PrivateKey.Sign
As it can't ever happen.
2020-01-17 17:00:30 +03:00
Vsevolod Brekelov
4e6ed9021c network: add ping pong processing
add pingInterval same as used in ref C# implementation with the same logic
add pingTimeout which is used to check whether pong received. If not -- drop the peer.
add pingLimit which is hardcoded to 4 in TCPPeer. It's limit for unsuccessful ping/pong calls (where pong wasn't received in pingTimeout interval)
2020-01-17 13:24:14 +03:00
Roman Khimov
e2fff3bb1d keys: update to newer rfc6979 package
Fixes #592.
2020-01-16 18:21:10 +03:00
Evgenii Stratonikov
28183b81d6 mempool: simplify names of exported types
With the move to a separate package, naming can be simplified:
MemPool -> Pool, PoolItem -> Item, PoolItems -> Items.
2020-01-16 10:16:24 +03:00
Evgenii Stratonikov
fed6fba9b6 core: refactor out MemPool 2020-01-16 10:16:24 +03:00
Evgenii Stratonikov
79bceb3e40 block: use require in tests 2020-01-16 10:16:24 +03:00
Evgenii Stratonikov
489b88afbb block: rename BlockBase to Base 2020-01-16 10:16:24 +03:00
Evgenii Stratonikov
63c56cca5c core: refactor out Block, BlockBase and Header structs
See #597.
2020-01-16 10:16:24 +03:00
Roman Khimov
54d3880b93
Merge pull request #602 from nspcc-dev/fix-consensus-requesttx
Fix consensus transaction requests
2020-01-15 16:21:06 +03:00
Roman Khimov
7d4d57351e network: fix requestTx() behaviour for consensus service
It wasn't actually requesting transactions but rather sending an inventory
message telling everyone that we have them which is completely wrong and
easily leads to ChangeView that could be avoided.
2020-01-15 14:31:56 +03:00
Roman Khimov
0420d48e56 network: micro-optimize relayInventory
Do less allocations, we're sending the same message with the same payload.
2020-01-15 13:16:09 +03:00
Roman Khimov
9eb880a095
Merge pull request #568 from nspcc-dev/feature/compiler_clean_and_tests
compiler: clean and tests
2020-01-14 18:44:07 +03:00
Vsevolod Brekelov
7084925e4b compiler: add test for compile and save 2020-01-14 17:33:04 +03:00
Roman Khimov
eeb6fa3f05
Merge pull request #600 from nspcc-dev/feature/smart_proposal
consensus: try to use previous proposal after ChangeView

Closes #591.
2020-01-14 17:16:37 +03:00
Evgenii Stratonikov
3d704a3a3a consensus: try to use previous proposal after ChangeView
When system and network pressure is high it can be beneficial
to use transactions which and were already proposed.
The assumption is that they will be in other node's memory pool
with more probability.
2020-01-14 16:05:27 +03:00
Roman Khimov
7ba5267494
Merge pull request #596 from nspcc-dev/feature/single_node
network: allow single-node privnet setup. Closes #595.
2020-01-14 13:17:04 +03:00
Evgenii Stratonikov
70b23076f8 network: allow single-node privnet setup 2020-01-13 18:01:20 +03:00
Evgenii Stratonikov
b33ca04191 docker: use generic filename for dumped blocks 2020-01-13 17:58:12 +03:00
Evgenii Stratonikov
5f5d0097e2 network: use TimePerBlock from config 2020-01-13 17:58:12 +03:00
Vsevolod
fe7cca7cc4
Merge pull request #598 from nspcc-dev/loging-fixes
Logging fixes
2020-01-13 17:37:06 +03:00
Roman Khimov
2192b6602a network: fix logic and logging for sendVersion() errors
It doesn't make sense trying to read from a broken connection and the
disconnect is to be logger from the server on unregistration.
2020-01-13 17:33:29 +03:00
Roman Khimov
b5f234ddef rpc: make rpc request logging at Debug level
Makes no sense polluting logs with Info. It also affects benchmarking.
2020-01-13 17:33:29 +03:00
Roman Khimov
a52e016c22 cli/server: disable sampling completely
It's not safe, we don't want to lose messages and we don't have that many of
them to try to figure out what is the better value than the default 100.
2020-01-13 17:32:44 +03:00
Evgenii Stratonikov
4d56fde98a consensus: update dbft version 2020-01-13 15:13:58 +03:00
Roman Khimov
f796749658
Merge pull request #594 from nspcc-dev/fix/npe
network: fix NPE in logging, closes #593.
2020-01-13 15:13:33 +03:00
Evgenii Stratonikov
f3921ea3bd network: fix NPE in logging 2020-01-13 15:06:57 +03:00
Roman Khimov
565c1940e3
Merge pull request #587 from nspcc-dev/feature/zap
Closes #284.
2020-01-10 14:50:09 +03:00
Evgenii Stratonikov
9dc5571327 core,rpc: close Blockchain in tests
If blockchain is not closed, logging in defer can occur
after test has finished, which will lead to a panic with
"Log in goroutine after Test* has completed".
2020-01-10 11:47:56 +03:00
Evgenii Stratonikov
dc65684708 consensus: replace SugaredLogger with Logger
SugaredLogger was used to make output look more similar to logrus.
This is no longer needed.
2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
9b8b77c9ea network: return error if header message is too big
Big messages can still be processed but only first
2000 headers will be used.
2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
637c99eda7 core: simplify newInteropContext 2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
45a4524054 rpc: remove EnableCORSWorkaround from Request 2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
289cb1c1d9 rpc: use zap.Logger 2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
aecdf470e7 cli,pkg: use zap.Logger 2020-01-10 11:14:27 +03:00
Roman Khimov
c0523546c6
Merge pull request #589 from nspcc-dev/wallet-dump
I don't think open is actually of any use for our wallet, so I've renamed it to dump
and implemented it fixing some things along the way.
2020-01-09 19:20:51 +03:00
Roman Khimov
aad0d3792d wallet: implement dump command
Mostly a testing tool for the moment.
2020-01-09 18:40:30 +03:00
Roman Khimov
e96b4bc82e wallet: fix TestNewAccount
It duplicated TestNewFromWif.
2020-01-09 18:40:30 +03:00
Roman Khimov
9bb68d7025 wallet: make DecryptAccount a method of Account
Otherwise it almost duplicates keys.NEP2Decrypt().
2020-01-09 18:40:30 +03:00
Roman Khimov
951ee383e9 keys: improve NEP2 testing 2020-01-09 18:06:03 +03:00