Roman Khimov
b590d4ca04
Merge pull request #2766 from nspcc-dev/rpc-wrapper-autogen
...
Rpc wrapper autogeneration
2022-10-28 11:54:47 +07:00
Roman Khimov
02ce59cfd5
binding: avoid name conflicts with Go keywords
...
And clashing one name on another after rename.
2022-10-27 22:57:49 +03:00
Roman Khimov
617c31093f
smartcontract: initial rpcbinding implementation, fix #2705
...
It can do some unwrapping and reuse nepXX packages. It only uses manifest data
at the moment, see #2767 , #2768 , #2769 .
2022-10-27 22:57:49 +03:00
Roman Khimov
f0abc035af
unwrap: add PublicKey to unwrap public keys
...
We have this type in NEP-14 directly.
2022-10-27 18:32:00 +03:00
Roman Khimov
e0eff94094
standard: correct Comply* comments
2022-10-27 18:32:00 +03:00
Roman Khimov
64b603b056
standard: export standard definitions
...
Make Comply* functions useful and expose standard definitions for some reuse.
2022-10-27 18:32:00 +03:00
Anna Shaleva
4fc11c2924
rpc: revert deprecated subscriptions API changes
...
Revert deprecated subscriptions-related method signature changed in
673a495527
, 8e84bb51d5
and d7c1f3eac7
.
2022-10-26 15:32:54 +03:00
Anna Shaleva
5811687836
rpc: fix bug in Actor's waiter
...
Execution events are followed by block events, not vise versa, thus,
we can wait until VUB block to be accepted to be sure that
transaction wasn't accepted to chain.
2022-10-26 15:32:54 +03:00
Anna Shaleva
0a5905390c
rpc: refactor WSClient subscriptions API
...
Make it more specific, close #2756 .
2022-10-26 15:32:54 +03:00
Anna Shaleva
2a53db42af
neorpc: adjust and extend event filters documentation
2022-10-26 15:32:54 +03:00
Roman Khimov
396f56f792
binding: drop unused lowerFirst
2022-10-26 12:47:39 +03:00
Roman Khimov
4191b18728
binding: make TemplateFromManifest more reusable
...
Other template generators can make use of it.
2022-10-26 12:43:48 +03:00
Roman Khimov
d6d4f07280
binding: always import some packages and do it outside
...
If the contract has no methods, it's probably a broken one.
2022-10-26 12:40:59 +03:00
Roman Khimov
6af71755c1
Merge pull request #2762 from nspcc-dev/optimize-emit-bool
...
emit: optimize Bool GAS cost
2022-10-26 15:06:05 +07:00
Roman Khimov
4e58bd7411
compiler: use shorter and cheaper sequence to convert to Boolean
2022-10-25 18:20:55 +03:00
Roman Khimov
5d43367082
emit: optimize Bool GAS cost
...
NOT is 1 byte shorter and 2048 times cheaper than CONVERT. Inspired by
neo-project/neo-vm#493 .
2022-10-25 13:08:33 +03:00
Roman Khimov
e19d867d4e
Merge pull request #2761 from nspcc-dev/fancy-getaddr
...
Fancy getaddr
2022-10-25 16:51:38 +07:00
Roman Khimov
28f54d352a
network: do getaddr requests periodically, fix #2745
...
Every 1000 blocks seems to be OK for big networks (that only had done some
initial requests previously and then effectively never requested addresses
again because there was a sufficient number of addresses), won't hurt smaller
ones as well (that effectively keep doing this on every connect/disconnect,
peer changes are very rare there, but when they happen we want to have some
quick reaction to these changes).
2022-10-24 15:10:51 +03:00
Roman Khimov
9efc110058
network: it is 42
...
32 is a very good number, but we all know 42 is a better one. And it can even
be proven by tests with higher peaking TPS values.
You may wonder why is it so good? Because we're using packet-switching
networks mostly and a packet is a packet almost irrespectively of how bit it
is. Yet a packet has some maximum possible size (hi, MTU) and this size most
of the time is 1500 (or a little less than that, hi VPN). Subtract IP header
(20 for IPv4 or 40 for IPv6 not counting options), TCP header (another 20) and
Neo message/payload headers (~8 for this case) and we have just a little more
than 1400 bytes for our dear hashes. Which means that in a single packet most
of the time we can have 42-44 of them, maybe 45. Choosing between these
numbers is not hard then.
2022-10-24 14:44:19 +03:00
Roman Khimov
9d6b18adec
network: drop minPoolCount magic constant
...
We have AttemptConnPeers that is closely related, the more we have there the
bigger the network supposedly is, so it's much better than magic minPoolCount.
2022-10-24 14:36:10 +03:00
Roman Khimov
af24051bf5
network: sleep a bit before retrying reconnects
...
If Dial() is to exit quickly we can end up in a retry loop eating CPU.
2022-10-24 14:34:48 +03:00
Roman Khimov
a17d9f80a4
Merge pull request #2759 from nspcc-dev/avoid-db-lookup-in-hasblock
...
core: optimize HasBlock check for recent blocks
2022-10-24 14:33:38 +07:00
Roman Khimov
f42b8e78fc
Merge pull request #2758 from nspcc-dev/check-inflight-tx-invs
...
network: check inv against currently processed transactions
2022-10-24 14:16:33 +07:00
Roman Khimov
52df03ecbc
Merge pull request #2757 from nspcc-dev/batched-getdata
...
network: batch getdata replies
2022-10-24 14:15:55 +07:00
Roman Khimov
0551ddff4e
Merge pull request #2749 from nspcc-dev/rpc-waiter
...
rpc: implement transaction awaiting
2022-10-24 13:08:06 +07:00
Anna Shaleva
3cccc89dac
rpc: add Wait wrapper to Notary actor
2022-10-24 06:09:36 +03:00
Anna Shaleva
1a6f1c805c
rpc: fix race in TestWSClientEvents
...
```
2022-10-21T08:59:45.2219797Z === RUN TestWSClientEvents/default_ntf_channel
2022-10-21T08:59:45.2219901Z ==================
2022-10-21T08:59:45.2220017Z WARNING: DATA RACE
2022-10-21T08:59:45.2220177Z Write at 0x00c000c82778 by goroutine 371:
2022-10-21T08:59:45.2220580Z github.com/nspcc-dev/neo-go/pkg/rpcclient.TestWSClientEvents.func2()
2022-10-21T08:59:45.2221112Z /home/runner/work/neo-go/neo-go/pkg/rpcclient/wsclient_test.go:171 +0x1c4
2022-10-21T08:59:45.2221244Z testing.tRunner()
2022-10-21T08:59:45.2221617Z /opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1439 +0x213
2022-10-21T08:59:45.2221759Z testing.(*T).Run.func1()
2022-10-21T08:59:45.2222124Z /opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1486 +0x47
2022-10-21T08:59:45.2222138Z
2022-10-21T08:59:45.2222308Z Previous read at 0x00c000c82778 by goroutine 37:
2022-10-21T08:59:45.2222694Z github.com/nspcc-dev/neo-go/pkg/rpcclient.(*Client).StateRootInHeader()
2022-10-21T08:59:45.2223151Z /home/runner/work/neo-go/neo-go/pkg/rpcclient/rpc.go:1104 +0xb0
2022-10-21T08:59:45.2223482Z github.com/nspcc-dev/neo-go/pkg/rpcclient.(*WSClient).wsReader()
2022-10-21T08:59:45.2224077Z /home/runner/work/neo-go/neo-go/pkg/rpcclient/wsclient.go:210 +0x651
2022-10-21T08:59:45.2224416Z github.com/nspcc-dev/neo-go/pkg/rpcclient.NewWS.func2()
2022-10-21T08:59:45.2224892Z /home/runner/work/neo-go/neo-go/pkg/rpcclient/wsclient.go:149 +0x39
2022-10-21T08:59:45.2224901Z
2022-10-21T08:59:45.2225049Z Goroutine 371 (running) created at:
2022-10-21T08:59:45.2225182Z testing.(*T).Run()
2022-10-21T08:59:45.2225548Z /opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1486 +0x724
2022-10-21T08:59:45.2225911Z github.com/nspcc-dev/neo-go/pkg/rpcclient.TestWSClientEvents()
2022-10-21T08:59:45.2226408Z /home/runner/work/neo-go/neo-go/pkg/rpcclient/wsclient_test.go:167 +0x404
2022-10-21T08:59:45.2226539Z testing.tRunner()
2022-10-21T08:59:45.2226900Z /opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1439 +0x213
2022-10-21T08:59:45.2227042Z testing.(*T).Run.func1()
2022-10-21T08:59:45.2227398Z /opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1486 +0x47
2022-10-21T08:59:45.2227406Z
2022-10-21T08:59:45.2227552Z Goroutine 37 (finished) created at:
2022-10-21T08:59:45.2227851Z github.com/nspcc-dev/neo-go/pkg/rpcclient.NewWS()
2022-10-21T08:59:45.2228327Z /home/runner/work/neo-go/neo-go/pkg/rpcclient/wsclient.go:149 +0x6fb
2022-10-21T08:59:45.2228843Z github.com/nspcc-dev/neo-go/pkg/rpcclient.TestWSClientEvents.func2()
2022-10-21T08:59:45.2229434Z /home/runner/work/neo-go/neo-go/pkg/rpcclient/wsclient_test.go:168 +0x131
2022-10-21T08:59:45.2229569Z testing.tRunner()
2022-10-21T08:59:45.2229930Z /opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1439 +0x213
2022-10-21T08:59:45.2230069Z testing.(*T).Run.func1()
2022-10-21T08:59:45.2230424Z /opt/hostedtoolcache/go/1.18.7/x64/src/testing/testing.go:1486 +0x47
2022-10-21T08:59:45.2230526Z ==================
2022-10-21T08:59:45.2230703Z wsclient_test.go:186:
2022-10-21T08:59:45.2230988Z Error Trace: wsclient_test.go:186
2022-10-21T08:59:45.2231209Z Error: Should be true
2022-10-21T08:59:45.2231536Z Test: TestWSClientEvents/default_ntf_channel
2022-10-21T08:59:45.2231812Z testing.go:1312: race detected during execution of test
```
2022-10-24 06:09:36 +03:00
Anna Shaleva
d2a9e9120d
rpc: extend Waiter interface to wait for several txs with context
2022-10-24 06:09:36 +03:00
Anna Shaleva
6b216050f3
rpc: add compat tests for RPC* interfaces and Client implementations
2022-10-24 06:09:36 +03:00
Anna Shaleva
00d44235c1
rpc: add tests for RPC waiters
2022-10-24 06:09:36 +03:00
Anna Shaleva
388112dcaa
rpc: mark old WSClient's SubscribeFor* methods as deprecated
2022-10-24 06:09:36 +03:00
Anna Shaleva
5b81cb065f
rpc: refactor waiter-related actor code
2022-10-24 06:09:36 +03:00
Anna Shaleva
8e84bb51d5
rpc: add "till" filter to WS block events
2022-10-24 06:09:36 +03:00
Anna Shaleva
345d48d051
rpc: improve WS-based transaction awaiting
...
Subscribe only for required aers.
2022-10-24 06:09:36 +03:00
Anna Shaleva
d7c1f3eac7
rpc: add "container" filter to WS execution notifications
2022-10-24 06:09:36 +03:00
Anna Shaleva
71069b0ed0
rpc: improve WS-enabled transaction awaiting
...
Fetch blocks since VUB+1, if block received and we haven't returned the
result yet, then transaction wasn't accepted at all.
2022-10-24 06:09:36 +03:00
Anna Shaleva
673a495527
rpc: add "since" filter to WS block events
2022-10-24 06:09:36 +03:00
Anna Shaleva
10a0716217
rpc: implement transaction awaiting functionality
...
Close #2704 .
2022-10-24 06:09:36 +03:00
Anna Shaleva
6d38e75149
rpc: support multiple WSClient notification receivers
2022-10-24 06:09:36 +03:00
Anna Shaleva
4ce6bc6a66
rpc: adjust comment to Notification value cast
...
And explicitly specify field names on Notification creation.
2022-10-24 06:09:36 +03:00
Roman Khimov
0c3b03617e
core: optimize HasBlock check for recent blocks
...
When block is being spread through the network we can get a lot of invs with
the same hash. Some more stale nodes may also announce previous or some
earlier block. We can avoid full DB lookup for them and minimize inv handling
time (timeouts in inv handler had happened in #2744 ).
It doesn't affect tests, just makes node a little less likely to spend some
considerable amount of time in the inv handler.
2022-10-21 21:21:58 +03:00
Roman Khimov
e26055190e
network: check inv against currently processed transactions
...
Sometimes we already have it, but it's not yet processed, so we can save on
getdata request. It only affects very high-speed networks like 4-1 scenario
and it doesn't affect it a lot, but still we can do it.
2022-10-21 21:16:18 +03:00
Roman Khimov
cfb5058018
network: batch getdata replies
...
This is not exactly the protocol-level batching as was tried in #1770 and
proposed by neo-project/neo#2365 , but it's a TCP-level change in that we now
Write() a set of messages and given that Go sets up TCP sockets with
TCP_NODELAY by default this is a substantial change, we have less packets
generated with the same amount of data. It doesn't change anything on properly
connected networks, but the ones with delays benefit from it a lot.
This also improves queueing because we no longer generate 32 messages to
deliver on transaction's GetData, it's just one stream of bytes with 32
messages inside.
Do the same with GetBlocksByIndex, we can have a lot of messages there too.
But don't forget about potential peer DoS attacks, if a peer is to request a
lot of big blocks we need to flush them before we process the whole set.
2022-10-21 17:16:32 +03:00
Roman Khimov
bf4636f70a
Merge pull request #2755 from nspcc-dev/improve-networking
...
Improve P2P transaction handling
2022-10-21 16:22:02 +07:00
Roman Khimov
e1b5ac9b81
network: separate tx handling from msg handling
...
This allows to naturally scale transaction processing if we have some peer
that is sending a lot of them while others are mostly silent. It also can help
somewhat in the event we have 50 peers that all send transactions. 4+1
scenario benefits a lot from it, while 7+2 slows down a little. Delayed
scenarios don't care.
Surprisingly, this also makes disconnects (#2744 ) much more rare, 4-node
scenario almost never sees it now. Most probably this is the case where peers
affect each other a lot, single-threaded transaction receiver can be slow
enough to trigger some timeout in getdata handler of its peer (because it
tries to push a number of replies).
2022-10-21 12:11:24 +03:00
Roman Khimov
e003b67418
network: reuse inventory hash list for request hashes
...
Microoptimization, we can do this because we only use them in handleInvCmd().
2022-10-21 11:28:40 +03:00
Roman Khimov
493b979b95
dbft: rev up, fix context timestamp initialization
...
See nspcc-dev/dbft#64, fixes #2753 .
2022-10-20 12:38:14 +03:00
Roman Khimov
0f625f04f0
Merge pull request #2748 from nspcc-dev/stop-tx-flow
...
network/consensus: use new dbft StopTxFlow callback
2022-10-18 16:29:37 +07:00
Roman Khimov
73ce898e27
network/consensus: use new dbft StopTxFlow callback
...
It makes sense in general (further narrowing down the time window when
transactions are processed by consensus thread) and it improves block times a
little too, especially in the 7+2 scenario.
Related to #2744 .
2022-10-18 11:06:20 +03:00
Roman Khimov
2791127ee4
network: add prometheus histogram with cmd processing time
...
It can be useful to detect some performance issues.
2022-10-17 22:51:16 +03:00
Roman Khimov
73079745ab
Merge pull request #2746 from nspcc-dev/optimize-tx-callbacks
...
network: only call tx callback if we're waiting for transactions
2022-10-17 16:39:41 +07:00
Roman Khimov
dce9f80585
Merge pull request #2743 from nspcc-dev/log-fan-out
...
Logarithmic gossip fan out
2022-10-14 23:18:34 +07:00
Roman Khimov
4dd3fd4ac0
network: only call tx callback if we're waiting for transactions
...
Until the consensus process starts for a new block and until it really needs
some transactions we can spare some cycles by not delivering transactions to
it. In tests this doesn't affect TPS, but makes block delays a bit more
stable. Related to #2744 , I think it also may cause timeouts during
transaction processing (waiting on the consensus process channel while it does
something dBFT-related).
2022-10-14 18:45:48 +03:00
Roman Khimov
65f0fadddb
network: register peer only if it's not a duplicate
2022-10-14 15:53:32 +03:00
Roman Khimov
851cbc7dab
network: implement adaptive peer requests
...
When the network is big enough, MinPeers may be suboptimal for good network
connectivity, but if we know the network size we can do some estimation on the
number of sufficient peers.
2022-10-14 15:53:32 +03:00
Roman Khimov
c17b2afab5
network: add BroadcastFactor to control gossip, fix #2678
2022-10-14 15:53:32 +03:00
Roman Khimov
215e8704f1
network: simplify discoverer, make it almost a lib
...
We already have two basic lists: connected and unconnected nodes, we don't
need an additional channel and we don't need a goroutine to handle it.
2022-10-14 15:53:32 +03:00
Roman Khimov
c1ef326183
network: re-add addresses to the pool on UnregisterConnectedAddr
...
That's what we do anyway, but this way we can be a bit more efficient.
2022-10-14 14:12:33 +03:00
Roman Khimov
631f166709
network: broadcast to log-dependent number of nodes
...
Fixes #608 .
2022-10-14 14:12:33 +03:00
Roman Khimov
c3001bc5bd
Merge pull request #2740 from nspcc-dev/cli-improvement
...
cli: improve VM CLI a bit more
2022-10-13 20:21:47 +07:00
Anna Shaleva
7db9258104
vm: make LoadFileWithFlags actually load with flags provided
2022-10-13 16:07:34 +03:00
Anna Shaleva
4dbaf2a123
smartcontract: add comment to GetCompleteTransaction
2022-10-13 16:07:34 +03:00
Anna Shaleva
af658bc3e5
cli: support Null as an argument for invocation-related commands
2022-10-13 16:07:31 +03:00
Anna Shaleva
7eb87afab8
cli: unify parameters parsing
...
Share parameters parsing code between 'contract invokefunction' and
'vm run' commands. It allows VM CLI to parse more complicated parameter
types including arrays and file-backed bytestrings.
2022-10-13 08:20:27 +03:00
Roman Khimov
dc62046019
network: add network size estimation metric
2022-10-12 22:29:55 +03:00
Roman Khimov
bcf77c3c42
network: filter out not-yet-ready nodes when broadcasting
...
They can fail right in the getPeers or they can fail later when packet send
is attempted. Of course they can complete handshake in-between these events,
but most likely they won't and we'll waste more resources on this attempt. So
rule out bad peers immediately.
2022-10-12 16:51:01 +03:00
Roman Khimov
137f2cb192
network: deduplicate TCPPeer code a bit
...
context.Background() is never canceled and has no deadline, so we can avoid
duplicating some code.
2022-10-12 15:43:31 +03:00
Roman Khimov
104da8caff
network: broadcast messages, enqueue packets
...
Drop EnqueueP2PPacket, replace EnqueueHPPacket with EnqueueHPMessage. We use
Enqueue* when we have a specific per-peer message, it makes zero sense
duplicating serialization code for it (unlike Broadcast*).
2022-10-12 15:39:20 +03:00
Roman Khimov
d5f2ad86a1
network: drop unused EnqueueMessage interface from Peer
2022-10-12 15:27:08 +03:00
Roman Khimov
b345581c72
network: pings are broadcasted, don't send them to everyone
...
Follow the general rules of broadcasts, even though it's somewhat different
from Inv, we just want to get some reply from our neighbors to see if we're
behind. We don't strictly need all neighbors for it.
2022-10-12 15:25:03 +03:00
Roman Khimov
e1d5f18ff4
network: fix outdated Peer interface comments
2022-10-12 10:16:07 +03:00
Roman Khimov
8b26d9475b
network: speculatively set GetAddrSent status
...
Otherwise we routinely get "unexpected addr received" error.
2022-10-11 18:42:40 +03:00
Roman Khimov
e80c60a3b9
network: rework broadcast logic
...
We have a number of queues for different purposes:
* regular broadcast queue
* direct p2p queue
* high-priority queue
And two basic egress scenarios:
* direct p2p messages (replies to requests in Server's handle* methods)
* broadcasted messages
Low priority broadcasted messages:
* transaction inventories
* block inventories
* notary inventories
* non-consensus extensibles
High-priority broadcasted messages:
* consensus extensibles
* getdata transaction requests from consensus process
* getaddr requests
P2P messages are a bit more complicated, most of the time they use p2p queue,
but extensible message requests/replies use HP queue.
Server's handle* code is run from Peer's handleIncoming, every peer has this
thread that handles incoming messages. When working with the peer it's
important to reply to requests and blocking this thread until we send (queue)
a reply is fine, if the peer is slow we just won't get anything new from
it. The queue used is irrelevant wrt this issue.
Broadcasted messages are radically different, we want them to be delivered to
many peers, but we don't care about specific ones. If it's delivered to 2/3 of
the peers we're fine, if it's delivered to more of them --- it's not an
issue. But doing this fairly is not an easy thing, current code tries performing
unblocked sends and if this doesn't yield enough results it then blocks (but
has a timeout, we can't wait indefinitely). But it does so in sequential
manner, once the peer is chosen the code will wait for it (and only it) until
timeout happens.
What can be done instead is an attempt to push the message to all of the peers
simultaneously (or close to that). If they all deliver --- OK, if some block
and wait then we can wait until _any_ of them pushes the message through (or
global timeout happens, we still can't wait forever). If we have enough
deliveries then we can cancel pending ones and it's again not an error if
these canceled threads still do their job.
This makes the system more dynamic and adds some substantial processing
overhead, but it's a networking code, any of this overhead is much lower than
the actual packet delivery time. It also allows to spread the load more
fairly, if there is any spare queue it'll get the packet and release the
broadcaster. On the next broadcast iteration another peer is more likely to be
chosen just because it didn't get a message previously (and had some time to
deliver already queued messages).
It works perfectly in tests, with optimal networking conditions we have much
better block times and TPS increases by 5-25%% depending on the scenario.
I'd go as far as to say that it fixes the original problem of #2678 , because
in this particular scenario we have empty queues in ~100% of the cases and
this new logic will likely lead to 100% fan out in this case (cancelation just
won't happen fast enough). But when the load grows and there is some waiting
in the queue it will optimize out the slowest links.
2022-10-11 18:42:40 +03:00
Roman Khimov
0294e2eb18
Merge pull request #2738 from nspcc-dev/dont-block-forever-2
...
network: don't wait indefinitely for packet to be sent
2022-10-11 19:40:10 +07:00
Anna Shaleva
641abd4d1c
smartcontract: fix underlying PublicKey parameter value
...
Value of PublicKey parameter always stores public key bytes, not the
deserialized representation. All other code (CLI parameters parsing with
its NewParameterFromString, Parameter unmarshaller, etc.) is based on
the idea that value of PublicKey is []byte.
2022-10-11 13:50:32 +03:00
Roman Khimov
dabdad20ad
network: don't wait indefinitely for packet to be sent
...
Peers can be slow, very slow, slow enough to affect node's regular
operation. We can't wait for them indefinitely, there has to be a timeout for
send operations.
This patch uses TimePerBlock as a reference for its timeout. It's relatively
big and it doesn't affect tests much, 4+1 scenarios tend to perform a little
worse with while 7+2 scenarios work a little better. The difference is in some
percents, but all of these tests easily have 10-15% variations from run to
run.
It's an important step in making our gossip better because we can't have any
behavior where neighbors directly block the node forever, refs. #2678 and
2022-10-10 22:15:21 +03:00
Anna Shaleva
63fddb3f1a
core: close BoltDB on failed root bucket creation
2022-10-10 10:12:34 +03:00
Anna Shaleva
735db08f84
services: adjust RPC server's getHistoricParams
...
Update documentation and add index upper bound check to get rid of
CodeQL warning.
2022-10-07 16:06:12 +03:00
Anna Shaleva
95cbddf19e
cli: use custom logger to filter out runtime.Log messages
...
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ ./bin/neo-go vm -p
_ ____________ __________ _ ____ ___
/ | / / ____/ __ \ / ____/ __ \ | | / / |/ /
/ |/ / __/ / / / /_____/ / __/ / / /____| | / / /|_/ /
/ /| / /___/ /_/ /_____/ /_/ / /_/ /_____/ |/ / / / /
/_/ |_/_____/\____/ \____/\____/ |___/_/ /_/
NEO-GO-VM > loadgo ./1-print/1-print.go
READY: loaded 21 instructions
NEO-GO-VM 0 > run
2022-10-07T15:28:20.461+0300 INFO runtime log {"tx": "", "script": "db03ceb3f672ee8cd0d714989b4d103ff7eed2f3", "msg": "Hello, world!"}
[]
```
2022-10-07 15:57:33 +03:00
Anna Shaleva
0db4e8d62c
core: allow to perform storage search within given amount of DAO layers
2022-10-07 15:56:34 +03:00
Anna Shaleva
79e13f73d8
core, rpc: move getFakeNextBlock to Blockchain
...
It's needed for VM CLI as far and may be improved later.
2022-10-07 15:56:34 +03:00
Anna Shaleva
f45d8fc08d
vm: remove default syscall handler
...
It's not needed anymore. Close #1075 .
2022-10-07 15:56:34 +03:00
Anna Shaleva
0b717b0c22
vm: move vm CLI to cli/vm package
2022-10-07 15:56:34 +03:00
Anna Shaleva
4a46001746
smartcontract: fix error message for CreateMultiSigRedeemScript
2022-10-07 15:56:34 +03:00
Anna Shaleva
a91cf2a007
core: set default SecondsPerBlock value on blockchain creation
...
As mentioned in the node configuration docs.
2022-10-07 15:56:34 +03:00
Anna Shaleva
70e59d83c9
docs: fix supported database types
2022-10-07 15:56:34 +03:00
Anna Shaleva
2f5137e9b7
core: allow RO mode for Bolt and Level
2022-10-07 15:56:29 +03:00
Anna Shaleva
cbdd45cc96
core: return error on root BoltDB bucket creation if so
2022-10-06 14:01:56 +03:00
Anna Shaleva
03a1cf9f59
core: simplify newLevelDBForTesting function
2022-10-06 14:01:56 +03:00
Roman Khimov
4616600636
Merge pull request #2728 from nspcc-dev/fix-vub-comment
...
core: add example to VUB comment
2022-10-06 16:33:24 +07:00
Anna Shaleva
78cd2b4566
core: add example to VUB comment
2022-10-06 10:32:18 +03:00
Roman Khimov
1c99c21d9a
Merge pull request #2725 from nspcc-dev/move-cli-tests
...
Move CLI tests
2022-10-06 13:43:39 +07:00
Roman Khimov
1ac60ada19
cli: move tests to subpackages
...
Refs. #2379 , but not completely solves it, one package seriously outweights
others:
? github.com/nspcc-dev/neo-go/cli [no test files]
ok github.com/nspcc-dev/neo-go/cli/app 0.036s coverage: 100.0% of statements
ok github.com/nspcc-dev/neo-go/cli/cmdargs 0.011s coverage: 60.8% of statements
ok github.com/nspcc-dev/neo-go/cli/flags 0.009s coverage: 97.7% of statements
? github.com/nspcc-dev/neo-go/cli/input [no test files]
ok github.com/nspcc-dev/neo-go/cli/options 0.033s coverage: 50.0% of statements
? github.com/nspcc-dev/neo-go/cli/paramcontext [no test files]
ok github.com/nspcc-dev/neo-go/cli/query 2.155s coverage: 45.3% of statements
ok github.com/nspcc-dev/neo-go/cli/server 1.373s coverage: 67.8% of statements
ok github.com/nspcc-dev/neo-go/cli/smartcontract 8.819s coverage: 94.3% of statements
ok github.com/nspcc-dev/neo-go/cli/util 0.006s coverage: 10.9% of statements
? github.com/nspcc-dev/neo-go/cli/vm [no test files]
ok github.com/nspcc-dev/neo-go/cli/wallet 72.103s coverage: 88.2% of statements
Still a nice thing to have.
2022-10-06 09:21:26 +03:00
Roman Khimov
1c376ffa62
Merge pull request #2724 from nspcc-dev/rpc-options
...
rpcsrv: handle preflight OPTIONS with CORS kludge, fix #2721
2022-10-05 17:02:55 +07:00
Roman Khimov
b48d02f4a6
rpcsrv: handle preflight OPTIONS with CORS kludge, fix #2721
2022-10-05 11:09:45 +03:00
Roman Khimov
8893163803
smartcontract: define parameter lengths as constants and use them
2022-10-05 10:46:21 +03:00
Roman Khimov
317dd42513
*: use uint*Size and SignatureLen constants where appropriate
2022-10-05 10:45:52 +03:00
Roman Khimov
79887f9d78
runtime: check notifications against ABI
...
Related to #2703 , just a logged thing for now.
2022-10-04 17:52:38 +03:00
Roman Khimov
7d0840d5d5
Merge pull request #2720 from nspcc-dev/notifications-check
...
compiler: enforce runtime.Notify parameters cast to proper type
2022-10-01 03:02:29 +07:00
Anna Shaleva
554e48e7b7
compiler: enforce runtime.Notify parameters cast
...
If notification parameters type can be defined in a compile time then enforce
parameter cast to the desired type got from manifest.
2022-09-30 14:42:43 +03:00
Anna Shaleva
80f71a4e6e
compiler: do not enforce variadic event args check on ellipsis usage
...
In case of ellipsis usage compiler defines argument type as ArrayT
(which is correct, because it's a natural representation of the last
argument, it represents the array of interface{}).
Here goes the problem:
```
=== RUN TestEventWarnings/variadic_event_args_via_ellipsis
compiler_test.go:251:
Error Trace: compiler_test.go:251
Error: Received unexpected error:
event 'Event' should have 'Integer' as type of 1 parameter, got: Array
Test: TestEventWarnings/variadic_event_args_via_ellipsis
```
Parsing the last argument in this case is a separate complicated problem
due to the fact that we need to grab types of elements of []interface{} inside the
fully qualified ast node which may looks like:
```
runtime.Notify("Event", (append([]interface{}{1, 2}, (([]interface{}{someVar, 4}))...))...)
```
Temporary solution is to exclude such notifications from analysis until we're
able to properly resolve element types of []interface{}.
2022-09-30 08:42:48 +03:00
Anna Shaleva
08427f23b6
compiler: do not check Any event parameter for compliance
...
It's possible that declared manifest event has parameter of AnyT for
those cases when parameter type differs from method to method. If so,
then we don't need to enforce type check after compilation.
2022-09-30 08:40:55 +03:00
Roman Khimov
b7be4edf7f
Merge pull request #2718 from nspcc-dev/ok-conversion
...
compiler: prohibit to compile type assertion with two return values
2022-09-29 02:54:03 +07:00
Anna Shaleva
b98848bf49
compiler: prohibit to compile type assertion with two return values
...
Close #2692 .
2022-09-28 11:27:13 +03:00
Anna Shaleva
1828e79412
compiler: add test for foreign function inlining
2022-09-27 15:36:06 +03:00
Anna Shaleva
24c107e3a2
interop: refactor address.FromHash160 code
...
Make it more simple.
2022-09-27 15:32:57 +03:00
Anna Shaleva
5d578fdd95
compiler: consider inlined types info on "append" handling
...
We need to search for "append" argument type info not only inside local
package type info map, but also inside the inlined type info map.
Close #2696 .
2022-09-27 15:32:51 +03:00
Anna Shaleva
ea08a81726
interop: add CallWithVersion helper
2022-09-21 17:38:42 +03:00
Anna Shaleva
df802b6fc6
vm: adjust emit.AppCall comment
...
There's no APPCALL anymore.
2022-09-21 17:25:45 +03:00
Anna Shaleva
8d5f97a699
interop: adjust Iterator documentation
...
The only way to get Iterator is as a result of storage.Find.
2022-09-20 17:09:48 +03:00
Roman Khimov
5a7ab2054d
Merge pull request #2698 from nspcc-dev/address-helpers
...
interop: add a couple of `interop.Hash160` encoding helpers
2022-09-20 17:07:00 +07:00
Anna Shaleva
293dbf3d1b
compiler: adjust test's checkInstrCount
...
Remove unnecessary code.
2022-09-20 09:45:07 +03:00
Anna Shaleva
7e13140b04
interop: add Hash160 encoder\decoder helper
...
Close #2690 .
2022-09-20 09:37:04 +03:00
Roman Khimov
1b753cd4bc
native: add some tests for stdlib's atoi
...
See neo-project/neo#2804 and neo-project/neo#2813 . We're already compatible.
2022-09-19 16:18:53 +03:00
Roman Khimov
18ed26194f
smartcontract: add Len to Builder
...
Which is useful in some cases.
2022-09-14 10:25:10 +03:00
Roman Khimov
5979138306
stateroot: fix panic on shutdown
...
Stateroot service is always active, but it might have no wallet.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xc57d41]
goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/wallet.(*Wallet).Close(...)
github.com/nspcc-dev/neo-go/pkg/wallet/wallet.go:175
github.com/nspcc-dev/neo-go/pkg/services/stateroot.(*service).Shutdown(0xc000105880?)
github.com/nspcc-dev/neo-go/pkg/services/stateroot/validators.go:77 +0x81
github.com/nspcc-dev/neo-go/pkg/network.(*Server).Shutdown(0xc000105880)
github.com/nspcc-dev/neo-go/pkg/network/server.go:271 +0x205
github.com/nspcc-dev/neo-go/cli/server.startServer(0xc0002702c0)
github.com/nspcc-dev/neo-go/cli/server/server.go:641 +0x2675
github.com/urfave/cli.HandleAction({0xe456e0?, 0x1155f20?}, 0x4?)
github.com/urfave/cli@v1.22.5/app.go:524 +0x50
github.com/urfave/cli.Command.Run({{0xfca38b, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xfd6a46, 0x10}, {0xffebe3, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x65b
github.com/urfave/cli.(*App).Run(0xc000272000, {0xc00003e180, 0x3, 0x3})
github.com/urfave/cli@v1.22.5/app.go:277 +0x8a7
main.main()
./main.go:21 +0x33
2022-09-13 13:18:13 +03:00
Roman Khimov
31792e3132
Merge pull request #2686 from nspcc-dev/drop-at-block-rpcs
...
rpcclient: simplify historic API
2022-09-09 15:18:27 +03:00
Roman Khimov
d40eb79975
rpcclient: simplify historic API
...
util.Uint256 is util.Uint256 and it's same RPC behind the scenes, so we can
make it a bit easier to digest. See #2545 also.
2022-09-09 13:41:45 +03:00
Roman Khimov
f78a065230
vm/cli: generate Go 1.17 go.mods
2022-09-08 21:18:51 +03:00
Roman Khimov
541d4b49e1
context: define a constant for transaction context type
2022-09-08 14:33:04 +03:00
Roman Khimov
6be9367f03
rpcclient/notary: add OnNEP17PaymentData and an example
...
Update documentation as well to mention it and not mention outdated APIs. We
can't link them yet, this will be done after the release.
2022-09-08 14:33:04 +03:00
Roman Khimov
4fb4f5a1ac
smartcontract: make *util.Uint160 and *util.Uint256 usable for parameters
...
Use Any type for NULL.
2022-09-08 14:33:04 +03:00
Roman Khimov
1e54b422cd
emit: make *util.Uint160 and *util.Uint256 emittable
...
They can be nil or can be regular uint types we're used to.
2022-09-08 14:33:04 +03:00
Roman Khimov
3c02177d3c
rpcclient: improve comments for some methods
2022-09-08 14:33:04 +03:00
Roman Khimov
3e8e6857e5
rpcclient; deprecate more methods
...
They make little sense now.
2022-09-08 14:33:04 +03:00
Roman Khimov
c4ddf80742
rpcclient: correct Init requirement in documentation
2022-09-08 14:33:04 +03:00
Roman Khimov
ee55e95c28
rpcclient: add examples for nep11/nep17/neo
...
GAS doesn't need any, so just mention nep17 package there.
2022-09-08 14:33:04 +03:00
Roman Khimov
a1c9871d95
nns: it's NEP-11, so make NEP-11 methods available too
2022-09-08 14:33:04 +03:00
Roman Khimov
186e5c19b6
rpcclient: update documentation, mention subpackages
...
Drop TODOs (we have relevant GitHub issues), drop verbosity comment (we have
*Verbose APIs for that).
2022-09-08 14:33:04 +03:00
Roman Khimov
cb1a1f8532
actor: extend documentation, add example
2022-09-08 14:33:04 +03:00
Roman Khimov
e1fe76137e
rpcclient: use separate reader/writer structs in nep11 and nep17
...
Which greatly simplifies reuse of these packages (and they're expected to be
reused since real tokens implement standards and also add something of their
own) and allows to avoid effects like
doc_test.go:68:28: ambiguous selector neoContract.BalanceOf
when neo.Contract is used. Avoids duplication in NEP-11 implementation as
well.
2022-09-08 14:33:03 +03:00
Roman Khimov
00a9376311
invoker: update documentation, add example
2022-09-08 14:33:03 +03:00
Roman Khimov
ea92f3d716
smartcontract: add some notes on API limitations
2022-09-08 13:27:07 +03:00
Roman Khimov
69176168c3
smartcontract: modernize Builder example
...
And make it a bit more useful.
2022-09-07 22:40:25 +03:00
Roman Khimov
aca8ce0d28
unwrap: provide ErrNoSessionID, add some explanations
2022-09-07 22:40:25 +03:00
Roman Khimov
97193cf337
golangci: add predeclared linter
...
These can be confusing.
2022-09-02 18:36:26 +03:00
Roman Khimov
63f212f4b3
golangci: enable/fix misspell
2022-09-02 18:36:26 +03:00
Roman Khimov
4f3ffe7290
golangci: enable errorlint and fix everything it found
2022-09-02 18:36:23 +03:00
Roman Khimov
c703ac6805
golangci: enable contextcheck linter, fix WSClient
...
pkg/rpcclient/wsclient.go:93:30 contextcheck Function `Dial` should pass the context parameter
2022-09-02 18:35:54 +03:00
Roman Khimov
3c009271f8
golangci: enable bodyclose checker and fix related code
...
It has found an issue in the oracle code, so I think it's worth doing.
2022-09-02 18:35:54 +03:00
Roman Khimov
3da8b98fc3
Merge pull request #2672 from nspcc-dev/private-key-cleanup
...
Private key cleanup
2022-09-02 16:20:39 +03:00
Roman Khimov
eb67145f81
keys: check length first, then do things in WIFDecode
...
Otherwise we can easily panic there on bad input.
2022-09-02 14:44:32 +03:00
Roman Khimov
3c722a9498
keys: clean temporary data during key imports
...
Don't leak anything this way.
2022-09-02 14:44:32 +03:00
Roman Khimov
74bf4a8e3f
slice: add Clean microfunction
...
To be used for various cleaning purposes, one line is better than three lines.
2022-09-02 14:44:32 +03:00
Roman Khimov
58dc8d0c9b
*: always close the wallet after use
...
Fix #2631 .
2022-09-02 14:44:32 +03:00
Roman Khimov
ee5f8b6c21
consensus: update dbft, drop marshaling from private key
...
dbft doesn not need this and we must not leak the key in any way.
2022-09-02 14:44:18 +03:00
Roman Khimov
cad0d7f00d
wallet: add some warnings to Decrypt and PrivateKey docs
2022-09-02 14:44:18 +03:00
Roman Khimov
e164625a7f
wallet: provide (*Account).SignHashable API
...
Make PrivateKey() less used and less useful.
2022-09-02 14:44:01 +03:00
Roman Khimov
e569edc841
wallet: add ScriptHash() to Account
...
It allows to simplify a lot of code and avoid getting a PrivateKey in some
cases.
2022-09-02 14:43:34 +03:00
Roman Khimov
fd8da6fdb9
*: do not get private key from Account to check if it CanSign()
...
We have this API now to performs checks.
2022-09-02 14:43:34 +03:00
Roman Khimov
8d33206bb8
*: don't get private key from account if just public one is needed
...
Add PublicKey() API to the Account and use it as appropriate, avoid creating
additional references to the private key.
2022-09-02 14:43:28 +03:00
Roman Khimov
f79672c4c3
Merge pull request #2624 from nspcc-dev/optimize-unused-globals
...
compiler: do not emit initialisation code for unused global vars
2022-09-02 14:28:44 +03:00
Roman Khimov
62be6f959c
keys/wallet: add Destroy/Close/Close
...
PrivateKey can be destroyed and Account/Wallet can be closed (destroying keys
in the process).
2022-09-01 17:07:00 +03:00
Roman Khimov
a30e73a0d7
wallet: drop publicKey from Account
...
It's not very useful and it's only available when we have a private key
anyway.
2022-09-01 17:07:00 +03:00
Roman Khimov
53edbd569f
wallet: don't allow to ConvertMultisig a locked account
...
This stretched the definition of Locked somewhat, but still makes sense to
me, locked accounts better not be touched.
2022-09-01 17:07:00 +03:00
Roman Khimov
0090577446
wallet: don't permanently store wif in the Account
...
It's useless and it's just another copy of the key. If really needed, it can
be derived from the key.
2022-09-01 17:07:00 +03:00
Roman Khimov
411ebdf51e
cli: add complete support for offline signing, fix #2662
...
See documentation update for an example. Some code is made generic as well,
GetCompleteTransaction can now be used directly on ParameterContext.
2022-09-01 15:30:34 +03:00
Roman Khimov
773bcc3a59
context: make error messages a bit less cryptic
...
Refs. #2664 .
2022-09-01 15:30:33 +03:00
Roman Khimov
58707c2b1e
context: handle the case when we have more sigs than needed
...
We can technically have more signatures in the file than we need and it's OK,
this case should be handled.
2022-09-01 15:30:33 +03:00
Anna Shaleva
7f613e63aa
compiler: add test for #2661
2022-09-01 13:39:22 +03:00
Anna Shaleva
800321db06
compiler: rename named unused global vars to "_"
...
So that (*codegen).Visit is able to omit code generation for these
unused global vars. The most tricky part is to detect unused global
variables, it is done in several steps:
1. Collect the set of named used/unused global vars.
2. Collect the set of globally declared expressions that contain
function calls.
3. Pick up global vars from the set made at step 2.
4. Traverse used functions and puck up those global vars that are used
from these functions.
5. Rename all globals that are presented in the set made at step 1
but are not presented in the set made on step 3 or step 4.
2022-09-01 13:39:19 +03:00
Anna Shaleva
1e6b70d570
compiler: adjust TestInline template
...
Move all auxiliary function declaration after Main, so that INITSLOT
instructions counter works properly. `vmAndCompileInterop` loads program
and moves nextIP to the Main function offset if there's no _init
function. If _init is there, then nextIP will be moved to the start of
_init. In TestInline we don't handle instructions properly (CALL/JMP
don't change nextIP), we just perform instruction traversal from the
start point via Next(), thus INITSLOT counter value depends on the
starting instruction, which depends on _init presence.
2022-09-01 09:19:20 +03:00
Anna Shaleva
91b36657d6
compiler: do not emit code for unnamed unused variables
...
If variable is unnamed and does not contain function call then it's
treated as unused and code generation may be omitted for it
initialization/declaration.
2022-09-01 09:18:56 +03:00
Anna Shaleva
1dcbdb011a
compiler: emit code for unnamed global var decls more careful
...
In case if global var is unnamed (and, as a consequence, unused) and
contains a function call inside its value specification, we need to emit
code for this var to be able to call the function as it can have
side-effects. See the example:
```
package foo
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"
var A = f()
func Main() int {
return 3
}
func f() int {
runtime.Notify("Valuable notification", 1)
return 2
}
```
2022-09-01 09:18:07 +03:00
Roman Khimov
314cd3341b
Merge pull request #2667 from nspcc-dev/rpc-nep-token-info
...
Drop NEPXXTokenInfo from the RPC client
2022-08-30 14:41:30 +03:00
Roman Khimov
673c8954cc
Merge pull request #2665 from nspcc-dev/notary-rpcclient
...
Notary RPC client
2022-08-30 12:43:13 +03:00
Roman Khimov
07f3023e84
rpcclient: add notary.Actor for seamless notary experience
2022-08-30 11:47:56 +03:00
Roman Khimov
ed6ed61712
neptoken: add Info to replace old NEPXXTokenInfo methods
...
I'm still not sure it's good to have this exposed from neptoken at all, but
let's try it this way.
2022-08-29 22:52:27 +03:00
Roman Khimov
ac5c609063
core: add a bit more data into NVB errors
...
It's not always obvious what they mean and the NVB value is.
2022-08-29 15:08:37 +03:00
Roman Khimov
a95984febf
actor: allow providing default attributes/hooks to be used
...
Which expands Actor use cases greatly.
2022-08-29 15:08:37 +03:00
Roman Khimov
a3f32bf306
neptoken: move BalanceOf implementation to Base from nep11/nep17
...
It's the same, even though standards define parameter name in a bit different
way.
2022-08-26 21:52:19 +03:00
Roman Khimov
0d9158bd79
rpcclient: add enough of NNS into nns to deprecate NNS methods
2022-08-26 19:45:37 +03:00
Roman Khimov
fe50879bb7
wallet: add (*Account).CanSign API
2022-08-26 18:21:58 +03:00
Roman Khimov
8b132cba0c
wallet: respect user-locked accounts, don't sign with them
...
NEP-6 has a notion of locked acccounts and SignTx must respect this user's
choice. For some reason this setting was inappropriately used by our RPC
client tests (probably a different kind of lock was meant).
2022-08-26 18:21:58 +03:00
Roman Khimov
54c5fd61df
wallet: make SignTx more precise and accurate
...
* each account must have an appropriate signer, if there is no signer for
this account in the tx it's an error
* we can only safely append to Scripts when account belongs to the next
signer (we don't have appropriate verification scripts for other signers)
* when contract has one parameter, the signature shouldn't be appended to
other data
I think these rules allow to handle more cases and do that safer. We have more
complex scenarios though, like non-signature parameters or mixed-parameter
invocation scripts, but that's out of scope for now.
2022-08-26 18:21:58 +03:00
Roman Khimov
7a930a8e11
wallet: don't fail in SignTx when no contract provided
...
Unfortunately valid NEP-6 can have no contract inside of account, so this
should be accounted for.
2022-08-26 18:21:58 +03:00
Roman Khimov
2f8896f7a1
rpcclient: add notary subpackage with the notary contract wrapper
2022-08-26 18:21:58 +03:00
Roman Khimov
bf06b32278
Merge pull request #2658 from nspcc-dev/calculate-network-fee-fixes
...
calculatenetworkfee improvements
2022-08-24 10:24:53 +03:00
Roman Khimov
03cc9b2762
rpcsrv: execute all witnesses for calculatenetworkfee
...
Try to get as much data as possible, fix #2654 .
2022-08-23 15:34:18 +03:00
Roman Khimov
a2c4a7f611
rpcsrv: adjust for paid attritbutes in calculatenetworkfee
...
calculatenetworkfee MUST calculate complete proper network fee, if we have
some extensions enabled and some attributes should be paid for that they're a
part of the equation too.
2022-08-23 15:34:18 +03:00
Evgeniy Stratonikov
9712be78fd
vm: optimize refcounter
...
```
name old time/op new time/op delta
RefCounter_Add-8 9.47ns ± 4% 2.75ns ± 1% -70.92% (p=0.000 n=10+9)
RefCounter_AddRemove-8 88.9ns ±20% 5.5ns ± 4% -93.78% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
RefCounter_Add-8 0.00B 0.00B ~ (all equal)
RefCounter_AddRemove-8 48.0B ± 0% 0.0B -100.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
RefCounter_Add-8 0.00 0.00 ~ (all equal)
RefCounter_AddRemove-8 2.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
```
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-08-23 13:18:06 +03:00
Evgeniy Stratonikov
59fbc689e4
vm/bench: extend refcounter benchmarks
...
Adding an array multiple times leads to the fast update via `IncRC`.
This hides the allocation that is there on the first addition. In this
commit add another benchmark which measures Add/Remove together, to
ensure that `switch` in `refCounter.Add` is entered. Benchmark results
are meaningful, because `Add`/`Remove` have almost identical implementation.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-08-23 13:08:42 +03:00
Anna Shaleva
fb8a3973f1
smartcontract: remove empty method parameter handling
...
It's prohibited by the manifest validness checker, thus should not be
supported by bindings generator.
2022-08-22 15:01:38 +03:00
Anna Shaleva
15732580eb
smartcontract: improve manifest validness errors
...
It should be clear from error what's wrong with ABI
(specify bad method/event/parameter identifier).
2022-08-22 14:59:28 +03:00
Roman Khimov
f3d83c90b1
rpcsrv: allow invalid contract signatures in calculatenetworkfee
...
See #2805 , it allows to cover more cases like Notary contract that can use
CalculateNetworkFee now instead of AddNetworkFee RPC client API.
2022-08-22 14:55:45 +03:00
Roman Khimov
98dfe66466
rpcsrv: simplify calculatenetworkfee
...
We're dealing with a transaction here and it can't be decoded successfully
unless it has an appropriate number of witness scripts (matching the number of
signers) with appropriate hashes (matching signers). So this iterations make
no sense at all, we know exactly where to look for the
verification/invocation scripts.
2022-08-22 14:47:30 +03:00
Roman Khimov
9916832e2e
core: set Tx for interop.Context when verifying witnesses
...
Notary contract uses it in the verification context and it's not harmful to
have it always be there when it's there.
2022-08-22 13:38:43 +03:00
Roman Khimov
606597b9a1
Merge pull request #2652 from nspcc-dev/shutdown-fixes
...
Shutdown sequence fixes
2022-08-22 10:22:54 +03:00
Roman Khimov
779a5c070f
network: wait for exit in discoverer
...
And synchronize other threads with channels instead of mutexes. Overall this
scheme is more reliable.
2022-08-19 22:23:47 +03:00
Roman Khimov
eeeb0f6f0e
core: accept two-side channels for sub/unsub, read on unsub
...
Blockchain's notificationDispatcher sends events to channels and these
channels must be read from. Unfortunately, regular service shutdown procedure
does unsubscription first (outside of the read loop) and only then drains the
channel. While it waits for unsubscription request to be accepted
notificationDispatcher can try pushing more data into the same channel which
will lead to a deadlock. Reading in the same method solves this, any number of
events can be pushed until unsub channel accepts the data.
2022-08-19 22:08:40 +03:00
Roman Khimov
dea75a4211
network: wait for the relayer thread to finish on shutdown
...
Unsubscribe and drain first, then return from the Shutdown method. It's
important wrt to subsequent chain shutdown process (normally it's closed right
after the network server).
2022-08-19 22:08:40 +03:00
Roman Khimov
3402b870c8
fixedn: add a test for empty string
...
Ensure it fails.
2022-08-19 21:52:43 +03:00
Roman Khimov
b2524a3ba9
actor: add Sender helper method
2022-08-19 21:52:43 +03:00
Roman Khimov
c034f94a94
nep17: provide out of the box multitransfer capability
...
It can't replicate the old multitransfer methods in ability to transfer
multiple tokens, but it at the same time can do multiple senders.
2022-08-19 21:52:43 +03:00
Roman Khimov
155089f4e5
network: drop cleanup from TestVerifyNotaryRequest
...
It never runs the server, so 746644a4eb
was a
bit wrong with this.
2022-08-19 20:54:06 +03:00
Roman Khimov
194933a5cc
rpcclient: provide nep11 package for NEP-11 tokens
...
Unfortunately Go doesn't allow to easily reuse readers in full packages, still
we can have this wrapper with a little overhead (the alternative is to move
specific methods into types of their own, but I'm not sure how it's going to
be accepted user-side).
2022-08-19 10:37:22 +03:00
Roman Khimov
d0702c2cf9
unwrap: provide ArrayOfUint160
...
It's a popular type as well.
2022-08-19 10:36:44 +03:00
Roman Khimov
8cd4948e06
Merge pull request #2650 from nspcc-dev/neo-wrapper
...
NEO RPC wrapper
2022-08-19 10:34:41 +03:00
Roman Khimov
06f50630ac
Merge pull request #2644 from nspcc-dev/fix-gen-decl
...
compiler: allow multi-return variables declaration
2022-08-18 17:44:50 +03:00
Roman Khimov
6082383e3c
Merge pull request #2649 from nspcc-dev/fix-unnamed-rcvr
...
compiler: fix nil method receiver handling
2022-08-18 12:23:17 +03:00
Roman Khimov
e23fc11da5
Merge pull request #2648 from nspcc-dev/restrict-multi-ret
...
compiler: adjust restrictions imposed on manifest functions
2022-08-17 22:03:21 +03:00
Roman Khimov
f011b3c3dd
rpcclient: introduce NEO wrapper
...
Notice that int64 types are used for gas per block or registration price
because the price has to fit into the system fee limitation and gas per block
value can't be more than 10 GAS. We use int64 for votes as well in other types
since NEO is limited to 100M.
2022-08-17 22:03:09 +03:00
Anna Shaleva
16dbb35bd8
compiler: fix nil method receiver handling
...
An attempt to compile the following code leads to runtime panic:
```
package foo
type CustomInt int
func Main() int {
var i CustomInt
i = 5
return i.Do(2)
}
func (CustomInt) Do(arg int) int {
return arg
}
```
The panic:
```
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 22 [running]:
testing.tRunner.func1.2({0xa341c0, 0xc0001606d8})
/usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1212 +0x218
panic({0xa341c0, 0xc0001606d8})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertFuncDecl(0xc00015e3c0, {0xc753b8, 0xc000152c80}, 0xc000266300, 0x30)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:497 +0x10b3
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile.func2(0xc000152c80, 0xc00023c410)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2153 +0x3f8
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile.func1(0xc000229b80)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:102 +0x82
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachPackage(0xc00015e3c0, 0xc000189bb0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:93 +0xc6
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile(0x999a20, 0xc000130d80)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:99 +0x45
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc00015e3c0, 0xc0002669f0, 0x1)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2140 +0x445
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc0002669f0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2191 +0x353
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xa6f39a, 0x50b6b3}, {0xc6d1a0, 0xc0002421e0}, 0x0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/compiler_test.vmAndCompileInterop(0x5648df, {0xa9bf23, 0x94})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:75 +0x113
github.com/nspcc-dev/neo-go/pkg/compiler_test.eval(0xc0002421c0, {0xa9bf23, 0x61be8c7}, {0xa68880, 0xc0002421c0})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:36 +0x2d
github.com/nspcc-dev/neo-go/pkg/compiler_test.TestUnnamedMethodReceiver(0x4079f9)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/function_call_test.go:400 +0x4f
testing.tRunner(0xc000204b60, 0xbcebb0)
/usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1306 +0x35a
```
The solution is to use the same approach as for unnamed function
parameters handling introduced in #2204 . (c *funcScope).newVariable is
able to properly handle "_" receiver.
2022-08-17 17:44:57 +03:00
Roman Khimov
79051f21c1
invoker: expand the interface with iterator wrappers
...
We need them for iterator-based interfaces. Invoker hides the difference
between different (session/expanded) iterators here.
2022-08-17 16:38:03 +03:00
Anna Shaleva
9b9d72937b
compiler: restrict return values count for manifest methods
...
Exported functions from main package shouldn't have more than one return
value.
2022-08-17 15:42:56 +03:00
Anna Shaleva
171364f07f
compiler: allow unnamed params for exported methods
...
Adjust the result of #2601 .
2022-08-17 15:41:19 +03:00
Roman Khimov
689331b960
unwrap: perform consistency check in SessionIterator
...
C# servers with SessionEnabled=false will return iterator IDs and no session
IDs which can be reported as an error immediately because the iterator can't
be traversed.
2022-08-17 15:08:24 +03:00
Roman Khimov
37619743ad
unwrap: add ArrayOfPublicKeys()
...
This type of result is also popular in the NEO contract.
2022-08-17 12:45:46 +03:00
Roman Khimov
cdc2a762a1
Merge pull request #2646 from nspcc-dev/more-native-contract-rpc-wrappers
...
More native contract RPC wrappers
2022-08-17 12:40:17 +03:00
Roman Khimov
0dbe8b6ce2
rpcclient: add oracle package for OracleContract
2022-08-17 11:42:20 +03:00
Roman Khimov
5c8f3a99dc
rpcclient: add management wrapper for ContractManagement
2022-08-17 11:42:20 +03:00
Anna Shaleva
0bca027f99
compiler: avoid panic on empty package list
...
An attempt to compile unexisting file via neo-go-vm CLI leads to the following
panic:
```
NEO-GO-VM > loadgo ./1-print.go
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc000047300)
github.com/nspcc-dev/neo-go/pkg/compiler/codegen.go:2188 +0x60c
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xc000047300, 0xf66c92}, {0x0, 0x0}, 0xc0003a0000)
github.com/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/vm/cli.handleLoadGo(0xc0000f5340)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:480 +0x1a5
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d61d0}, 0x6)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf632f0, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf9915b, 0x38}, {0xf6a57b, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0002c2000, {0xc00036c330, 0x3, 0x3})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
github.com/nspcc-dev/neo-go/pkg/vm/cli.(*VMCLI).Run(0xc000290890)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:694 +0x317
github.com/nspcc-dev/neo-go/cli/vm.startVMPrompt(0xc0001b9e40)
github.com/nspcc-dev/neo-go/cli/vm/vm.go:29 +0x92
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d5d10}, 0x2)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf60a2f, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf7880b, 0x19}, {0x0, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0001c8fc0, {0xc000116020, 0x2, 0x2})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
main.main()
./main.go:21 +0x33
```
2022-08-17 11:29:28 +03:00
Roman Khimov
f7c5ab4f43
state: check for array length in (*Contract).FromStackItem
...
Panicing here is not appropriate.
2022-08-16 17:19:47 +03:00
Anna Shaleva
07ee7f7e12
compiler: allow multi-return variables declaration
...
Problem: an attempt to compile the following code leads to a runtime
panic:
```
package foo
var a, b = f()
func Main() int {
return a + b
}
func f() (int, int) {
return 1, 2
}
```
```
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1
goroutine 22 [running]:
testing.tRunner.func1.2({0xa341c0, 0xc0001647f8})
/usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1212 +0x218
panic({0xa341c0, 0xc0001647f8})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0001623c0, {0xc75520, 0xc000155d80})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:591 +0x6559
go/ast.Walk({0xc6c4e0, 0xc0001623c0}, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:50 +0x5f
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertGlobals.func1({0xc75520, 0xc000155d80})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:359 +0x70
go/ast.inspector.Visit(0xc000229740, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:375 +0x31
go/ast.Walk({0xc6d920, 0xc000229740}, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:50 +0x5f
go/ast.walkDeclList({0xc6d920, 0xc000229740}, {0xc000155e80, 0x3, 0x120})
/usr/local/go/src/go/ast/walk.go:36 +0x87
go/ast.Walk({0xc6d920, 0xc000229740}, {0xc75458, 0xc000156c80})
/usr/local/go/src/go/ast/walk.go:355 +0x15c5
go/ast.Inspect(...)
/usr/local/go/src/go/ast/walk.go:387
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertGlobals(0xc0001623c0, 0xc000156c80, 0xc000254280)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:354 +0x71
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).traverseGlobals.func2(0xc000254280)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/analysis.go:86 +0x16e
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachPackage(0xc0001623c0, 0xc000191b98)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:93 +0xc6
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).traverseGlobals(0xc0001623c0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/analysis.go:82 +0x22c
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc0001623c0, 0xc000274d20, 0x1)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2118 +0x17c
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc000274d20)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2191 +0x353
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xa6f39a, 0xc00023cee0}, {0xc6d240, 0xc00024a460}, 0x0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/compiler_test.vmAndCompileInterop(0x5648df, {0xa9989f, 0x7d})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:75 +0x113
github.com/nspcc-dev/neo-go/pkg/compiler_test.eval(0xc00024a440, {0xa9989f, 0x129f366e}, {0xa68880, 0xc00024a440})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:36 +0x2d
github.com/nspcc-dev/neo-go/pkg/compiler_test.TestGenDeclWithMultiRet.func2(0x4079f9)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/global_test.go:36 +0x4f
testing.tRunner(0xc00022e9c0, 0xbce760)
/usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1306 +0x35a
```
Solution:
Allow using multi-return function calls as general variable declaration
value. It was supported for assignment statements, so do the same for
*ast.GenDecl if it's a variable under the hood.
2022-08-16 15:33:44 +03:00
Roman Khimov
5d5455312a
rpcclient: add policy package for the PolicyContract contract
...
And test it with the RPC server.
Notice that getters still return int64 instead of *big.Int, that's because
these values are very limited and technically could even fit into an int (but
that seems to be too dangerous to use for long-term compatibility).
2022-08-16 12:43:25 +03:00
Roman Khimov
ee72b2fa29
rpcclient: add gas package for the GAS contract
...
Test it with the RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
ee84a4ab32
rpcclient: add rolemgmt pkg for RoleManagement contract
...
And test it with RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
a1a5db8fcd
state: add more convenient method to get native contract hashes
2022-08-15 10:54:29 +03:00
Roman Khimov
c967005216
rpcclient: add deprecation notices
...
And fix test code using old APIs to pass linter checks.
2022-08-12 18:21:02 +03:00
Roman Khimov
be74cc6b55
cli: use nep17 wrapper to implement commands
2022-08-12 18:21:02 +03:00
Roman Khimov
309358c85b
rpcclient: add new NEP-17 wrapper
2022-08-12 18:21:02 +03:00
Anna Shaleva
94e84f0364
core: fix native Management's hasMethod signature
...
Affects states, see
28ab45a6ec/src/Neo/SmartContract/Native/ContractManagement.cs (L155)
.
2022-08-11 16:10:01 +03:00
Roman Khimov
509cdec981
Merge pull request #2639 from nspcc-dev/oracle-fix
...
Oracle fix
2022-08-11 10:02:02 +03:00
Roman Khimov
bc3bffea53
native: fix oracle.finish reentrancy bug
...
See neo-project/neo#2795 .
2022-08-10 19:02:36 +03:00
Roman Khimov
8d170a1eb8
native: add Oracle.finish reentrancy test
2022-08-10 19:02:36 +03:00
Roman Khimov
f155a7f161
rpcclient: move result processing code into unwrap package
...
Which will be reused by upper-layer packages. It can be extended with more
types in future.
2022-08-09 17:38:47 +03:00
Roman Khimov
593fa4cac8
Merge pull request #2632 from nspcc-dev/rpcclient-actor
...
RPC client Actor interface
2022-08-09 17:21:24 +03:00
Roman Khimov
f3d7656b44
Merge pull request #2634 from nspcc-dev/go-1-19-upd
...
*: go 1.19 support
2022-08-09 16:33:08 +03:00
Anna Shaleva
916f2293b8
*: apply go 1.19 formatter heuristics
...
And make manual corrections where needed. See the "Common mistakes
and pitfalls" section of https://tip.golang.org/doc/comment .
2022-08-09 15:37:52 +03:00
Roman Khimov
ff72ed5715
actor: take ValidatorsHistory into account for CalculateValidUntilBlock
...
Which makes permanent result.Version caching safe for all cases.
2022-08-09 15:36:40 +03:00
Roman Khimov
95b72db707
rpcsrv: return more configuration data to the client
...
These are extensions, but they're important for the client to make various
decisions.
2022-08-09 15:36:40 +03:00
Anna Shaleva
bb751535d3
*: bump minimum supported go version
...
Close #2497 .
2022-08-08 13:59:32 +03:00
Roman Khimov
afef8b85d9
rpcclient: add deprecation warnings
2022-08-08 09:51:51 +03:00
Roman Khimov
260bcc0f49
wallet: fix wallet version to conform to NEP-6
...
See neo-project/neo#2390 . Can't see it there? No wonder, that's why we have
this bug for a year and a half. Not critical, we don't care about versions,
but _very_ annoying.
2022-08-07 22:41:40 +03:00
Roman Khimov
f369c2a359
wallet: allow pre-filled contract-based scripts in SignTx
...
They're allowed already for regular accounts (see below), but parameterless
accounts always add a script which is wrong.
2022-08-07 22:33:56 +03:00
Roman Khimov
aa2dbe9caf
smartcontract: accept Parameter in NewParameterFromValue
...
While it makes little sense, there can be a situation where this function will
get predefined Parameters in some way.
2022-08-07 22:33:56 +03:00
Roman Khimov
c0705e45c9
rpcclient: add actor package
...
Somewhat similar to invoker, but changing the state (or just creating a
transaction). Transaction creation could've been put into a structure of its
own, but it seems to be less convenient to use this way.
2022-08-07 22:33:56 +03:00
Roman Khimov
b8a4a6dc5b
Merge pull request #2613 from nspcc-dev/exec-changes-3.4.0
...
Exec changes for 3.4.0
2022-08-05 15:04:35 +03:00
Roman Khimov
e8d2277fe5
contract/vm: only push NULL after call in dynamic contexts
...
And determine the need for Null dynamically. For some reason the only dynamic
context is Contract.Call. CALLT is not dynamic and neither is a call from
native contract, go figure...
2022-08-05 14:35:00 +03:00
Roman Khimov
99e2681d3a
interop/vm: use more robust CalledByEntry check
...
Directly check contexts.
2022-08-05 14:35:00 +03:00
Roman Khimov
13f5fdbe8a
vm: extract shared parts of the Context
...
Local calls reuse them, cross-contract calls create new ones. This allows to
avoid some allocations and use a little less memory.
2022-08-05 14:26:25 +03:00
Roman Khimov
ab7743d78d
Merge pull request #2619 from nspcc-dev/script-oob-and-hasmethod-3.4.0
...
Script OOB checks and HasMethod for 3.4.0
2022-08-04 12:41:43 +03:00
Roman Khimov
25bd941d6f
Merge pull request #2601 from nspcc-dev/disallow-unnamed-parameters
...
compiler: disallow unnamed parameters for exported methods of the main package
2022-08-02 18:04:11 +03:00
Anna Shaleva
725e8779a1
compiler: always ensure manifest passes base check
2022-08-02 17:37:43 +03:00
Anna Shaleva
94f6a9ee61
compiler: disallow unnamed parameters for exported methods
2022-08-02 17:19:33 +03:00
Roman Khimov
d4292ed532
Merge pull request #2621 from nspcc-dev/sc-params
...
Smartcontract Parameters and Invoker interface
2022-08-02 14:18:34 +03:00
Roman Khimov
cfd2a35172
Merge pull request #2612 from nspcc-dev/fancy-service-restart
...
Fancy service restart
2022-08-02 14:11:44 +03:00
Roman Khimov
9b0ea2c21b
network/consensus: always process dBFT messages as high priority
...
Move category definition from consensus to payload, consensus service is the
one of its kind (HP), so network.Server can be adjusted accordingly.
2022-08-02 13:07:18 +03:00
Roman Khimov
ff93a680eb
metrics: don't Panic on bad shutdown
...
Just log the error.
2022-08-02 13:06:10 +03:00
Roman Khimov
94a8784dcb
network: allow to drop services and solve concurrency issues
...
Now that services can come and go we need to protect all of the associated
fields and allow to deregister them.
2022-08-02 13:05:39 +03:00
Roman Khimov
5a7fa2d3df
cli: restart consensus service on USR2
...
Fix #1949 . Also drop wallet from the ServerConfig since it's not used in any
meaningful way after this change.
2022-08-02 13:05:07 +03:00
Roman Khimov
bf92966633
cli: reload state root service on USR1
...
It's a bit special since it's _always_ present to catch stateroots from the
network.
2022-08-02 13:02:36 +03:00
Roman Khimov
31c9ae6339
rpcclient: add CallAndExpandIterator to Invoker
...
And deprecate Client.InvokeAndPackIteratorResults.
2022-08-01 21:31:23 +03:00
Roman Khimov
b52282c3c7
rpcclient: use Invoker internally for external APIs
...
It's not a big improvement, but it allows to test Invoker better.
2022-08-01 21:31:23 +03:00
Roman Khimov
fee7e2f223
rpcclient: add invoker package and structure
2022-08-01 21:31:23 +03:00
Roman Khimov
55164132df
smartcontract: provide NewParametersFromValues for convenience as well
2022-08-01 21:31:23 +03:00
Roman Khimov
92a931c145
smartcontract: provide interface{}->Parameter conversion
...
Which is almost like a NeoFS's toStackParameter() on steroids (except it
doesn't mess with noderoles package, it can be casted to int). RPC client's
Invoke* functions expect Parameters, so make it easy to create them.
2022-08-01 21:31:23 +03:00
Roman Khimov
a8a2f2ed5a
smartcontract: make CreateCallAndUnwrapIteratorScript accept Go types
...
Parameter is for the RPC client, all other CreateXXXScript functions deal with
regular types.
2022-08-01 21:31:23 +03:00
Roman Khimov
848d68fba8
smartcontract: improve package documentation
2022-08-01 21:31:23 +03:00
Roman Khimov
3c5a720e3a
smartcontract: drop Params type and TryParse methods
...
They were first introduced in a058598ecc
and
then carefully moved in 648e0bb242
, but it looks
like they were never used by any external code. This code can be useful on the
server, but the server has its own params package to deal with
parameters. Clients usually create Parameters and then get results as
stackitem.Items, so they don't use this code either. So there is zero point in
keeping it.
2022-08-01 21:31:23 +03:00
Roman Khimov
9341bb6628
cli: restart notary service on USR1
2022-07-28 19:05:56 +03:00
Roman Khimov
2adcf406d3
cli: reload Oracle service on USR1
...
Which allows to enable/disable the service, change nodes, keys and other
settings. Unfortunately, atomic.Value doesn't allow Store(nil), so we have to
store a pointer there that can point to nil interface.
2022-07-28 19:05:56 +03:00
Roman Khimov
98e2c5568c
rpcsrv: don't init Oracle in New, drop oracle dependency
...
The only thing rpcsrv needs is AddResponse callback.
2022-07-28 19:05:56 +03:00
Roman Khimov
61cfbbd33f
Revert "vm/core: revert out-of-bounds script checks"
...
This reverts commit bd5644aa02
restoring changes
from #2538 .
2022-07-28 17:01:23 +03:00
Roman Khimov
55f910777e
Revert "native/interop: revert management.hasMethod()"
...
This reverts commit 6c7a401f77
, introducing
changes from #2598 again.
2022-07-28 17:00:34 +03:00
Roman Khimov
4e98ca3358
Merge pull request #2616 from nspcc-dev/rollback-to-3.3.1
...
Rollback to 3.3.1
2022-07-28 16:00:49 +03:00
Roman Khimov
6c7a401f77
native/interop: revert management.hasMethod()
...
This reverts commits
* f50bcf617a
* 4f184498bc
* ab3330564a
because they're 3.4.0-compatible while we need 3.3.1.
2022-07-27 23:26:24 +03:00
Roman Khimov
bd5644aa02
vm/core: revert out-of-bounds script checks
...
This reverts commits 1005c1f7db
and
a5b5f88fe2
which are 3.4.0-compatible changes
while we need a 3.3.1-compatible release.
2022-07-27 23:25:23 +03:00
Roman Khimov
8e9bd3e28f
native: trigger committee update on candidate registration
...
It can change the committee even if noone voted. Fixes state diff at block
390726 of T5 testnet where there are no transactions, but committee changes
because there were some registrations in previous 21 blocks.
2022-07-27 23:21:21 +03:00
Roman Khimov
e5c59f8ddd
interop/runtime: disable notifications in dynamic scripts
...
That are only entry scripts today. See neo-project/neo#2796 .
2022-07-27 14:49:53 +03:00
Roman Khimov
df24c1268e
cli: restart pprof and prometheus on HUP
2022-07-27 12:30:08 +03:00
Roman Khimov
94099de3c3
cli: also check new ApplicationConfiguration for consistency
...
Most of the settings can't be changed, only services can.
2022-07-27 12:30:08 +03:00
Roman Khimov
3fca3352d8
cli: read new config on signal and check ProtocolConfiguration
...
ProtocolConfiguration must remain the same, any errors mean that the signal
will be ignored.
2022-07-27 12:30:08 +03:00
Roman Khimov
c8ff489287
native: use CreateOracleResponseScript directly
...
It wasn't possible way back when this test was written
(CreateOracleResponseScript was a method), now we can simplify things.
2022-07-26 12:19:49 +03:00
Roman Khimov
f749aaff3c
*: reuse smartcontract package to create standard entry scripts
2022-07-26 12:19:49 +03:00
Roman Khimov
32ebb4a90d
smartcontract: add Builder, method invocation helpers and doc
...
Move the last remaining script-related things out of the rpcclient.
2022-07-25 22:49:47 +03:00
Roman Khimov
1b6f4051d8
smartcontract: move CreateCallAndUnwrapIteratorScript there
...
RPC client shouldn't build scripts and this function can be useful as a
reusable building block.
2022-07-25 15:46:20 +03:00
Roman Khimov
88542630ac
blockchainer: drop the package completely
...
It's not an ideal solution, but at least it solves the problem for
now. Caveats:
* consensus only needs one method, so it's mirrored to Blockchain
* rpcsrv uses core.* definition of the StateRoot (so technically it might as
well not have an internal Ledger), but it uses core already unfortunately
2022-07-25 11:58:13 +03:00
Roman Khimov
5ee7ea34b1
blockchainer: drop Blockchainer completely
...
It's only used by the RPC server now, so it can be internalized.
2022-07-25 11:58:13 +03:00
Roman Khimov
284335a4d2
blockchainer: strip unused methods
2022-07-25 11:58:13 +03:00
Roman Khimov
fcbda00f8a
blockchainer/services: drop this package
...
It doesn't add any value.
2022-07-25 11:58:13 +03:00
Roman Khimov
3a6626f21f
blockchainer: drop unused services
dependency
2022-07-25 11:58:13 +03:00
Roman Khimov
5b49636ebe
neotest: use real *core.Blockchain
...
Hiding it behind blockchainer.Blockchain doesn't improve the testing system,
there is no other implementation of it that can fulfil all the needs of the
neotest and at the same time this limits the functions available to tests.
2022-07-25 11:58:13 +03:00
Roman Khimov
b3c25b5a1f
neorpc/result: move NotaryRequestEvent to this package
...
Not worth a package of its own.
2022-07-25 11:58:13 +03:00
Roman Khimov
4acd1688a1
subscriptions: move NotificationEvent to state
...
1. It's not good for pkg/core to import anything from pkg/neorpc.
2. The type is closely tied to the state package, even though it's not stored
in the DB
2022-07-25 11:58:13 +03:00
Roman Khimov
8e70cd3596
rpc: move rpc.Config to pkg/config, remove pkg/rpc
...
Makes no sense keeping it as is and TLS can be reused in the future.
2022-07-25 11:58:13 +03:00
Roman Khimov
1e0750e3cd
rpc: merge response and request under pkg/neorpc
...
Move result there also.
2022-07-25 11:57:53 +03:00
Roman Khimov
2e27c3d829
metrics: move package to services
...
Where it belongs.
2022-07-21 23:38:23 +03:00
Roman Khimov
8c668765d2
rpc/client: move to pkg/rpcclient
...
Better package name, closer to user.
2022-07-21 22:39:53 +03:00
Roman Khimov
43a59adbd0
rpc/server: move to services/rpcsrv
...
`server` is not a good package name and it's an internal service, so it can be
just about anywhere.
2022-07-21 22:14:12 +03:00
Roman Khimov
03b559bd44
block: JSONize tx-less block as []
instead of null
...
Improve C# compatibility.
2022-07-21 13:15:31 +03:00
Alex Vanin
d3f0b12ca2
rpc: fix deprecated magic field description
2022-07-15 15:01:59 +03:00
Roman Khimov
ed53fd3221
Merge pull request #2600 from nspcc-dev/handle-mptdata
...
network: allow to handle GetMPTData with KeepOnlyLatestState on
2022-07-15 13:13:31 +03:00
Roman Khimov
e46ec978d3
docs: improve some phasing, fix spelling
2022-07-15 12:52:21 +03:00
Anna Shaleva
1ae601787d
network: allow to handle GetMPTData with KeepOnlyLatestState on
...
And adjust documentation along the way.
2022-07-14 14:33:20 +03:00
Roman Khimov
f50bcf617a
compiler: add test for hasMethod, update all go.mods
2022-07-13 18:22:05 +03:00
Roman Khimov
4f184498bc
interop: add management.HasMethod()
2022-07-13 17:54:17 +03:00
Roman Khimov
ab3330564a
native: add hasMethod, fix #2588
...
Yet another state change.
2022-07-13 17:29:46 +03:00
Evgeniy Stratonikov
17329eea64
compiler: remove jumps to the next instruction
...
In case there are no returns in the inlined function, jumps point to the
next instruction and can be omitted. This optimization can be extended
to handle other cases, here we just make sure that already existing code
stays the same.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-12 16:17:31 +03:00
Evgeniy Stratonikov
05efc57485
compiler: reduce instructions in 2 stages
...
First replace parts to be removed with NOPs, then actually remove.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-12 13:16:33 +03:00
Evgeniy Stratonikov
ce24451fde
compiler: allow to use conditional returns in inlined functions
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-12 12:43:31 +03:00
Roman Khimov
9414538309
Merge pull request #2593 from nspcc-dev/fix-compiler
...
compiler: allow to call methods on return values
2022-07-12 11:55:41 +03:00
Evgeniy Stratonikov
e1a581be0e
compiler: allow to call methods on return values
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-11 19:28:15 +03:00
Roman Khimov
31a559e784
Merge pull request #2591 from nspcc-dev/interop/equality
...
interop: add equality helpers
2022-07-11 18:43:08 +03:00
Roman Khimov
125c2805d3
storage: reduce lock time in (*MemoryStore).Seek
...
It makes a copy of the resulting set, so the lock can be released
earlier. This helps a lot with iterators that keep Seek() unfinished for a
long time,
2022-07-11 16:15:14 +03:00
Roman Khimov
07f58abe3d
result: provide (*Iterator).UnmarshalJSON
...
It makes Iterator more symmetric and simplifies (*Invoke).UnmarshalJSON
code. No functional changes.
2022-07-11 16:15:14 +03:00
Roman Khimov
0c45ff8f51
rpc: simplify result.Invoke creation, remove needless deps
...
Change stack items before marshaling them which makes code in result package
much simpler and not requiring interop, iterator and storage dependencies that
clients shouldn't care about.
This also changes SessionBackedByMPT behavior, now instead of waiting for
traverseiterator call it'll rerun the script immediately if a new session is
created.
2022-07-11 16:15:14 +03:00
Anna Shaleva
78e5f16573
interop: add equality helpers
2022-07-11 15:59:24 +03:00
Roman Khimov
96c4e61063
storage: move Operation into package of its own
...
Don't use storage.* types in rpc/response/result.
2022-07-08 23:30:30 +03:00
Roman Khimov
1e62474514
vm: move InvocationTree into a package of its own
...
result.Invoke shouldn't depend on vm.
2022-07-08 23:30:30 +03:00
Roman Khimov
8cd7b93208
limits: new package with storage limits
...
Packages like core/state or core/mpt shouldn't import whole core/storage just
to get some constant value, it's not a good dependency.
2022-07-08 23:30:30 +03:00
Roman Khimov
9987afea4c
storage: move DB configuration into a package on its own
...
Lightweight thing to import anywhere, pkg/config should not be dependent on
Level/Bolt/anything else.
2022-07-08 23:30:30 +03:00
Roman Khimov
dc59dc991b
config: move metrics.Config into config.BasicService
...
Config package should be as lightweight as possible and now it depends on the
whole metrics package just to get one structure from it.
2022-07-08 23:30:30 +03:00
Roman Khimov
fab8dfb9f8
vm: move State type into a package of its own
...
It's used a lot in other places that need it, but don't need whole VM at the
same time.
2022-07-08 18:34:52 +03:00
Roman Khimov
4333ad4949
result: drop NewBlock/NewHeader/LedgerAux
...
Client's don't care about any of these.
2022-07-08 18:32:31 +03:00
Roman Khimov
04fc737e2e
rpc: drop NewTransactionOutputRaw, move it server-side
2022-07-08 18:30:01 +03:00
Roman Khimov
9462ed71d8
rpc: drop useless RawParams type
...
It doesn't add anything useful to regular Go types and actually native types
are always better to use in the Client. Especially given that this type is
not used by any code outside of the Client itself.
2022-07-08 17:56:20 +03:00
Roman Khimov
113cb0fac3
rpc: rename RawParams to Params in Raw, add comments
...
We've got parameters here and usually we name them Raw when they're
represented by json.RawMessage which is not the case here, so make it a bit
more friendly (the type itself is only used in client internals, so rename is
not a huge problem).
2022-07-08 17:38:56 +03:00
Roman Khimov
9aecfb7c94
rpc/client: correct ID unmarshaling in wsclient
...
We always use uint64 IDs in the client, so we should parse them as such and
not just ints that then are casted to uint64.
2022-07-08 17:38:56 +03:00
Roman Khimov
adab83496c
rpc: move Request, Params and related code server-side
...
It's absolutely irrelevant for the client and request/response packages should
only contain code that is useful on both sides of the conversation. It's OK
for client tests to reuse this code, but the package is used by external
developers and they shouldn't be bothered with it. Nothing changed
functionally here except WSClient simplification. Fixes #2236 .
2022-07-08 17:38:53 +03:00
Anna Shaleva
ef114d6274
rpc: fail invoke.Result unmarshalling on stack unmarshalling error
2022-07-08 17:05:18 +03:00
Anna Shaleva
445cca114a
rpc: restrict the amount of concurrently running iterator sessions
2022-07-08 17:05:18 +03:00
Anna Shaleva
8f73ce08c8
rpc: move session maintenance related code out of the result.Invoke
...
It's server who should be responsible for iterator ID creation and
iterator registration.
2022-07-08 17:05:18 +03:00
Anna Shaleva
4581cc386b
rpc: restrict max number of iterator items for createIteratorUnwrapperScript
2022-07-08 17:05:18 +03:00
Anna Shaleva
9bdd8151af
rpc: restrict (*Client).TraverseIterator with single RPC call
...
Do not unwrap the whole set of iterator values even on demand.
2022-07-08 17:05:18 +03:00
Anna Shaleva
fad061f3d9
rpc: extend iterator-related client functionality
...
Create a set of functions that are able to work with both session-based
iterators, default unpacked iterators and client-side unpacked
iterators.
2022-07-08 17:05:18 +03:00
Anna Shaleva
47ffc1f3e8
rpc: restrict default SessionExpirationTime
2022-07-08 17:05:18 +03:00
Anna Shaleva
b5d39a3ffd
rpc: add configuration extension for MPT-backed iterator sessions
...
Add ability to switch between current blockchain storage and MPT-backed
storage for iterator traversing process. It may be useful because
iterator implementation traverses underlying backed storage (BoltDB,
LevelDB) inside DB's Seek which is blocking operation for BoltDB:
```
Opening a read transaction and a write transaction in the same goroutine
can cause the writer to deadlock because the database periodically needs
to re-mmap itself as it grows and it cannot do that while a read transaction
is open.
If a long running read transaction (for example, a snapshot transaction)
is needed, you might want to set DB.InitialMmapSize to a large enough
value to avoid potential blocking of write transaction.
```
So during bbolt re-mmaping, standard blockchain DB operations (i.e. persist)
can be blocked until iterator resourses release. The described behaviour
is tested and confirmed on four-nodes privnet with BoltDB and
`SessionExpirationTime` set to be 180 seconds. After new iterator session
is added to the server, the subsequent persist took ~5m21s, see the log
record `2022-06-17T18:58:21.563+0300`:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ ./bin/neo-go node -p
2022-06-17T18:52:21.535+0300 INFO initial gas supply is not set or wrong, setting default value {"InitialGASSupply": "52000000"}
2022-06-17T18:52:21.535+0300 INFO MaxBlockSize is not set or wrong, setting default value {"MaxBlockSize": 262144}
2022-06-17T18:52:21.535+0300 INFO MaxBlockSystemFee is not set or wrong, setting default value {"MaxBlockSystemFee": 900000000000}
2022-06-17T18:52:21.535+0300 INFO MaxTransactionsPerBlock is not set or wrong, using default value {"MaxTransactionsPerBlock": 512}
2022-06-17T18:52:21.535+0300 INFO MaxValidUntilBlockIncrement is not set or wrong, using default value {"MaxValidUntilBlockIncrement": 5760}
2022-06-17T18:52:21.535+0300 INFO Hardforks are not set, using default value
2022-06-17T18:52:21.543+0300 INFO no storage version found! creating genesis block
2022-06-17T18:52:21.546+0300 INFO ExtensiblePoolSize is not set or wrong, using default value {"ExtensiblePoolSize": 20}
2022-06-17T18:52:21.546+0300 INFO service is running {"service": "Prometheus", "endpoint": ":2112"}
2022-06-17T18:52:21.547+0300 INFO starting rpc-server {"endpoint": ":20331"}
2022-06-17T18:52:21.547+0300 INFO rpc-server iterator sessions are enabled
2022-06-17T18:52:21.547+0300 INFO service hasn't started since it's disabled {"service": "Pprof"}
2022-06-17T18:52:21.547+0300 INFO node started {"blockHeight": 0, "headerHeight": 0}
_ ____________ __________
/ | / / ____/ __ \ / ____/ __ \
/ |/ / __/ / / / /_____/ / __/ / / /
/ /| / /___/ /_/ /_____/ /_/ / /_/ /
/_/ |_/_____/\____/ \____/\____/
/NEO-GO:0.99.1-pre-53-g7ccb646e/
2022-06-17T18:52:21.548+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 1}
2022-06-17T18:52:21.550+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 1475228436}
2022-06-17T18:52:22.575+0300 INFO persisted to disk {"blocks": 65, "keys": 1410, "headerHeight": 65, "blockHeight": 65, "took": "28.193409ms"}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 2}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 3}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 4}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 5}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 6}
2022-06-17T18:52:24.549+0300 INFO started protocol {"addr": "127.0.0.1:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 3444438498}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 7}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 8}
2022-06-17T18:52:24.550+0300 INFO node reached synchronized state, starting services
2022-06-17T18:52:24.550+0300 INFO started protocol {"addr": "127.0.0.1:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 2435677826}
2022-06-17T18:52:24.550+0300 INFO starting state validation service
2022-06-17T18:52:24.550+0300 INFO RPC server already started
2022-06-17T18:52:24.550+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:52:24.550+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 10}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 9}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 7}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 6}
2022-06-17T18:52:24.550+0300 INFO started protocol {"addr": "127.0.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 970555896}
2022-06-17T18:52:24.551+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 7}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 6}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 5}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 4}
2022-06-17T18:52:29.564+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 66, "blockHeight": 66, "took": "12.51808ms"}
2022-06-17T18:52:44.558+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 67, "blockHeight": 67, "took": "1.563137ms"}
2022-06-17T18:55:21.549+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "ping/pong timeout", "peerCount": 3}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "ping/pong timeout", "peerCount": 2}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "ping/pong timeout", "peerCount": 1}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "ping/pong timeout", "peerCount": 0}
2022-06-17T18:55:21.553+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 1}
2022-06-17T18:55:21.554+0300 INFO started protocol {"addr": "127.0.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 970555896}
2022-06-17T18:55:24.554+0300 INFO new peer connected {"addr": "172.200.0.4:20333", "peerCount": 2}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "172.200.0.3:20334", "peerCount": 3}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "10.78.13.84:59876", "peerCount": 4}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 5}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "172.200.0.254:20332", "peerCount": 6}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 7}
2022-06-17T18:55:24.556+0300 INFO started protocol {"addr": "172.200.0.4:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 76, "id": 3444438498}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "172.200.0.1:20335", "peerCount": 8}
2022-06-17T18:55:24.558+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 1475228436}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 9}
2022-06-17T18:55:24.558+0300 INFO started protocol {"addr": "172.200.0.3:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 2435677826}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 10}
2022-06-17T18:55:24.559+0300 WARN peer disconnected {"addr": "172.200.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 10}
2022-06-17T18:55:24.560+0300 INFO new peer connected {"addr": "172.200.0.2:20336", "peerCount": 11}
2022-06-17T18:55:24.560+0300 WARN peer disconnected {"addr": "172.200.0.254:20332", "error": "identical node id", "peerCount": 10}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 9}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 10}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "10.78.13.84:59876", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "172.200.0.2:20336", "error": "unexpected empty payload: CMDVersion", "peerCount": 7}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 9}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 10}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 11}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 12}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 11}
2022-06-17T18:55:24.562+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 12}
2022-06-17T18:55:24.562+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 13}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 12}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 11}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 10}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.563+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 10}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 9}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 7}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "max peers reached", "peerCount": 6}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 5}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "max peers reached", "peerCount": 4}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 3}
2022-06-17T18:57:21.551+0300 WARN peer disconnected {"addr": "172.200.0.4:20333", "error": "ping/pong timeout", "peerCount": 2}
2022-06-17T18:57:21.552+0300 WARN peer disconnected {"addr": "172.200.0.3:20334", "error": "ping/pong timeout", "peerCount": 1}
2022-06-17T18:57:21.552+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "ping/pong timeout", "peerCount": 0}
2022-06-17T18:57:21.553+0300 INFO new peer connected {"addr": "172.200.0.4:20333", "peerCount": 1}
2022-06-17T18:57:21.554+0300 INFO new peer connected {"addr": "10.78.13.84:20332", "peerCount": 2}
2022-06-17T18:57:21.555+0300 INFO started protocol {"addr": "172.200.0.4:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 3444438498}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 3}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "10.78.13.84:46076", "peerCount": 4}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "172.200.0.1:20335", "peerCount": 5}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "172.200.0.254:20332", "peerCount": 6}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "10.78.13.84:59972", "peerCount": 7}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 8}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "172.200.0.2:20336", "peerCount": 10}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 11}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 12}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "172.200.0.3:20334", "peerCount": 13}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 14}
2022-06-17T18:57:21.557+0300 INFO started protocol {"addr": "127.0.0.1:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 2435677826}
2022-06-17T18:57:21.557+0300 WARN peer disconnected {"addr": "172.200.0.2:20336", "error": "max peers reached", "peerCount": 13}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 14}
2022-06-17T18:57:21.558+0300 INFO started protocol {"addr": "172.200.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 970555896}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "172.200.0.254:20332", "error": "identical node id", "peerCount": 13}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 14}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "max peers reached", "peerCount": 13}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "10.78.13.84:46076", "error": "identical node id", "peerCount": 12}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 13}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 14}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 15}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "10.78.13.84:59972", "error": "identical node id", "peerCount": 14}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 13}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "10.78.13.84:20332", "error": "unexpected empty payload: CMDVersion", "peerCount": 12}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 11}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "172.200.0.3:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 10}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 8}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 7}
2022-06-17T18:57:21.559+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 1475228436}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 6}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 5}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 4}
2022-06-17T18:58:21.561+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 68, "blockHeight": 68, "took": "5m21.993873018s"}
2022-06-17T18:58:21.563+0300 INFO persisted to disk {"blocks": 8, "keys": 111, "headerHeight": 76, "blockHeight": 76, "took": "2.243347ms"}
2022-06-17T18:58:22.567+0300 INFO persisted to disk {"blocks": 10, "keys": 135, "headerHeight": 86, "blockHeight": 86, "took": "5.637669ms"}
2022-06-17T18:58:25.565+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 87, "blockHeight": 87, "took": "1.879912ms"}
2022-06-17T18:58:40.572+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 88, "blockHeight": 88, "took": "1.560317ms"}
2022-06-17T18:58:55.579+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 89, "blockHeight": 89, "took": "1.925225ms"}
2022-06-17T18:59:10.587+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 90, "blockHeight": 90, "took": "3.118073ms"}
2022-06-17T18:59:25.592+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 91, "blockHeight": 91, "took": "1.607248ms"}
2022-06-17T18:59:40.600+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 92, "blockHeight": 92, "took": "931.806µs"}
2022-06-17T18:59:55.610+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 93, "blockHeight": 93, "took": "2.019041ms"}
```
2022-07-08 17:05:18 +03:00
Anna Shaleva
cbd20eb959
rpc: implement iterator sessions
2022-07-08 17:05:18 +03:00
Roman Khimov
251c9bd89b
block: push PrevStateRoot data into stack item, fix #2551
...
And add compiler/interop support for this.
2022-07-07 15:10:29 +03:00
Roman Khimov
6deb77a77a
compiler: make interface{}() conversions possible
2022-07-07 15:10:29 +03:00
Roman Khimov
ec3d1fae59
compiler: allow to find appropriate methods via selectors
...
c.funcs contains function names using base types, while methods can be defined
on pointers and the value returned from c.getFuncNameFromSelector will have an
asterisk. We can't have the same name used for (*T) and (T) methods, so just
stripping the asterisk allows to get the right one.
2022-07-07 15:10:29 +03:00
Roman Khimov
b57dd2cad6
compiler: properly inline methods, use receiver
...
Notice that this doesn't differentiate between (*T) and (T) receivers always
treating them as is. But we have the same problem with arguments now and the
number of inlined calls is limited, usually we want this behavior.
2022-07-07 15:10:29 +03:00
Roman Khimov
6014dd720f
compiler: don't push X onto the stack for inlined method calls
...
Regular methods need this, because it'll be packed into parameters, but
inlined ones should deal with it in inlining code itself because method
receiver will be some local (aliased) variable anyway.
2022-07-06 18:18:21 +03:00
Roman Khimov
2ba9017207
Merge pull request #2581 from nspcc-dev/sym-dec-in-getnep17balances
...
rpc: add decimals/name/symbol data to getNEPXXBalance
2022-07-05 12:45:50 +03:00
Roman Khimov
ccc820505d
Merge pull request #2554 from nspcc-dev/improve-ws-err
...
rpc: adjust cases when WS connection close error is returned
2022-07-05 12:45:31 +03:00
Roman Khimov
3fbc1331aa
Merge pull request #2582 from nspcc-dev/fix-server-sync
...
network: adjust the way (*Server).IsInSync() works
2022-07-05 12:28:20 +03:00
Roman Khimov
9f05009d1a
Merge pull request #2580 from nspcc-dev/service-review
...
Service review
2022-07-05 12:23:25 +03:00
Anna Shaleva
0835581fa9
network: adjust the way (*Server).IsInSync() works
...
Always return true if sync was reached once. Fix #2564 .
2022-07-05 12:20:31 +03:00
Anna Shaleva
8f53c7d78a
rpc: adjust cases when WS connection close error is returned
...
Do not return error in case of (*WSClient).Close() method was the
initiator of connection closing.
2022-07-05 11:23:29 +03:00
Roman Khimov
3e2eda6752
*: add some comments to service Start/Shutdown methods
2022-07-04 23:03:50 +03:00
Roman Khimov
593f4e8734
Merge pull request #2559 from nspcc-dev/cli/wallet-config
...
cli: allow to specify wallet via configuration file
2022-07-04 19:24:23 +03:00
Anna Shaleva
5f36a7ca0f
*: do not call wallet.Close() explicitly
...
NewWallet and NewWalletFromFile close underlying io.Closer by itself,
no need to close it manually. Introduced in #2184 .
2022-07-04 19:09:48 +03:00
Roman Khimov
c356c14741
rpc: add decimals/name/symbol data to getNEPXXBalance
...
See neo-project/neo-modules#738 and neo-project/neo-modules#741 .
2022-07-04 18:28:27 +03:00
Roman Khimov
926b082d39
Merge pull request #2538 from nspcc-dev/restrict-out-of-bounds
...
core: check methods offsets while contract deploying
2022-07-04 12:54:32 +03:00
Roman Khimov
4afdb9fd89
Merge pull request #2578 from nspcc-dev/getcandidates
...
GetCandidates
2022-07-04 11:13:57 +03:00
Roman Khimov
36d4c17a15
stateroot: wait for the service to stop un Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
58b9ac41e2
stateroot: handle double start/shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
bf462a81fe
notary: wait for the service to finish on Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
0d627c947f
notary: control start/stop state
...
Don't start/stop twice, don't do anything in callbacks if not started.
2022-07-04 11:12:17 +03:00
Roman Khimov
73e34514a5
oracle: wait for the service to stop during Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
cab633ffed
oracle: make double-Shutdown a no-op
2022-07-04 11:12:17 +03:00
Roman Khimov
6b2fc5e056
rpc/client: add Close method
...
Allow to close unused network connections and use it during RPC broadcaster
shutdown, because otherwise we leak them.
2022-07-04 11:12:17 +03:00
Roman Khimov
649fe58550
rpcbroadcaster: properly stop broadcaster
...
Drain channels, wait for everything to stop.
2022-07-04 11:12:17 +03:00
Roman Khimov
c096f32a32
rpc/server: make double Shutdown a no-op
2022-07-01 22:01:04 +03:00
Roman Khimov
527505ea5e
consensus: drain messages and transactions on exit as well
...
There might be some threads blocked on these channels.
2022-07-01 21:55:41 +03:00
Roman Khimov
cd4f46247d
consensus: make double-call to Shutdown a no-op
2022-07-01 21:49:40 +03:00
Roman Khimov
039fcdab5a
rpc: implement getcandidates call, fix #2571
2022-07-01 18:46:44 +03:00
Roman Khimov
0da0bb21ee
rpc: make getnextvalidators behavior compliant with C# node
...
Turns out, our getnextvalidators implementation already works the way
getcandidates is supposed to work, but original getnextvalidators works a bit
differently. It only returns validators, it doesn't return Active flag (all
of them are active) and it represents votes as a number. So for the maximum
compatibility:
* drop non-validator keys from getnextvalidators server-side
* drop Active flag client-side (sorry, it doesn't exist)
* allow unmarshalling old answers along with the new one
This technically breaks `query candidates` CLI command, but it'll be fixed
when getcandidates are to be introduced.
2022-07-01 14:52:02 +03:00
Roman Khimov
c26a962b55
*: use localhost address instead of 127.0.0.1, fix #2575
2022-06-30 16:19:07 +03:00
Anna Shaleva
8ab422da66
*: properly unsubscribe from Blockchain events
2022-06-28 19:09:25 +03:00
Roman Khimov
a748298564
Merge pull request #2567 from nspcc-dev/check-consensus-start
...
consensus: check whether server is started before transaction handling
2022-06-28 18:48:22 +03:00
Anna Shaleva
de203b5c76
consensus: check whether server is started before transaction handling
...
consensus.OnTransaction is a callback, so it can be called at any time.
We need to check whether service (and dBFT) is started before the
subsequent transaction handling like it is done inside the OnPayload
callback.
2022-06-28 18:42:12 +03:00
Roman Khimov
ea69b72cd8
Merge pull request #2560 from nspcc-dev/rpc/extend-logging
...
rpc: extend error log message for failed RPC requests
2022-06-27 09:42:54 +03:00
Roman Khimov
299d55e539
Merge pull request #2558 from nspcc-dev/rpc/fix-signature-decoding
...
rpc: fix compatibility issues of `CreateFunctionInvocationScript`
2022-06-27 08:18:36 +03:00
Anna Shaleva
9488756437
rpc: extend error log message for failed RPC requests
...
Message is always non-empty; Data is allowed to be empty.
2022-06-24 12:44:10 +03:00
Anna Shaleva
a15e52ee3d
rpc: adjust TestInvocationScriptCreationGood testcase
...
Although neo-go can handle both ByteArray and ByteString parameter
types, C# node can't, so let's use the common one for tests. Compat
test:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteString", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1271 0 1070 100 201 2860 537 --:--:-- --:--:-- --:--:-- 3398
{
"jsonrpc" : "2.0",
"id" : 1,
"error" : {
"message" : "Requested value 'ByteString' was not found.",
"data" : " at System.Enum.TryParseByName(RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)\n at System.Enum.TryParseUInt32Enum(RuntimeType enumType, ReadOnlySpan`1 value, UInt32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, UInt32& result)\n at System.Enum.TryParse[TEnum](ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at System.Enum.TryParse[TEnum](String value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at Neo.SmartContract.ContractParameter.FromJson(JObject json)\n at Neo.Plugins.RpcServer.<>c.<InvokeFunction>b__43_0(JObject p)\n at System.Linq.Enumerable.SelectIListIterator`2.ToArray()\n at Neo.Plugins.RpcServer.InvokeFunction(JArray _params)\n at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)",
"code" : -2147024809
}
}
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteArray", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 507 0 307 100 200 161 105 0:00:01 0:00:01 --:--:-- 266
{
"result" : {
"gasconsumed" : "104526",
"notifications" : [],
"stack" : [],
"script" : "DCEDAS1H52IQrsc745qz0YbgpA/o2Gv6PU+r/aV7oTuI+WoRwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f"
},
"id" : 1,
"jsonrpc" : "2.0"
}
```
2022-06-24 12:37:25 +03:00
Anna Shaleva
aa3a5fc492
rpc: adjust script creation with empty parameters list
...
Always use NEWARRAY0 where possible, see
26d04a642a/src/neo/VM/Helper.cs (L41)
.
Compatibility is tested:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 370 0 248 100 122 127 62 0:00:01 0:00:01 --:--:-- 190
{
"result" : {
"notifications" : [],
"stack" : [],
"script" : "wh8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"gasconsumed" : "98403",
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f"
},
"jsonrpc" : "2.0",
"id" : 1
}
```
2022-06-24 12:37:22 +03:00
Anna Shaleva
171af36ead
rpc: fix Signature parameter unmarshalling
...
It is based64 encoded and decoded, see
5108d1c2c7/pkg/smartcontract/parameter.go (L78)
and
26d04a642a/src/neo/SmartContract/ContractParameter.cs (L150)
and
26d04a642a/src/neo/SmartContract/ContractParameter.cs (L79)
.
Also, TestInvocationScriptCreationGood is extended and compatibility
is tested with the following C# node requests:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "Signature", "value": "4edf5005771de04619235d5a4c7a9a11bb78e008541f1da7725f654c33380a3c87e2959a025da706d7255cb3a3fa07ebe9c6559d0d9e6213c68049168eb1056f"}]] }' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 665 0 381 100 284 197 147 0:00:01 0:00:01 --:--:-- 344
{
"jsonrpc" : "2.0",
"id" : 1,
"result" : {
"notifications" : [],
"stack" : [],
"script" : "DGDh51/nTTnvvV17TjrX3bfl3lrhztr1rXVtvvx7TTznjV/V1rvvbl/rnhzfffzRrdzzt7b3n1rTbl1rvTp3vbnlxvdrd9rTt5t71zrnn13R317rbXdzrzTj3Xrx5vXTnp8RwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f",
"state" : "FAULT",
"gasconsumed" : "104526"
}
}
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "Signature", "value": "Tt9QBXcd4EYZI11aTHqaEbt44AhUHx2ncl9lTDM4CjyH4pWaAl2nBtclXLOj+gfr6cZVnQ2eYhPGgEkWjrEFbw=="}]] }' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 591 0 347 100 244 794 558 --:--:-- --:--:-- --:--:-- 1352
{
"jsonrpc" : "2.0",
"result" : {
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f",
"gasconsumed" : "104526",
"notifications" : [],
"stack" : [],
"script" : "DEBO31AFdx3gRhkjXVpMepoRu3jgCFQfHadyX2VMMzgKPIfilZoCXacG1yVcs6P6B+vpxlWdDZ5iE8aASRaOsQVvEcAfDAFhDBRvRZFizuskiwcewVfZ5Pb9Jv2+UEFifVtS"
},
"id" : 1
}
```
2022-06-22 16:05:14 +03:00
Anna Shaleva
464061c7c1
rpc: refactor TestInvocationScriptCreationGood
...
Convert expected script from hex to base64 in order to match
`invokefunction` RPC response script encoding. No functional
changes.
2022-06-22 16:05:14 +03:00
Anna Shaleva
7c48edaccb
core, rpc: fix height-related issue of historic call functionality
...
Specifying a certain stateroot R as `invoke*historic` RPC-call
parameter, we're willing to perform historic call based on the storage
state of root R. Thus, next block should be of the height h(R)+1. This
allows to use historic functionality for the current blockchain height.
2022-06-20 19:05:22 +03:00
Roman Khimov
5108d1c2c7
Merge pull request #2539 from nspcc-dev/rollback-methods-sorting
...
core: sort native methods in ASCII-compatible way
2022-06-14 22:09:23 +03:00
Roman Khimov
6e475856aa
Merge pull request #2544 from nspcc-dev/rpc/remove-cause
...
rpc: remove Cause field from RPC error
2022-06-10 19:12:13 +03:00
Anna Shaleva
ea6ddbee5b
rpc: get rid of erverError type
...
Retrieve error's HTTP code in a separate method.
2022-06-10 16:47:57 +03:00
Anna Shaleva
6434404081
rpc: extend the list of predefined RPC errors
...
Add a few the most common ones.
2022-06-10 16:47:42 +03:00
Anna Shaleva
ef9eca7cce
rpc: unexport ServerError
...
It's internal server thing that is not for the outside users.
2022-06-10 16:38:41 +03:00
Anna Shaleva
0687924e87
rpc: split response.Error into server/client side
2022-06-10 16:35:51 +03:00
Anna Shaleva
5803923f68
rpc: remove Cause field from RPC error
...
We can use Data field for the same purposes.
2022-06-10 16:35:48 +03:00
Roman Khimov
7b88aedb27
transaction: add fuzz-test, refs. #2374
2022-06-09 13:43:22 +03:00
Roman Khimov
9919fd2cc9
Merge pull request #2548 from nspcc-dev/shuffle-tests
...
Shuffle tests and some other code
2022-06-09 12:28:03 +03:00
Evgeniy Stratonikov
0431e26659
wallet: export SavePretty
method
...
Client code can make use of it, see nspcc-dev/neofs-node#1498 .
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-06-09 09:47:18 +03:00
Roman Khimov
1b7c8f262b
core: add some comment for TestDesignate_DesignateAsRole
...
Closes #1472 at last.
2022-06-08 23:11:14 +03:00
Roman Khimov
ef50518b83
core: move notary tests into the notary package
2022-06-08 23:07:28 +03:00
Roman Khimov
5d573895ad
core: move oracle tests into oracle service
2022-06-08 23:04:47 +03:00
Roman Khimov
017cd558cb
core: move statesync tests into the statesync package
2022-06-08 22:57:48 +03:00
Roman Khimov
ff75e67610
core: move stateroot tests into services/stateroot
...
They test both module and service which is a bit wrong, but separating these
tests will lead to some duplication, so it's OK for now to have them in the
higher-order package (service imports module).
2022-06-08 22:53:09 +03:00
Roman Khimov
167bb72424
core: move Policy contract tests to native
2022-06-08 22:44:25 +03:00
Roman Khimov
a1eccc16e6
core: move benchmarks into bench_test.go
...
They share some functions and they're benchmarks, so let's have them here.
2022-06-08 22:39:57 +03:00
Roman Khimov
2e2d886a2f
core: move Management contract test into native
2022-06-08 22:34:09 +03:00
Roman Khimov
8057c096c6
core: move native invocation tests into native
2022-06-08 22:26:24 +03:00
Roman Khimov
2086bca303
core: move storage-related interop code into the storage package
2022-06-08 22:26:24 +03:00
Roman Khimov
f0d7a1da2a
core: move contract-related tests to the contract package
2022-06-08 19:01:34 +03:00
Roman Khimov
e7e80fda64
core: move TestNativeGetMethod to the native package
2022-06-08 18:51:27 +03:00
Roman Khimov
2127cc4146
core: move Runtime tests to runtime package
2022-06-08 18:46:49 +03:00
Roman Khimov
0055b18a8a
core: export CreateGenesisBlock
...
Nothing bad with it being public.
2022-06-08 18:20:34 +03:00
Roman Khimov
d70caf1da1
core: move GetScriptContainer to runtime
...
It also brings ToStackItem to Block and Transaction, previously this was
avoided to separate block and transaction packages from VM. But turns out
`transaction` depends on `stackitem` already, so this makes little sense (but
can be shuffled in another way if needed).
Context.Container is still a hash.Hashable because we have a number of
occasions (header or MPT root verification) where there is no ToStackItem
implementation possible. Maybe they can go with `nil` Container, but I don't
want to have this risk for now.
2022-06-08 18:12:41 +03:00
Roman Khimov
cdb55740ea
core: move ContractCreate*Account tests into the contract pkg
...
No functional changes.
2022-06-08 16:56:06 +03:00
Roman Khimov
ff1545b7eb
core: move TestContractCall into the contract package
...
It belongs there and now it can be moved. No functional changes.
2022-06-08 16:53:01 +03:00
Roman Khimov
bb021d0778
native: unbind PutContractState from Management
...
It doesn't need Management's state, ID can't really change.
2022-06-08 16:41:28 +03:00
Roman Khimov
209b977e9a
core: move contract-related interop code into appropriate package
...
And move one of the tests with it.
2022-06-08 16:02:07 +03:00