1. Nov 10, 2019
  2. Nov 08, 2019
  3. Nov 01, 2019
    • Benjamin Kampmann's avatar
      Move config path generation into the service config for reusability (#3978) · d5565600
      Benjamin Kampmann authored
      
      
      * Move config path generation into the service config for reusability
      
      * Make NoCostum Default and fix tests
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * remove function not used anymore
      
      * Make path into an option
      
      * remove database_path function and call it directly
      
      * remove helper functions, use consts
      d5565600
    • Jim Posen's avatar
      Integrate Wasmtime for runtime execution (#3869) · c2975363
      Jim Posen authored
      * executor: Use non wasmi-specific execution in tests.
      
      * executor: Move all runtime execution tests into tests file.
      
      * executor: Use test_case macro to easily execute tests with different
      Wasm execution methods.
      
      * executor: Convert errors to strings with Display, not Debug.
      
      * node-executor: Rewrite benchmarks with criterion.
      
      They were not passing compilation before and criterion seems to be more
      widely used in Substrate.
      
      * executor: Begin implementation of Wasm runtime.
      
      The implementation demonstrates the outline of the execution, but does
      not link against the external host functions.
      
      * executor: Define and implement basic FunctionExecutor.
      
      The SandboxCapabilities::invoke is still left unimplemented.
      
      * executor: Implement host function trampoline generation.
      
      * executor: Instantiate and link runtime module to env module.
      
      * executor: Provide input data during wasmtime execution.
      
      * executor: Implement SandboxCapabilites::invoke for wasmtime executor.
      
      * executor: Integrate and test wasmtime execution method.
      
      * executor: Improve FunctionExecution error messages.
      
      * Scope the unsafe blocks to be smaller.
      
      * Rename TrampolineState to EnvState.
      
      * Let EnvState own its own compiler instead of unsafe lifetime cast.
      
      * Refactor out some common wasmi/wasmtime logic.
      
      * Typos and cosmetic changes.
      
      * More trampoline comments.
      
      * Cargo.lock update.
      
      * cli: CLI option for running Substrate with compiled Wasm execution.
      
      * executor: Switch dependency from fork to official wasmtime repo.
      
      * Quiet down cranelift logs.
      
      * Explicitly catch panics during host calls.
      
      We do this to ensure that panics do not cross language boundaries.
      
      * Additional checks and clarifications in make_trampoline.
      
      * Fixes after merge from master and panic safety for wasmtime
      instantiation.
      c2975363
  4. Oct 31, 2019
    • Pierre Krieger's avatar
      Add the code for compiling node-cli for WASM-browser (#3974) · afc63040
      Pierre Krieger authored
      
      
      * Extract CLI to separate module in node/cli
      
      * Make node/cli compile for WASM
      
      * More work on node/cli browser
      
      * More work on browser node
      
      * More work
      
      * More work
      
      * Purge a bit the CI script
      
      * More clean up
      
      * Remove substrate-finality-grandpa from the CI
      
      Its tests use tokio, which fails to compile.
      
      * Address review
      
      * Add rocksdb feature to the service
      
      * Fix substrate-service WASM CI
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Don't WASM-compile substrate-service altogether
      afc63040
  5. Oct 30, 2019
  6. Oct 29, 2019
  7. Oct 23, 2019
  8. Oct 22, 2019
  9. Oct 17, 2019
  10. Oct 12, 2019
  11. Oct 09, 2019
  12. Oct 08, 2019
    • Jim Posen's avatar
      Refactor NativeExecutor to support multiple Wasm execution methods (#3677) · 607d7e83
      Jim Posen authored
      * executor: Move definitions of externals out of wasm_executor module.
      
      * executor: Create WasmRuntime trait.
      
      This will be used to decouple the runtime cache from wasmi execution.
      
      * executor: Remove WasmExecutor and move methods to wasmi_execution.
      
      These will now be crate-internal functions and there is no need
      for the struct.
      
      * executor: Set default default_heap_pages in NativeExecutor.
      
      * cli: CLI configuration for Wasm execution method.
      
      * executor: Remove wasmi-specific code from wasm_runtime.
      
      * Respond to review comments.
      607d7e83
  13. Oct 06, 2019
  14. Oct 02, 2019
    • DemiMarie-parity's avatar
      Upgrade dependencies whenever “easy” (#3556) · 0cfe7438
      DemiMarie-parity authored
      * Update all dependencies
      
      * Upgrade dependencies whenever “easy”
      
      “easy” means that there are no major changes required.
      
      * Fix build and bump paste dependency to 0.1.6
      
      * Remove dead code
      
      * Re-add = dependency for futures-preview
      
      * Add missing std features for runtime-io
      
      * Remove git dependencies
      
      as updated versions have been published to crates.io
      
      * try to debug bug
      
      * For sr-io, "std" should imply "no_oom" and "no_panic_handler".
      
      Otherwise, rustc complains (correctly) about duplicate lang items.
      
      * Add missing "runtime-io/std" features
      
      * Fix compilation errors
      
      * Prevent duplicate lang items
      
      Rust does not allow duplicate lang items.  When compiled without the
      `std` feature, `sr-io` defines two lang items.  Therefore, `sr-io`
      compiled without `feature = "std"` must not be linked with `std`.
      
      However, `pwasm-utils` and `wasmi-validation` both bring in `std` unless
      compiled with `default-features = "false"`.  This caused a duplicate
      lang item error.  Building both with `default-features = "false"`
      prevents this error.  When building with `feature = "std"`, they should
      both be built with the `std` feature, so this feature needs to be
      explicitly depended on.
      
      * Bump `impl_version`
      
      * Make tests pass
      
      Three tests used 1 less gas than they had previously.
      
      * Try to un-break build
      
      * Add a Cargo.lock file
      
      * Revert offchain code
      
      * Revert "Revert offchain code"
      
      This reverts commit d216d08c
      
      .
      
      * Don’t try to send a body with a GET request
      
      without adding a Transfer-Encoding or Content-Length header.
      
      This has always been wrong, but hyperium/hyper#1925 hid the bug until
      hyper was upgraded to 0.12.35.
      
      * Change some more GET requests to POST requests
      
      * Fix excess line width and remove an `extern crate`
      
      * Delete commented-out extern crate
      
      Co-Authored-By: default avatarSergei Pepyakin <[email protected]>
      
      * Fix regression in Cargo.toml files
      
      dev-dependencies need `default-features = false`, too.
      
      * Bump parity-wasm dependency
      
      * Bump `futures-preview`
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Update Cargo.lock files
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Update core/service/src/chain_ops.rs
      
      Co-Authored-By: default avatarSergei Pepyakin <[email protected]>
      0cfe7438
    • Marcio Diaz's avatar
      Optimize tree route to sync faster (#3665) · d7be2906
      Marcio Diaz authored
      * Introduce HeaderMetadata and use it for tree_route. Add lowest_common_ancestor.
      * Add tests.
      d7be2906
  15. Sep 28, 2019
    • Tomasz Drwięga's avatar
      ChainSpec extensions (#3692) · d1401df7
      Tomasz Drwięga authored
      * Add some chainspec tests and make sure we validate it.
      
      * Manual implementation of Extension + Forks definitions.
      
      * Move chain spec to separate crate.
      
      * Allow using ChainSpec with extensions.
      
      * Renames.
      
      * Implement Extension derive.
      
      * Implement Extension for Forks.
      
      * Support specifying fork blocks.
      
      * make for_blocks work
      
      * Support forks correctly.
      
      * Add a bunch of docs.
      
      * Make fork blocks optional.
      
      * Add missing docs.
      
      * Fix build.
      
      * Use struct for check_block params.
      
      * Fix tests?
      
      * Clean up.
      d1401df7
    • André Silva's avatar
      peerset: fix reserved nodes (#3706) · a1836be4
      André Silva authored
      * peerset: fix handling of reserved only peering mode
      
      * core: add cli parameter to enable reserved nodes only
      
      * peerset: fix tests
      
      * peerset: add test for priority only mode
      
      * core: fix reserved only cli flag description
      
      * peerset: extend docs on set_priority_only
      a1836be4
    • André Silva's avatar
      cli: clean up flag descriptions (#3715) · 276838ab
      André Silva authored
      276838ab
  16. Sep 20, 2019
  17. Sep 13, 2019
    • Michael Müller's avatar
      Fixes for allocator + factory + misc improvements (#3534) · ddb8512a
      Michael Müller authored
      
      
      * Clear up import/export misunderstandings
      
      * Fetch minimum period from runtime
      
      * Remove unnecessary comment
      
      This variable is already fetched from the runtime
      in the line below.
      
      * Fix bug in factory
      
      The `best_block_id` stayed the same, it was always the
      genesis hash. This resulted in the factory failing after
      4096 blocks, since `client/db` discards hashes (in this
      case the genesis hash) after 4096 blocks from the database.
      
      * Fix tense in error message
      
      * Improve allocator documentation
      
      * Fix bug in allocator
      
      Under certain circumstances an invalid pointer was
      returned: when the `ptr` was calculated as equal
      to the `max_heap_size`. This is an invalid pointer
      since there is no access allowed after the heap limit.
      
      The way to provoke this was to repeatedly allocate
      with sizes which were previously not allocated and
      immediately deallocate right afterwards. What this
      did was to increment the `bumper` with each allocation,
      whilst keeping the `total_size` of the heap `0`.
      If this repeated allocation/deallocation scheme resulted
      in `max_heap_size == ptr` the `ptr` was still returned.
      
      The allocator only checked if the `total_size` was
      still within the `max_heap_size` limits, and not
      if the resulting `ptr` was still within the valid
      heap region.
      
      This commit introduces a check to validate if the
      calculated `ptr` is within the heap.
      
      * Add test for zero byte allocation and document behavior
      
      * Improve code readability by introducing a const
      
      * Fix error message in test
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Fix code review suggestions
      
      * Replace early return with assertion
      
      * Remove test for zero size allocations
      
      * Shorten test code
      
      * Shorten comment
      
      * Make bump() return Result
      
      * Add comment for bump()
      
      * Remove ambiguous comment
      
      * Replace value with const
      
      * Use proof for panic message
      
      * Fix merge
      
      * Add comment regarding minimum allocation size
      ddb8512a
  18. Sep 12, 2019
  19. Aug 30, 2019
    • Benjamin Kampmann's avatar
      Remove `client.backend` (#2960) · 409f5aa1
      Benjamin Kampmann authored
      
      
      * generalize tree_root to remove client.backend dependency
      
      * replace client.backend.blockchain.header with client.header
      
      * move used_state_cache_size into client info
      
      * Create intermediate Setup State. Fixes #1134
      
      * remove client.backend from finality proof
      
      * update node-template
      
      * move memory backend into test helper mode
      
      * move test helper into client
      
      * starting the big refactor, remove unused functions
      
      * apply_finality
      
      * apply_finality
      
      * replacing more .backend from environment with client directly
      
      * remove .backend from grandpa by using traits
      
      * remove .backend from babe
      
      * remove .backend from tests where it is not needed
      
      * remove .backend from tests
      
      * fixing tests
      
      * fixing tests
      
      * fixing more tests
      
      * fixing tests
      
      * fix all forks test
      
      * fix style
      
      * fixing unnecessary allocation
      
      * remove old test.
      
      * fix service docs
      
      * apply suggestion
      
      * minor clean ups
      
      * turns out the test-helper features actually is being used!
      
      * fixing line length.
      
      * fix line length
      
      * minor cleaning
      
      * Apply suggestions from code review
      
      thanks, @Basti
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * address grumbles
      
      * simplify finalize block on client
      
      * move block back into inner function
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarDemiMarie-parity <[email protected]>
      
      * use as.ref instead of match
      
      * Update core/client/src/backend.rs
      
      Co-Authored-By: default avatarDemiMarie-parity <[email protected]>
      409f5aa1
  20. Aug 27, 2019
    • Pierre Krieger's avatar
      Service factory refactor (#3382) · d14e727b
      Pierre Krieger authored
      * Move Service::new to a macro
      
      * Move function calls to macros
      
      * Extract offchain_workers and start_rpc in separate function
      
      In follow-up commits, we want to be able to directly call maintain_transaction_pool, offchain_workers, and start_rpc, without having to implement the Components trait.
      This commit is a preliminary step: we extract the code to freestanding functions.
      
      * Introduce an AbstractService trait
      
      * Introduce NewService as an implementation detail of Service
      
      * Implement traits on NewService instead
      
      Instead of implementing AbstractService, Future, and Executor on Service, we implement them on NewService instead.
      
      The implementations of AbstractService, Future, and Executor on Service still exist, but they just wrap to the respective implementations for NewService.
      
      * Move components creation back to macro invocation
      
      Instead of having multiple $build_ parameters passed to the macro, let's group them all into one.
      
      This change is necessary for the follow-up commits, because we are going to call new_impl! only after all the components have already been built.
      
      * Add a $block parameter to new_impl
      
      This makes it possible to be explicit as what the generic parameter of the NewServiceis, without relying on type inference.
      
      * Introduce the ServiceBuilder struct
      
      Introduces a new builder-like ServiceBuilder struct that creates a NewService.
      
      * Macro-ify import_blocks, export_blocks and revert_chain
      
      Similar to the introduction of new_impl!, we extract the actual code into a macro, letting us get rid of the Components and Factory traits
      
      * Add export_blocks, import_blocks and revert_chain methods on ServiceBuilder
      
      Can be used as a replacement for the chain_ops::* methods
      
      * Add run_with_builder
      
      Instead of just run, adds run_with_builder to ParseAndPrepareExport/Import/Revert. This lets you run these operations with a ServiceBuilder instead of a ServiceFactory.
      
      * Transition node and node-template to ServiceBuilder
      
      * Transition transaction-factory to the new service factory
      
      This is technically a breaking change, but the transaction-factory crate is only ever used from within substrate-node, which this commit updates as well.
      
      * Remove old service factory
      
      * Adjust the AbstractService trait to be more usable
      
      We slightly change the trait bounds in order to make all the methods usable.
      
      * Make substrate-service-test compile
      
      * Fix the node-cli tests
      
      * Remove the old API
      
      * Remove the components module
      
      * Fix indentation on chain_ops
      
      * Line widths
      
      * Fix bad line widths commit
      
      * Line widths again 🤦
      
      
      
      * Fix the sync test
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarGavin Wood <[email protected]>
      
      * Address some concerns
      
      * Remove TelemetryOnConnect
      
      * Remove informant::start
      
      * Update jsonrpc
      
      * Rename factory to builder
      
      * Line widths 😩
      d14e727b
  21. Aug 24, 2019
  22. Aug 16, 2019
    • Tomasz Drwięga's avatar
      Offences reporting and slashing (#3322) · 5d992d80
      Tomasz Drwięga authored
      
      
      * Remove offline slashing logic from staking.
      
      * Initial version of reworked offence module, can report offences
      
      * Clean up staking example.
      
      * Commit SlashingOffence
      
      * Force new era on slash.
      
      * Add offenders in the SlashingOffence trait.
      
      * Introduce the ReportOffence trait.
      
      * Rename `Offence`.
      
      * Add on_before_session_ending handler.
      
      * Move offence related stuff under sr-primitives.
      
      * Fix cargo check.
      
      * Import new im-online implementation.
      
      * Adding validator count to historical session storage as it's needed for slash calculations
      
      * Add a comment about offence.
      
      * Add BabeEquivocationOffence
      
      * GrandpaEquivocationOffence
      
      * slash_fraction and fix
      
      * current_era_start_session_index
      
      * UnresponsivnessOffence
      
      * Finalise OnOffenceHandler traits, and stub impl for staking.
      
      * slash_fraction doesn't really need &self
      
      * Note that offenders count is greater than 0
      
      * Add a test to ensure that I got the math right
      
      * Use FullIdentification in offences.
      
      * Use FullIndentification.
      
      * Hook up the offences module.
      
      * Report unresponsive validators
      
      * Make sure eras have the same length.
      
      * Slashing and rewards.
      
      * Fix compilation.
      
      * Distribute rewards.
      
      * Supply validators_count
      
      * Use identificationTuple in Unresponsivness report
      
      * Fix merge.
      
      * Make sure we don't slash if amount is zero.
      
      * We don't return an error from report_offence anymo
      
      * We actually can use vec!
      
      * Prevent division by zero if the reporters is empty
      
      * offence_forces_new_era/nominators_also_get_slashed
      
      * advance_session
      
      * Fix tests.
      
      * Update srml/staking/src/lib.rs
      
      Co-Authored-By: default avatarRobert Habermeier <[email protected]>
      
      * slashing_performed_according_exposure
      
      * Check that reporters receive their slice.
      
      * Small clean-up.
      
      * invulnerables_are_not_slashed
      
      * Minor clean ups.
      
      * Improve docs.
      
      * dont_slash_if_fraction_is_zero
      
      * Remove session dependency from offences.
      
      * Introduce sr-staking-primitives
      
      * Move offence under sr_staking_primitives
      
      * rename session_index
      
      * Resolves todos re using SessionIndex
      
      * Fix staking tests.
      
      * Properly scale denominator.
      
      * Fix UnresponsivnessOffence
      
      * Fix compilation.
      
      * Tests for offences.
      
      * Clean offences tests.
      
      * Fix staking doc test.
      
      * Bump spec version
      
      * Fix aura tests.
      
      * Fix node_executor
      
      * Deposit an event on offence.
      
      * Fix compilation of node-runtime
      
      * Remove aura slashing logic.
      
      * Remove HandleReport
      
      * Update docs for timeslot.
      
      * rename with_on_offence_fractions
      
      * Add should_properly_count_offences
      
      * Replace ValidatorIdByIndex with CurrentElectedSet
      
      ValidatorIdByIndex was querying the current_elected set in each call, doing loading (even though its from cache), deserializing and cloning of element.
      
      Instead of this it is more efficient to use `CurrentElectedSet`. As a small bonus, the invariant became a little bit easier: now we just rely on the fact that `keys` and `current_elected` set are of the same length rather than relying on the fact that `validator_id_by_index` would work similar to `<[T]>::get`.
      
      * Clarify babe equivocation
      
      * Fix offences.
      
      * Rename validators_count to validator_set_count
      
      * Fix squaring.
      
      * Update core/sr-staking-primitives/src/offence.rs
      
      Co-Authored-By: default avatarGavin Wood <[email protected]>
      
      * Docs for CurrentElectedSet.
      
      * Don't punish only invulnerables
      
      * Use `get/insert` instead of `mutate`.
      
      * Fix compilation
      
      * Update core/sr-staking-primitives/src/offence.rs
      
      Co-Authored-By: default avatarGavin Wood <[email protected]>
      
      * Update srml/offences/src/lib.rs
      
      Co-Authored-By: default avatarRobert Habermeier <[email protected]>
      
      * Update srml/im-online/src/lib.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update srml/im-online/src/lib.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update srml/im-online/src/lib.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update srml/babe/src/lib.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update core/sr-staking-primitives/src/offence.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update core/sr-staking-primitives/src/offence.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update core/sr-staking-primitives/src/offence.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update core/sr-staking-primitives/src/offence.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Update core/sr-staking-primitives/src/offence.rs
      
      Co-Authored-By: default avatarjoe petrowski <[email protected]>
      
      * Add aura todo.
      
      * Allow multiple reports for single offence report.
      
      * Fix slash_fraction calculation.
      
      * Fix typos.
      
      * Fix compilation and tests.
      
      * Fix staking tests.
      
      * Update srml/im-online/src/lib.rs
      
      Co-Authored-By: default avatarLogan Saether <[email protected]>
      
      * Fix doc on time_slot
      
      * Allow slashing only on current era (#3411)
      
      * only slash in current era
      
      * prune journal for last era
      
      * comment own_slash
      
      * emit an event when old slashing events are discarded
      
      * Pave the way for pruning
      
      * Address issues.
      
      * Try to refactor collect_offence_reports
      
      * Other fixes.
      
      * More fixes.
      5d992d80
  23. Aug 12, 2019
  24. Aug 11, 2019
    • Pierre Krieger's avatar
      Refactor parse_and_execute (#3358) · e0f5dd9f
      Pierre Krieger authored
      
      
      * Refactor `parse_and_execute`
      
      Adds a new function named `parse_and_prepare`, which prepares the environment and parses the command.
      Contrary to `parse_and_execute`, `parse_and_prepare` returns a struct that permis the user to execute the command, as opposed to execute it itself.
      
      `parse_and_execute` has been modified to use `parse_and_prepare` internally.
      
      * Embed dispatch functions directly into run()
      
      After the previous commit, we now have a lot of functions whose only one is to call other functions. And these other functions are called only from one location.
      Let's merge these two for clarity.
      
      * Deprecate parse_and_execute and replace it in node and node-template
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      e0f5dd9f
    • Gavin Wood's avatar
      Scale trait and move to u32 blocknumbers (#3357) · 087c3cf6
      Gavin Wood authored
      
      
      * Scale trait and move to u32 blocknumbers.
      
      * Fixes
      
      * Cleanups
      
      * Update node/runtime/src/lib.rs
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Fix up some of the factory stuff.
      
      * Update core/sr-primitives/src/traits.rs
      
      Co-Authored-By: default avatarShawn Tabrizi <[email protected]>
      
      * Move Nonce/Index to u32 (#3361)
      
      * Force a non-borked version of upstream crate
      
      * Line lengths and runtime version bump
      087c3cf6
  25. Aug 09, 2019
  26. Aug 08, 2019