Commit graph

1573 commits

Author SHA1 Message Date
Roman Khimov
cac233383f
Merge pull request #660 from nspcc-dev/update-getblock-response-wrapper
[rpc] Fix wrong answer for getblock method
2020-02-13 13:03:44 +03:00
Evgeniy Kulikov
64e325d9af
Update tests for getblock action
- replace `GetBlockResponse.Result` with `wrappers.Block`
- update `getblock` checker and add more assets
2020-02-12 21:58:43 +03:00
Roman Khimov
32a064aa31 keys: add Cmp method to PublicKey
It can be used by code that doesn't operate with PublicKeys, but still needs
to be able to compare keys for some purposes.
2020-02-12 21:27:40 +03:00
Roman Khimov
38d0efc96c core: fix Registered state descriptor processing
It has simple boolean value encoded, no `strconv` needed (it actually chokes
on such input).
2020-02-12 21:27:40 +03:00
Roman Khimov
141553da4c keys: fix PublicKeys decoding
It changes the slice, thus it has to work via a pointer.
2020-02-12 21:23:28 +03:00
Roman Khimov
803fb39bb0 transaction: fix wrong state descriptor serdes
Wrong field order.
2020-02-12 21:23:28 +03:00
Evgeniy Kulikov
41ebf12eb3
Update getblock RPC action response 2020-02-12 19:43:51 +03:00
Evgenii Stratonikov
0a894db7f8 storage: add Exists flag to KeyValue in batch
Set Exists flag if an item with the specified key was already
present in storage before persisting.
2020-02-12 12:16:31 +03:00
Evgenii Stratonikov
a1fecd2e88 cli: add script for comparing storage dumps
It uses jq to normalize and compare json dumps.
2020-02-12 12:16:31 +03:00
Evgenii Stratonikov
b1d9e1132d cli: dump storage changes into JSON files 2020-02-12 12:16:31 +03:00
Evgenii Stratonikov
fb9af98179 storage: implement GetBatch() to view storage changes
GetBatch returns changes to be persisted.
2020-02-12 12:16:31 +03:00
Evgenii Stratonikov
8ea3ef0b62 compiler: process empty []byte{} literals as ByteArrays
It is wrong to count an empty byte slice as an Array.
2020-02-12 12:16:15 +03:00
Evgenii Stratonikov
32bce30777 compiler: support sub-slicing 2020-02-12 12:16:15 +03:00
Evgenii Stratonikov
310f7449d7 compiler: support for-range loops 2020-02-12 12:16:04 +03:00
Evgenii Stratonikov
ae03560589 compiler: support initializing struct fields from a variable
While initializing a struct, it is a top item on ALTSTACK.
This means that if we need to load a local variable,
DUPFROMALTSTACK won't longer push an array of locals on stack
but rather a currently initializing struct.

Closes #656.
2020-02-12 12:15:54 +03:00
Roman Khimov
bcff9faac4
Merge pull request #643 from nspcc-dev/fix/jump
compiler: rewrite jump targets properly

Closes #630.
2020-02-12 12:05:35 +03:00
Evgenii Stratonikov
3e84f2bdf8 compiler: rewrite jump targets properly
Old implementation could view 0x62 byte in
a script as a JMP instruction irregardless of whether it is
a real opcode or a part of a parameter of another instruction.
In this commit instructions are decoded together with parameters
during jump label rewriting.
2020-02-12 10:58:53 +03:00
Roman Khimov
cc9ace6426 README: update contacts 2020-02-11 19:06:19 +03:00
Roman Khimov
74250f1b3b CHANGELOG: release v0.72.2 2020-02-11 18:23:31 +03:00
Roman Khimov
d3badc3f97 consensus: log more like neo-cli, update dbft 2020-02-11 18:02:13 +03:00
Roman Khimov
38de2af073
Merge pull request #655 from nspcc-dev/fix-mempool-deadlock-on-reverification
core: get transactions from dao when mempool should not be used
2020-02-11 13:34:23 +03:00
Roman Khimov
292051d8df core: get transactions from dao when mempool should not be used
All of these places deal strictly with the chain and shouldn't ever be
bothered with mempool. It also fixes a deadlock on reverification of
non-standard tx:

