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
Roman Khimov
9037cabe1e
Merge pull request #625 from nspcc-dev/prepare-build-and-publish-images
...
Prepare build and publish images
2020-01-28 13:41:16 +03:00
Evgeniy Kulikov
2cb2a6d320
Add possibility to import different dump of chains
...
- import dump only if `node` sub command passed
- ACC env variable default value is `6000-privnet-blocks.acc.gz`
- ACC env variable can be declared in `docker-compose`
- ACC env variable can be one of:
- `/6000-privnet-blocks.acc.gz`
- `/1600-privnet-blocks-single.acc.gz`
- custom path to dump of blockchain
2020-01-28 13:29:13 +03:00
Evgeniy Kulikov
9e92749b05
Add single node chain dump to image
2020-01-28 13:04:13 +03:00
Evgeniy Kulikov
afbbdc5e02
Update command to build and publish images
...
- Use nspcc-dev docker hub repository
- Add command to publish neo-go images
2020-01-28 13:03:18 +03:00
Roman Khimov
1774b87a86
Merge pull request #622 from nspcc-dev/feature/byteconst
...
compiler: allow to convert string constants to []byte
2020-01-27 15:56:07 +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
Roman Khimov
1cfad9ccb8
Merge pull request #621 from nspcc-dev/feature/appcall
...
compiler: implement AppCall interop
2020-01-27 14:53:48 +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
Roman Khimov
ead0b8ff94
Merge pull request #620 from nspcc-dev/feature/map
...
compiler: support map literals
2020-01-23 19:27:12 +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
Roman Khimov
2d2a6463e8
Merge pull request #619 from nspcc-dev/feature/arraylit
...
compiler: support variables in slice literals
2020-01-23 16:11:21 +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
Roman Khimov
01e16e68ad
Merge pull request #609 from nspcc-dev/feature/gas
...
vm: calculate GAS spent, fix #607 .
2020-01-22 15:47:22 +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
Roman Khimov
8e10bf668d
Merge pull request #613 from nspcc-dev/fix-sigsegv-on-bad-consensus-config
...
Fix SIGSEGV on bad consensus config
2020-01-22 12:05:22 +03:00
Roman Khimov
99dfdc19e7
network: drop now useless addrReq queue from the server
...
Just broadcast a high-priority message to everyone.
2020-01-22 11:28:59 +03:00
Roman Khimov
ea3b76ded1
network: make NewServer return an error, fix #612
...
It can return nil in two cases, so we're better return an error and handle
it.
2020-01-22 11:17:51 +03:00
Roman Khimov
f2ffffddb7
network: rework broadcasting functions, tune priorities
...
This gives more priority to anything related to consensus.
2020-01-22 11:01:13 +03:00
Roman Khimov
34b863d645
network: introduce Server's MkMsg()
...
That wraps NewMessage() for a configured network.
2020-01-21 17:31:51 +03:00
Roman Khimov
1f672e0da7
network: move SendVersion() to the Peer
...
Only leave server-specific `getVersionMsg()` in the Server, all the other
logic is peer-related.
2020-01-21 17:26:08 +03:00
Roman Khimov
9befd8de99
Merge pull request #610 from nspcc-dev/ping-improvements
...
Ping improvements
2020-01-21 13:34:15 +03:00
Roman Khimov
d000d1d82b
Merge pull request #611 from nspcc-dev/consensus-tests-close-chain
...
consensus: close chain in tests
2020-01-21 13:31:23 +03:00
Roman Khimov
760b39e324
consensus: close chain in tests
...
Avoid test failures like this one:
=== RUN TestService_OnPayload
==================
WARNING: DATA RACE
Read at 0x00c00015a843 by goroutine 112:
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).Info()
/go/pkg/mod/go.uber.org/zap@v1.10.0/logger.go:187 +0x95
github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).persist()
/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:720 +0x6bb
github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).Run.func2()
/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:228 +0x53
Previous write at 0x00c00015a843 by goroutine 98:
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:900 +0x353
testing.tRunner()
/usr/local/go/src/testing/testing.go:913 +0x1bb
Goroutine 112 (running) created at:
github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).Run()
/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:227 +0x264
Goroutine 98 (finished) created at:
testing.(*T).Run()
/usr/local/go/src/testing/testing.go:960 +0x651
testing.runTests.func1()
/usr/local/go/src/testing/testing.go:1202 +0xa6
testing.tRunner()
/usr/local/go/src/testing/testing.go:909 +0x199
testing.runTests()
/usr/local/go/src/testing/testing.go:1200 +0x521
testing.(*M).Run()
/usr/local/go/src/testing/testing.go:1117 +0x2ff
main.main()
_testmain.go:162 +0x337
==================
--- FAIL: TestService_OnPayload (4.11s)
2020-01-20 19:40:52 +03:00
Roman Khimov
f56383e9c8
network: use p.LastBlockIndex() in requestBlocks()
...
Always compare to the best known block index, comparing to the StartHeight is
just plain wrong now.
2020-01-20 19:37:17 +03:00
Roman Khimov
2c4ace022e
network/config: redesign ping timeout handling a bit
...
1) Make timeout a timeout, don't do magic ping counts.
2) Drop additional timer from the main peer's protocol loop, create it
dynamically and make it disconnect the peer.
3) Don't expose the ping counter to the outside, handle more logic inside the
Peer.
Relates to #430 .
2020-01-20 19:37:17 +03:00
Roman Khimov
62092c703d
network: use local timestamp to decide when to ping
...
We don't and we won't have synchronized clocks in the network so the only
timestamp that we can compare our local time with is the one made
ourselves. What this ping mechanism is used for is to recover from missing the
block broadcast, thus it's appropriate for it to trigger after X seconds of
the local time since the last block received.
Relates to #430 .
2020-01-20 19:37:17 +03:00
Roman Khimov
a8252ecc05
network: remove wrong ping condition
...
In reality it will never be true exactly in the case where we want this ping
mechanism to work --- when the node failed to get a block from the net. It
won't get the header either and thus its block height will be equal to header
height. The only moment when this condition is met is when the node does
initial synchronization and this synchronization works just fine without any
pings.
Relates to #430 .
2020-01-20 19:37:17 +03:00
Roman Khimov
247cfa4165
network: either request blocks or ping a peer, but not both
...
It makes to sense to do both actions, pings are made for a different purpose.
Relates to #430 .
2020-01-20 19:37:17 +03:00
Roman Khimov
2348a460ea
Merge pull request #606 from nspcc-dev/network-queues
...
Network queues
2020-01-20 19:36:44 +03:00