1. Jan 23, 2024
    • Niklas Adolfsson's avatar
      rpc: backpressured RPC server (bump jsonrpsee 0.20) (#1313) · e16ef086
      Niklas Adolfsson authored
      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
      e16ef086
  2. Jan 22, 2024
  3. Jan 07, 2024
  4. Jan 04, 2024
  5. Dec 13, 2023
  6. Nov 30, 2023
  7. Nov 29, 2023
  8. Oct 10, 2023
    • Liam Aharon's avatar
      remote-ext: fix state download stall on slow connections and reduce memory usage (#1295) · 55f35442
      Liam Aharon authored
      Original PR https://github.com/paritytech/substrate/pull/14746
      
      ---
      
      ## Fixing stall
      
      ### Introduction
      I experienced an apparent stall downloading state from
      `https://rococo-try-runtime-node.parity-chains.parity.io:443` which was
      having networking difficulties only responding to my JSONRPC requests
      with 50-200KB/s of bandwidth.
      
      This PR fixes the issue causing the stall, and generally improves
      performance remote-ext when it downloads state by greatly reducing the
      chances of a timeout occuring.
      
      ### Description
      Introduces a new `REQUEST_DURATION_TARGET` constant and modifies
      `get_storage_data_dynamic_batch_size` to
      
      - Increase or decrease the batch size of the next request depending on
      whether the elapsed time of the last request was gt or lt the target
      - Reset the batch size to 1 if the request times out
      
      This fixes an issue on slow connections that can otherwise cause
      multiple timeouts and a stalled download when:
      
      1. The batch size increases rapidly as remote-ext downloads keys with
      small associated storage values
      2. remote-ext tries to process a large series of subsequent keys all
      with extremely large associated storage values (Rococo has a series of
      keys 1-5MB large)
      3. The huge storage values download for 5 minutes until the request
      times out
      4. The partially downloaded keys are thrown out and remote-ext tries
      again with a smaller batch size, but the batch size is still far too
      large and takes 5 minutes to be reduced again
      5. The download will be essentially stalled for many hours while the
      above step cycles
      
      
      After this PR, the request size will
      
      - Not grow as large to begin with, as it is regulated downwards as the
      request duration exceeds the target
      - Drop immediately to 1 if the request times out. A timeout indicates
      the keys next in line to download have extremely large storage values
      compared to previously downloaded keys, and we need to reset the batch
      size to figure out what our new ideal batch size is. By not resetting
      down to 1, we risk the next request timing out again.
      
      ## Reducing memory
      
      As suggested by @bkchr, I adjusted `get_storage_data_dynamic_batch_size`
      from being recursive to a loop which allows removing a bunch of clones
      that were chewing through a lot of memory. I noticed actually it was
      using up to 50GB swap previously when downloading Polkadot keys on a
      slow connection, because it needed to recurse and clone a lot.
      
      After this change it uses only ~1.5GB memory.
      55f35442
  9. Aug 30, 2023
  10. Aug 29, 2023
  11. Aug 25, 2023
  12. Aug 17, 2023
  13. Jul 25, 2023
  14. Jun 27, 2023
  15. Jun 21, 2023
  16. May 31, 2023
  17. May 29, 2023
  18. May 19, 2023
  19. May 07, 2023
  20. May 05, 2023
    • Liam Aharon's avatar
      try-runtime-cli: 'instant' snapshots, threading refactor, better progress logs (#14057) · ead46b9e
      Liam Aharon authored
      * remote externalities refactor
      
      * remove redundant logs
      
      * use const for parallel requests
      
      * prefer functional
      
      * improve variable naming
      
      * handle requests error
      
      * use overlayedchanges
      
      * Revert "use overlayedchanges"
      
      This reverts commit c0ddb87a5abdd52207597f5df66cbbdf9d79badc.
      
      * Revert "Revert "use overlayedchanges""
      
      This reverts commit 1d49362d9b999c045c8f970a0ab8b486bc47a90a.
      
      * Revert "Revert "Revert "use overlayedchanges"""
      
      This reverts commit 06df786488d94f249e9abccffac4af445f76e5a7.
      
      * backup/load raw storage values
      
      * test raw storage drain and restore
      
      * update snapshot tests
      
      * improve logs
      
      * clippy suggestions
      
      * address comments
      
      * fix example
      
      * fix test
      
      * clippy
      ead46b9e
  21. Apr 27, 2023
  22. Apr 21, 2023
    • Liam Aharon's avatar
      try-runtime: dynamic storage query sizes (#13923) · bc1a5992
      Liam Aharon authored
      
      
      * improve batch rpc error message
      
      * wip aimd storage data fetch
      
      * complete aimd function refactor
      
      * make batch_request function async
      
      * improve function name
      
      * fix load_child_remote issue
      
      * slight efficiency improvement
      
      * improve logs and variable name
      
      * remove redundant comment
      
      * improve comment
      
      * address pr comments
      
      * Update utils/frame/remote-externalities/src/lib.rs
      
      Co-authored-by: default avatarNiklas Adolfsson <[email protected]>
      
      * simplify client handling
      
      * fix type issue
      
      * fix clippy issue
      
      * try to trigger ci
      
      * try to trigger ci
      
      ---------
      
      Co-authored-by: default avatarNiklas Adolfsson <[email protected]>
      bc1a5992
  23. Feb 23, 2023
    • Gonçalo Pestana's avatar
    • Gonçalo Pestana's avatar
      Abstracts elections-phragmen pallet to use NposSolver (#12588) · b793666c
      Gonçalo Pestana authored
      
      
      * Abstracts elections-phragmen pallet to use NposSolver
      
      * Update frame/elections-phragmen/src/lib.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Update frame/elections-phragmen/src/lib.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * changes the name of the pallet; adds changelog
      
      * update changelog
      
      * Adds weight testing
      
      * Adds log macro_rules
      
      * renames elections-phragment dir to elections
      
      * weights rename
      
      * fixes typo in cargo toml
      
      * pre/post solve weight scafolding
      
      * refactor do_post_election
      
      * refactors into pre and post election solve for independent benchmarking
      
      * deconstructs PreElectionResults struct
      
      * updates benchmarking pre and post election solve; mock weights
      
      * Update frame/elections/src/lib.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Update frame/elections/src/lib.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * addresses PR comments
      
      * adds pre_solve and post_sove weights
      
      * Adds comments on election pallet id param name change
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections
      
      * Finishes pre-post solve weights
      
      * Update frame/elections/src/lib.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Update frame/elections/src/lib.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Addresses PR comments: no panic in on_init path; nits
      
      * Fixes node build
      
      * Implements approval voting to use as a `NposSolver` (#13367)
      
      * Implements the approval voting methods in sp_npos_elections
      
      * fmt
      
      * remove unecessary file
      
      * comment clarification
      
      * re-run weights
      
      * fix typo
      
      * updates MaxVoters in tests for integrity_tests to pass
      
      * Refactors election provider support benchmarks outside its own crate (#13431)
      
      * Refactors election provider support benchmarks outside its own crate
      ---------
      
      Co-authored-by: command-bot <>
      
      ---------
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: parity-processbot <>
      Co-authored-by: default avatarRoss Bulat <[email protected]>
      b793666c
  24. Feb 21, 2023
    • Vivek Pandya's avatar
      Remove years from copyright notes. (#13415) · bc53b9a0
      Vivek Pandya authored
      * 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
      bc53b9a0
  25. Jan 19, 2023
  26. Dec 19, 2022
    • Qinxuan Chen's avatar
      *: update `rand` to v0.8.5 (#12962) · 40c04cf1
      Qinxuan Chen authored
      * *: update rand to v0.8.5
      
      * *: remove useless deps from Cargo.toml
      
      * fix pallet-session-benchmarking
      
      * fix pallet-election-provider-support test
      
      * remove useless rand from dev-dependencies
      40c04cf1
  27. Dec 14, 2022
  28. Dec 12, 2022
    • Kian Paimani's avatar
      Remove implicit approval chilling upon slash. (#12420) · 0b296916
      Kian Paimani authored
      
      
      * don't read slashing spans when taking election snapshot
      
      * update cargo.toml
      
      * bring back remote test
      
      * fix merge stuff
      
      * fix npos-voters function sig
      
      * remove as much redundant diff as you can
      
      * Update frame/staking/src/pallet/mod.rs
      
      Co-authored-by: default avatarAndronik <[email protected]>
      
      * fix
      
      * Update frame/staking/src/pallet/impls.rs
      
      * update lock
      
      * fix all tests
      
      * review comments
      
      * fmt
      
      * fix offence bench
      
      * clippy
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_staking
      
      Co-authored-by: default avatarAndronik <[email protected]>
      Co-authored-by: default avatarAnkan <[email protected]>
      Co-authored-by: command-bot <>
      0b296916
    • Niklas Adolfsson's avatar
      rpc server with HTTP/WS on the same socket (#12663) · 84303ca7
      Niklas Adolfsson authored
      * 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
      84303ca7
  29. Dec 07, 2022
    • João Paulo Silva de Souza's avatar
      Implement crate publishing on CI (#12768) · 8751f88f
      João Paulo Silva de Souza authored
      
      
      * implement crate publishing from CI
      
      * fix indentation
      
      * use resource_group for job exclusivity
      
      ensure that at most one instance of the publish-crates job is running at any given time to prevent race conditions
      
      * correct publish = false
      
      * Remove YAML anchors as GitLab's `extends:` doesn't need it
      
      * Temporarily force cache upload for the new jobs
      
      * Revert `RUSTY_CACHIER_FORCE_UPLOAD`
      
      * pin libp2p-tcp=0.37.0 for sc-telemetry
      
      * Revert "pin libp2p-tcp=0.37.0 for sc-telemetry"
      
      This reverts commit 29146bfad6c31e8cf0e2f17ad92a71bb81a373af.
      
      * always collect generated crates
      
      * increase timeout for publish-crates-template
      
      * Force upload the new job cache again
      
      * Revert "Force upload the new job cache again"
      
      This reverts commit 5a5feee1b2c51fdef768b25a76be4c3949ec1c99.
      
      * reformat
      
      * improve timeout explanation
      
      * s/usual/average
      
      Co-authored-by: Vladimir Istyufeev's avatarVladimir Istyufeev <[email protected]>
      8751f88f
  30. Dec 06, 2022
  31. Dec 05, 2022
    • Dmitry Markin's avatar
      Upgrade tokio to 1.22.0 and replace async-std with tokio (#12646) · 5eb84f9c
      Dmitry Markin authored
      * 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
      5eb84f9c
  32. Nov 15, 2022
  33. Oct 18, 2022
  34. Sep 06, 2022
    • Piotr Mikołajczyk's avatar
      `try-runtime`::`follow-chain` - keep connection (#12167) · 198f94f9
      Piotr Mikołajczyk authored
      * Refactor RPC module
      
      * Add flag to `follow-chain`
      
      * Multithreading remark
      
      * fmt
      
      * O_O
      
      * unused import
      
      * cmon
      
      * accidental removal reverted
      
      * remove RpcHeaderProvider
      
      * mut refs
      
      * fmt
      
      * no mutability
      
      * now?
      
      * now?
      
      * arc mutex
      
      * async mutex
      
      * async mutex
      
      * uhm
      
      * connect in constructor
      
      * remove dep
      
      * old import
      
      * another take
      
      * trigger polkadot pipeline
      
      * trigger pipeline
      198f94f9
  35. Sep 01, 2022