1 @ 0x42f62f 0x43fbe9 0x43fbbf 0x43f95d 0x967059 0x966f66 0x972c7c 0x974e13 0x97a5d9 0x97bdf0 0x976147 0x966cc0 0x970f70 0x96c8cb 0x9ba858 0x45ca51
	0x43f95c	sync.runtime_SemacquireMutex+0x3c							/usr/local/go/src/runtime/sema.go:71
	0x967058	sync.(*RWMutex).RLock+0x128								/usr/local/go/src/sync/rwmutex.go:50
	0x966f65	github.com/CityOfZion/neo-go/pkg/core/mempool.(*Pool).TryGetValue+0x35			/go/src/github.com/CityOfZion/neo-go/pkg/core/mempool/mem_pool.go:229
	0x972c7b	github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).GetTransaction+0x4b			/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:782
	0x974e12	github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).References+0x132			/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:944
	0x97a5d8	github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).GetScriptHashesForVerifying+0x58	/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:1410
	0x97bdef	github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).verifyTxWitnesses+0x4f		/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:1545
	0x976146	github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).isTxStillRelevant+0x216		/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:1067
	0x966cbf	github.com/CityOfZion/neo-go/pkg/core/mempool.(*Pool).RemoveStale+0xff			/go/src/github.com/CityOfZion/neo-go/pkg/core/mempool/mem_pool.go:208
	0x970f6f	github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).storeBlock+0x2ecf			/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:614
	0x96c8ca	github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).AddBlock+0xea			/go/src/github.com/CityOfZion/neo-go/pkg/core/blockchain.go:308
	0x9ba857	github.com/CityOfZion/neo-go/pkg/network.(*blockQueue).run+0x157			/go/src/github.com/CityOfZion/neo-go/pkg/network/blockqueue.go:48
2020-02-10 18:53:22 +03:00
Roman Khimov
0461827fa3
Merge pull request #653 from nspcc-dev/fix-net-locks-and-leaks
network: fix networking stalls caused by stale peers
2020-02-10 18:51:56 +03:00
Roman Khimov
f7749cea67
Merge pull request #652 from nspcc-dev/Fix_FreeGasLimit
core: fix FreeGasLimit constraint
2020-02-10 18:49:09 +03:00
Roman Khimov
7ee8f9c5d8 network: fix networking stalls caused by stale peers
We can leak sending goroutines and stall broadcasts because of already gone
peers that happened to be cached by some s.Peers() user (more than 800 of
these can be seen in nodoka log along with (*Server).run blocking on
CMDGetAddr send):

Feb 10 16:35:15 nodoka neo-go[1563]: goroutine 41 [chan send, 3320 minutes]:
Feb 10 16:35:15 nodoka neo-go[1563]: github.com/CityOfZion/neo-go/pkg/network.(*TCPPeer).putPacketIntoQueue(...)
Feb 10 16:35:15 nodoka neo-go[1563]:         /go/src/github.com/CityOfZion/neo-go/pkg/network/tcp_peer.go:81
Feb 10 16:35:15 nodoka neo-go[1563]: github.com/CityOfZion/neo-go/pkg/network.(*TCPPeer).EnqueueHPPacket(0xc0083d57a0, 0xc017206100, 0x18, 0x40, 0x136a240, 0xc018ef9720)
Feb 10 16:35:15 nodoka neo-go[1563]:         /go/src/github.com/CityOfZion/neo-go/pkg/network/tcp_peer.go:119 +0x98
Feb 10 16:35:15 nodoka neo-go[1563]: github.com/CityOfZion/neo-go/pkg/network.(*Server).iteratePeersWithSendMsg(0xc0000ca000, 0xc0001848a0, 0xcb4550, 0x0)
Feb 10 16:35:15 nodoka neo-go[1563]:         /go/src/github.com/CityOfZion/neo-go/pkg/network/server.go:720 +0x12a
Feb 10 16:35:15 nodoka neo-go[1563]: github.com/CityOfZion/neo-go/pkg/network.(*Server).broadcastHPMessage(...)
Feb 10 16:35:15 nodoka neo-go[1563]:         /go/src/github.com/CityOfZion/neo-go/pkg/network/server.go:731
Feb 10 16:35:15 nodoka neo-go[1563]: github.com/CityOfZion/neo-go/pkg/network.(*Server).run(0xc0000ca000)
Feb 10 16:35:15 nodoka neo-go[1563]:         /go/src/github.com/CityOfZion/neo-go/pkg/network/server.go:203 +0xee4
Feb 10 16:35:15 nodoka neo-go[1563]: github.com/CityOfZion/neo-go/pkg/network.(*Server).Start(0xc0000ca000, 0xc000072c60)
Feb 10 16:35:15 nodoka neo-go[1563]:         /go/src/github.com/CityOfZion/neo-go/pkg/network/server.go:173 +0x2ec
Feb 10 16:35:15 nodoka neo-go[1563]: created by github.com/CityOfZion/neo-go/cli/server.startServer
Feb 10 16:35:15 nodoka neo-go[1563]:         /go/src/github.com/CityOfZion/neo-go/cli/server/server.go:331 +0x476
2020-02-10 18:47:52 +03:00
Anna Shaleva
9b03f968b1 core: fixe FreeGasLimit constraint
Lack of FreeGasLimit in privnet leads to gas limit exceeding in case of transactions with small amount of GAS to be used for invoke operation (< real cost of the transaction). Solution: Fixed constraint in case when FreeGasLimit == 0. So now we are able to perform transactions in privnet with FreeGasLimit = 0 for free.
2020-02-10 18:07:19 +03:00
Roman Khimov
f148798291 Merge pull request #651 from nspcc-dev/fix/appcall
compiler: refactor AppCall
2020-02-10 12:17:29 +03:00
Evgenii Stratonikov
8947f39a0d go.sum: go mod tidy 2020-02-10 11:05:32 +03:00
Evgenii Stratonikov
895a8d9ebc compiler: reverse args in AppCall
Invoked contract is expecting first argument to be on top of the stack.
Change test to use non-commutative operation to catch this behaviour.
2020-02-10 10:53:58 +03:00
Evgenii Stratonikov
52d8d58593 compiler,interop: make AppCall accept varargs 2020-02-10 10:51:29 +03:00
Evgenii Stratonikov
1fc64d515f compiler: abstract out emitReverse
Extract logic of reversing top n items of the stack
in a separate function.
2020-02-10 10:43:31 +03:00
Roman Khimov
268cad5c06
Merge pull request #548 from nspcc-dev/feature/multisig
vm: implement parallel algorithm for CHECKMULTISIG
2020-02-08 16:10:34 +03:00
Roman Khimov
9b9adb28c1
Merge pull request #642 from nspcc-dev/feature/emit
vm, compiler: move Emit* functions to a separate package

