Working towards migrating the `parity-bridges-common` repo inside
`polkadot-sdk`. This PR upgrades some dependencies in order to align
them with the versions used in `parity-bridges-common`
Related to
https://github.com/paritytech/parity-bridges-common/issues/2538
Lifting some more dependencies to the workspace. Just using the
most-often updated ones for now.
It can be reproduced locally.
```sh
# First you can check if there would be semver incompatible bumps (looks good in this case):
$ zepter transpose dependency lift-to-workspace --ignore-errors syn quote thiserror "regex:^serde.*"
# Then apply the changes:
$ zepter transpose dependency lift-to-workspace --version-resolver=highest syn quote thiserror "regex:^serde.*" --fix
# And format the changes:
$ taplo format --config .config/taplo.toml
```
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Close#2992
Breaking changes:
- rpc server grafana metric `substrate_rpc_requests_started` is removed
(not possible to implement anymore)
- rpc server grafana metric `substrate_rpc_requests_finished` is removed
(not possible to implement anymore)
- rpc server ws ping/pong not ACK:ed within 30 seconds more than three
times then the connection will be closed
Added
- rpc server grafana metric `substrate_rpc_sessions_time` is added to
get the duration for each websocket session
This is a rather big change in jsonrpsee, the major things in this bump
are:
- Server backpressure (the subscription impls are modified to deal with
that)
- Allow custom error types / return types (remove jsonrpsee::core::Error
and jsonrpee::core::CallError)
- Bug fixes (graceful shutdown in particular not used by substrate
anyway)
- Less dependencies for the clients in particular
- Return type requires Clone in method call responses
- Moved to tokio channels
- Async subscription API (not used in this PR)
Major changes in this PR:
- The subscriptions are now bounded and if subscription can't keep up
with the server it is dropped
- CLI: add parameter to configure the jsonrpc server bounded message
buffer (default is 64)
- Add our own subscription helper to deal with the unbounded streams in
substrate
The most important things in this PR to review is the added helpers
functions in `substrate/client/rpc/src/utils.rs` and the rest is pretty
much chore.
Regarding the "bounded buffer limit" it may cause the server to handle
the JSON-RPC calls
slower than before.
The message size limit is bounded by "--rpc-response-size" thus "by
default 10MB * 64 = 640MB"
but the subscription message size is not covered by this limit and could
be capped as well.
Hopefully the last release prior to 1.0, sorry in advance for a big PR
Previous attempt: https://github.com/paritytech/substrate/pull/13992
Resolves https://github.com/paritytech/polkadot-sdk/issues/748, resolves
https://github.com/paritytech/polkadot-sdk/issues/627
We currently use a bit of a hack in `.cargo/config` to make sure that
clippy isn't too annoying by specifying the list of lints.
There is now a stable way to define lints for a workspace. The only down
side is that every crate seems to have to opt into this so there's a
*few* files modified in this PR.
Dependencies:
- [x] PR that upgrades CI to use rust 1.74 is merged.
---------
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Using taplo, fixes all our broken and inconsistent toml formatting and
adds CI to keep them tidy.
If people want we can customise the format rules as described here
https://taplo.tamasfe.dev/configuration/formatter-options.html
@ggwpez, I suggest zepter is used only for checking features are
propagated, and leave formatting for taplo to avoid duplicate work and
conflicts.
TODO
- [x] Use `exclude = [...]` syntax in taplo file to ignore zombienet
tests instead of deleting the dir
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.
This requires: https://github.com/paritytech/scale-info/pull/197
---------
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
* replace Index by Nonce
* replace Index by Nonce
* replace Index by Nonce
* replace Index by Nonce
* replace Index by Nonce
* wip
* remove index in lieu of nonce
* wip
* remove accountnonce in lieu of nonce
* add minor improvement
* rebase and merge conflicts
* Remove use of trait Store from staking pallet
* Remove use of trait Store from bounties pallet
* Remove use of trait Store from collective pallet
* Remove use of trait Store from babe pallet
* Remove use of trait Store from assets pallet
* Remove use of trait Store from grandpa pallet
* Remove use of trait Store from balances pallet
* Remove use of trait Store from authorship pallet
* Remove use of trait Store from authority-discovery pallet
* Remove use of trait Store from atomic-swap pallet
* Remove use of trait Store from sudo pallet
* Remove use of trait Store from scheduler pallet
* Remove use of trait Store from scored-pool pallet
* Remove use of trait Store from society pallet
* Remove use of trait Store from lottery pallet
* Remove use of trait Store from executive pallet
* Remove use of trait Store from democracy pallet
* Remove use of trait Store from elections-phragmen pallet
* Remove use of trait Store from indices pallet
* Remove use of trait Store from identity pallet
* Remove use of trait Store from multisig pallet
* Remove use of trait Store from merkle-mountain-range pallet
* Remove use of trait Store from im-online pallet
* Remove use of trait Store from membership pallet
* Remove use of trait Store from nicks pallet
* Remove use of trait Store from session pallet
* Remove use of trait Store from transaction-payment pallet
* Remove use of trait Store from utility pallet
* Remove use of trait Store from child-bounties pallet
* Remove use of trait Store from nis pallet
* Remove use of trait Store from nfts pallet
* Remove use of trait Store from conviction-voting pallet
* Remove use of trait Store from treasury pallet
* Remove use of trait Store from vesting pallet
* Remove use of trait Store from preimage pallet
* Remove use of trait Store from uniques pallet
* Remove use of trait Store from ranked-collective pallet
* Remove use of trait Store from beefy-mmr pallet
* Remove use of trait Store from referenda pallet
* Remove use of trait Store from whitelist pallet
* Remove use of trait Store from alliance pallet
* Remove use of trait Store from nomination-pools pallet
* Remove use of trait Store from state-trie-migration pallet
* Remove use of trait Store from message-queue pallet
* Remove use of trait Store from root-offences pallet
* Remove use of trait Store from root-testing pallet
* Remove use of trait Store from timestamps pallet
* Remove use of trait Store from system pallet
* Remove use of trait Store from offences pallet
* Remove use of trait Store from recovery pallet
* Remove use of trait Store from node-authorization pallet
* Remove use of trait Store from proxy pallet
* Remove use of trait Store from benchmarking pallet
* Remove use of trait Store from bags-list pallet
* Add deprecated warning in store_trait
* Change warning message
* Run cargo fmt
* Fix warning and update tests
* Remove unnecessary allow deprecated
* Remove use of trait Store
* Fix mismatch in expected output
* Minor update to warning message for deprecation of generate_store with Store trait attribute
* Fixes as per review comments
* Fixes as per review suggestions
* Remove use of Store trait from core-fellowship pallet
* Fix type in store_trait.rs
* Fixes as pre review comment
* Change copyright year to 2023 from 2022
* Fix incorrect update of copyright year
* Remove years from copy right header
* Fix remaining files
* Fix typo in a header and remove update-copyright.sh
* jsonrpsee v0.16
add backwards compatibility
run old http server on http only
* cargo fmt
* update jsonrpsee 0.16.1
* less verbose cors log
* fix nit in log: WS -> HTTP
* revert needless changes in Cargo.lock
* remove unused features in tower
* fix nits; add client-core feature
* jsonrpsee v0.16.2
* Replace deprecated libp2p feature specs with correct ones
* Bump tokio to 1.21.2
* Replace async-std libp2p primitives with tokio ones
* minor: rustfmt
* Fix TestNet to run initialization in the tokio context
* Convert telemetry test from async-std to tokio
* Convert notifications tests from async-std to tokio
* Convert chain sync tests from async-std to tokio
* Ditch async-std completely
* Make executor mandatory
* Bump tokio to 1.22.0
* minor: rustfmt
* Explicitly use tokio runtime in tests
* Move more tests to explicit tokio runtime
* Explicitly set multithreaded runtime in tokio test
* minor: rustfmt
* minor: fix comment
* Replace async-std with tokio in MMR tests
* BREAKING: Rename Origin
* more renaming
* a bit more renaming
* fix
* more fixing
* fix in frame_support
* even more fixes
* fix
* small fix
* ...
* update .stderr
* docs
* update docs
* update docs
* docs
* bump jsonrpsee to fix#11480
In addition it adds WebSocket server-side pings which is configured to
send out pings periodically every 30 seconds.
* use released crates.io version
* Update Cargo.toml
* Add tokio
* No need to map CallError to CallError
* jsonrpsee proc macros (#9673)
* port error types to `JsonRpseeError`
* migrate chain module to proc macro api
* make it compile with proc macros
* update branch
* update branch
* update to jsonrpsee master
* port system rpc
* port state rpc
* port childstate & offchain
* frame system rpc
* frame transaction payment
* bring back CORS hack to work with polkadot UI
* port babe rpc
* port manual seal rpc
* port frame mmr rpc
* port frame contracts rpc
* port finality grandpa rpc
* port sync state rpc
* resolve a few TODO + no jsonrpc deps
* Update bin/node/rpc-client/src/main.rs
* Update bin/node/rpc-client/src/main.rs
* Update bin/node/rpc-client/src/main.rs
* Update bin/node/rpc-client/src/main.rs
* Port over system_ rpc tests
* Make it compile
* Use prost 0.8
* Use prost 0.8
* Make it compile
* Ignore more failing tests
* Comment out WIP tests
* fix nit in frame system api
* Update lockfile
* No more juggling tokio versions
* No more wait_for_stop ?
* Remove browser-testing
* Arguments must be arrays
* Use same argument names
* Resolve todo: no wait_for_stop for WS server
Add todo: is parse_rpc_result used?
Cleanup imports
* fmt
* log
* One test passes
* update jsonrpsee
* update jsonrpsee
* cleanup rpc-servers crate
* jsonrpsee: add host and origin filtering (#9787)
* add access control in the jsonrpsee servers
* use master
* fix nits
* rpc runtime_version safe
* fix nits
* fix grumbles
* remove unused files
* resolve some todos
* jsonrpsee more cleanup (#9803)
* more cleanup
* resolve TODOs
* fix some unwraps
* remove type hints
* update jsonrpsee
* downgrade zeroize
* pin jsonrpsee rev
* remove unwrap nit
* Comment out more tests that aren't ported
* Comment out more tests
* Fix tests after merge
* Subscription test
* Invalid nonce test
* Pending exts
* WIP removeExtrinsic test
* Test remove_extrinsic
* Make state test: should_return_storage work
* Uncomment/fix the other non-subscription related state tests
* test: author_insertKey
* test: author_rotateKeys
* Get rest of state tests passing
* asyncify a little more
* Add todo to note #msg change
* Crashing test for has_session_keys
* Fix error conversion to avoid stack overflows
Port author_hasSessionKeys test
fmt
* test author_hasKey
* Add two missing tests
Add a check on the return type
Add todos for James's concerns
* RPC tests for state, author and system (#9859)
* Fix test runner
* Impl Default for SubscriptionTaskExecutor
* Keep the minimul amount of code needed to compile tests
* Re-instate `RpcSession` (for now)
* cleanup
* Port over RPC tests
* Add tokio
* No need to map CallError to CallError
* Port over system_ rpc tests
* Make it compile
* Use prost 0.8
* Use prost 0.8
* Make it compile
* Ignore more failing tests
* Comment out WIP tests
* Update lockfile
* No more juggling tokio versions
* No more wait_for_stop ?
* Remove browser-testing
* Arguments must be arrays
* Use same argument names
* Resolve todo: no wait_for_stop for WS server
Add todo: is parse_rpc_result used?
Cleanup imports
* fmt
* log
* One test passes
* Comment out more tests that aren't ported
* Comment out more tests
* Fix tests after merge
* Subscription test
* Invalid nonce test
* Pending exts
* WIP removeExtrinsic test
* Test remove_extrinsic
* Make state test: should_return_storage work
* Uncomment/fix the other non-subscription related state tests
* test: author_insertKey
* test: author_rotateKeys
* Get rest of state tests passing
* asyncify a little more
* Add todo to note #msg change
* Crashing test for has_session_keys
* Fix error conversion to avoid stack overflows
Port author_hasSessionKeys test
fmt
* test author_hasKey
* Add two missing tests
Add a check on the return type
Add todos for James's concerns
* offchain rpc tests
* Address todos
* fmt
Co-authored-by: James Wilson <james@jsdw.me>
* fix drop in state test
* update jsonrpsee
* fix ignored system test
* fix chain tests
* remove some boiler plate
* Port BEEFY RPC (#9883)
* Merge master
* Port beefy RPC (ty @niklas!)
* trivial changes left over from merge
* Remove unused code
* Update jsonrpsee
* fix build
* make tests compile again
* beefy update jsonrpsee
* fix: respect rpc methods policy
* update cargo.lock
* update jsonrpsee
* update jsonrpsee
* downgrade error logs
* update jsonrpsee
* Fix typo
* remove unused file
* Better name
* Port Babe RPC tests
* Put docs back
* Resolve todo
* Port tests for System RPCs
* Resolve todo
* fix build
* Updated jsonrpsee to current master
* fix: port finality grandpa rpc tests
* Move .into() outside of the match
* more review grumbles
* jsonrpsee: add `rpc handlers` back (#10245)
* add back RpcHandlers
* cargo fmt
* fix docs
* fix grumble: remove needless alloc
* resolve TODO
* fmt
* Fix typo
* grumble: Use constants based on BASE_ERROR
* grumble: DRY whitelisted listening addresses
grumble: s/JSONRPC/JSON-RPC/
* cleanup
* grumbles: Making readers aware of the possibility of gaps
* review grumbles
* grumbles
* remove notes from niklasad1
* Update `jsonrpsee`
* fix: jsonrpsee features
* jsonrpsee: fallback to random port in case the specified port failed (#10304)
* jsonrpsee: fallback to random port
* better comment
* Update client/rpc-servers/src/lib.rs
Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com>
* Update client/rpc-servers/src/lib.rs
Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com>
* address grumbles
* cargo fmt
* addrs already slice
Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com>
* Update jsonrpsee to 092081a0a2b8904c6ebd2cd99e16c7bc13ffc3ae
* lockfile
* update jsonrpsee
* fix warning
* Don't fetch jsonrpsee from crates
* make tests compile again
* fix rpc tests
* remove unused deps
* update tokio
* fix rpc tests again
* fix: test runner
`HttpServerBuilder::builder` fails unless it's called within tokio runtime
* cargo fmt
* grumbles: fix subscription aliases
* make clippy happy
* update remaining subscriptions alias
* cleanup
* cleanup
* fix chain subscription: less boiler plate (#10285)
* fix chain subscription: less boiler plate
* fix bad merge
* cargo fmt
* Switch to jsonrpsee 0.5
* fix build
* add missing features
* fix nit: remove needless Box::pin
* Integrate jsonrpsee metrics (#10395)
* draft metrics impl
* Use latest api
* Add missing file
* Http server metrics
* cleanup
* bump jsonrpsee
* Remove `ServerMetrics` and use a single middleware for both connection counting (aka sessions) and call metrics.
* fix build
* remove needless Arc::clone
* Update to jsonrpsee 0.6
* lolz
* fix metrics
* Revert "lolz"
This reverts commit eed6c6a56e78d8e307b4950f4c52a1c3a2322ba1.
* fix: in-memory rpc support subscriptions
* commit Cargo.lock
* Update tests to 0.7
* fix TODOs
* ws server: generate subscriptionIDs as Strings
Some libraries seems to expect the subscription IDs to be Strings, let's not break
this in this PR.
* Increase timeout
* Port over tests
* cleanup
* Using error codes from the spec
* fix clippy
* cargo fmt
* update jsonrpsee
* fix nits
* fix: rpc_query
* enable custom subid gen through spawn_tasks
* remove unsed deps
* unify tokio deps
* Revert "enable custom subid gen through spawn_tasks"
This reverts commit 5c5eb70328fe39d154fdb55c56e637b4548cf470.
* fix bad merge of `test-utils`
* fix more nits
* downgrade wasm-instrument to 0.1.0
* [jsonrpsee]: enable custom RPC subscription ID generatation (#10731)
* enable custom subid gen through spawn_tasks
* fix nits
* Update client/service/src/builder.rs
Co-authored-by: David <dvdplm@gmail.com>
* add Poc; needs jsonrpsee pr
* update jsonrpsee
* add re-exports
* add docs
Co-authored-by: David <dvdplm@gmail.com>
* cargo fmt
* fmt
* port RPC-API dev
* Remove unused file
* fix nit: remove async trait
* fix doc links
* fix merge nit: remove jsonrpc deps
* kill namespace on rpc apis
* companion for jsonrpsee v0.10 (#11158)
* companion for jsonrpsee v0.10
* update versions v0.10.0
* add some fixes
* spelling
* fix spaces
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* send error before subs are closed
* fix unsubscribe method names: chain
* fix tests
* jsonrpc server: print binded local address
* grumbles: kill SubscriptionTaskExecutor
* Update client/sync-state-rpc/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/rpc/src/chain/chain_full.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/rpc/src/chain/chain_full.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* sync-state-rpc: kill anyhow
* no more anyhow
* remove todo
* jsonrpsee: fix bad params in subscriptions. (#11251)
* update jsonrpsee
* fix error responses
* revert error codes
* dont do weird stuff in drop impl
* rpc servers: remove needless clone
* Remove silly constants
* chore: update jsonrpsee v0.12
* commit Cargo.lock
* deps: downgrade git2
* feat: CLI flag max subscriptions per connection
* metrics: use old logging format
* fix: read WS address from substrate output (#11379)
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Maciej Hirsz <hello@maciej.codes>
Co-authored-by: Maciej Hirsz <1096222+maciejhirsz@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Upgraded dependencies
* Adapting code to scale v3
* Empty commit to trigger CI
* Triggering CI
* Fixing UI test
* Remove superfluous dev-dep added by #9228
* Cryout for CI