Anna Shaleva
2c0844221a
rpcclient: fix filtered naive subscriptions receiver
...
We should return the filter itself instead of pointer.
2022-12-07 16:56:16 +03:00
Roman Khimov
d909cab4a4
rpcclient/management: add new methods
2022-12-02 10:57:05 +03:00
Roman Khimov
93cec0bba5
Merge pull request #2786 from nspcc-dev/simplify-getversion
...
Simplify result.Version
2022-12-02 14:07:55 +07:00
Roman Khimov
fb09670fd1
rpcclient: extract more detailed server-side on WS connection problem
...
If available. Fixes #2818 .
2022-11-23 12:19:35 +03:00
Roman Khimov
fd04b2befd
actor: don't abort waiter on "already exists" error
...
It can happen in many cases of distributed tx generation/submission, we can
just wait normally in this case and there will be some proper result.
2022-11-23 10:07:37 +03:00
Roman Khimov
cd6bb68246
actor: check for tx after the subscription in wsWaiter, fix #2805
...
Don't wait for VUB block, solve this race immediately.
2022-11-22 17:28:55 +03:00
Roman Khimov
c95d140113
rpcclient: always return tx hash from sendrawtransaction
...
Let upper-layer APIs like actor.Send() return it as well. Server can return
"already exists" which is an error and yet at the same time a very special
one, in many cases it means we can proceed with waiting for the TX to settle.
2022-11-22 15:18:37 +03:00
Anna Shaleva
1399496dfb
rpcclient: refactor event-based waiting loop
...
Avoid receiver channels locks.
2022-11-16 23:57:00 +03:00
Anna Shaleva
95e23c8e46
actor: fix event-based tx awaiting
...
If VUB-th block is received, we still can't guaranty that transaction
wasn't accepted to chain. Back this situation by rolling back to a
poll-based waiter.
2022-11-16 23:44:31 +03:00
Anna Shaleva
6dbae7edc4
rpcclient: fix WS-client unsubscription process
...
Do not block subscribers until the unsubscription request to RPC server
is completed. Otherwise, another notification may be received from the
RPC server which will block the unsubscription process.
At the same time, fix event-based waiter. We must not block the receiver
channel during unsubscription because there's a chance that subsequent
event will be sent by the server. We need to read this event in order not
to block the WSClient's readloop.
2022-11-16 23:44:30 +03:00
Anna Shaleva
3f122fd591
rpcclient: adjust WS waiter error formatting
...
Follow the other errors formatting style.
2022-11-16 12:22:18 +03:00
Roman Khimov
b5c79f4be3
unwrap: add a complete set of simple array unwrappers
...
Arrays of basic types should be covered completely.
2022-11-14 13:01:13 +03:00
Roman Khimov
7f8a79ffaa
result: drop deprecated Magic and StateRootInHeader from Version
...
It's more than a year now we have them deprecated.
2022-11-10 16:32:49 +03:00
Roman Khimov
bb47d971dc
rpcclient/nep11: make DivisibleWriter part reusable
...
Same rationale as for BaseWriter or nep17.TokenWriter, otherwise it's hard to
build on top of plain Divisible structure.
2022-11-07 10:44:39 +03:00
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
f0abc035af
unwrap: add PublicKey to unwrap public keys
...
We have this type in NEP-14 directly.
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
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
317dd42513
*: use uint*Size and SignatureLen constants where appropriate
2022-10-05 10:45:52 +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
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
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
aca8ce0d28
unwrap: provide ErrNoSessionID, add some explanations
2022-09-07 22:40:25 +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