Closes #449, #534.
2020-02-08 15:56:48 +03:00
Roman Khimov
c896e2b731 network: fix minor gofmt issues (spotted by goreportcard) 2020-02-08 15:53:08 +03:00
Roman Khimov
c8ba173493 CHANGELOG: release 0.72.1 2020-02-07 16:51:00 +03:00
Roman Khimov
55ef14f920
Merge pull request #650 from nspcc-dev/handle-bad-notifications
Handle bad notifications
2020-02-07 16:15:44 +03:00
Roman Khimov
7ccf7974b6 core: substitute bad notifications with error messages
Tesnet sync failed with:
Feb 07 00:04:19 nodoka neo-go[1747]: 2020-02-07T00:04:19.838+0300        WARN        blockQueue: failed adding block into the blockchain        {"error": "failed to store notifications: not supported", "blockHeight": 713984, "nextIndex": 713985}

because some (not so) smart contract emitted a notification with an
InteropItem inside.
2020-02-07 15:34:59 +03:00
Roman Khimov
b805b1a71b vm: make SerializeItem/DeserializeItem public APIs
They're useful as wrappers around EncodeBinaryStackItem/DecodeBinaryStackItem.
2020-02-07 15:34:59 +03:00
Roman Khimov
7e7ce7f19f vm: rephrase serialization errors
Seeing some
    blockQueue: failed adding block into the blockchain        {"error": "failed to store notifications: not supported", "blockHeight": 713984, "nextIndex": 713985}
in logs is not very helpful.
2020-02-07 11:53:53 +03:00
Roman Khimov
e0008436eb docs/ri: we no longer use JIRA issues to deploy things 2020-02-07 11:51:14 +03:00
Roman Khimov
6677678520 update CHANGELOG and ROADMAP, release 0.72.0 2020-02-06 21:35:43 +03:00
Evgenii Stratonikov
a8dc704197 emit: add tests for Int 2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
6fd3f0fa48 emit: add tests for Bytes 2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
5e992d8cdd emit: add tests for Syscall, Jmp 2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
dbc41b3044 compiler: replace emit* instructions with those from emit/ package 2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
8243a8b3a7 emit: use io.BinWriter instead of bytes.Buffer 2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
698c647f07 emit: refactor tests
Add structure and call Bytes() method on buffer once.
2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
1400ecfdde emit: fix Int to serialize integers in correct format
Related #605, #623.
2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
c821e1c4c8 vm: move IntToBytes and BytesToInt to emit package 2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
4d8a3a359b vm: move Emit* functions to a separate package
Also strip 'Emit' prefix because 'emit' is now
in the package name.
2020-02-06 18:45:37 +03:00