1. Nov 01, 2019
    • 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
  2. Oct 31, 2019
  3. Oct 30, 2019
  4. Oct 29, 2019
    • André Silva's avatar
      node: add sentry mode flag (#3959) · 893909d0
      André Silva authored
      * node: add sentry mode flag
      
      * cli: extend docs on validator and sentry modes
      
      * service: add missing field in test Configuration
      
      * node: Display instead of Debug when printing node role
      893909d0
    • André Silva's avatar
      grandpa: fix handling of catch-up requests (#3956) · 0ac702e6
      André Silva authored
      * grandpa: fix handling of catch-up requests
      
      * grandpa: fix tests
      
      * grandpa: add test for catch-up handling when observer disabled
      
      * grandpa: extend doc comment
      
      * grandpa: rename existing catch up test
      0ac702e6
  5. Oct 28, 2019
    • Kian Paimani's avatar
      Updates to elections-phragmen and some runtime docs. (#3940) · 33e56523
      Kian Paimani authored
      * minor changes
      
      * Refactors for phragmen-election
      
      * Bump.
      
      * Fix genesis stuff
      
      * Fix rest of the errors
      33e56523
    • Max Inden's avatar
      *: Disable authority discovery module (#3914) · 5c505d19
      Max Inden authored
      The authority discovery module enables authorities to be discoverable
      and discover other authorities to improve interconnection among them. In
      order to achieve this the module needs to know when the authority set
      changes, thus when a session changes.
      
      One has to register a module as a *session handler* in order for it to
      be notified of changing sessions. The order and number of these *session
      handlers* **MUST** correspond to the order and number of the *session
      keys*.
      
      Commit 7fc21cea added the authority discovery to the `SessionHandlers`.
      Given that the authority discovery module piggybacks on the Babe session
      keys the commit violated the above constraint.
      
      This commit reverts most of 7fc21cea, leaving `core/authority-discovery`
      and `srml/authority-discovery` untouched.
      5c505d19
  6. Oct 27, 2019
  7. Oct 24, 2019
    • thiolliere's avatar
      Fix treasury kept and spend when emptied (#3880) · 81618967
      thiolliere authored
      * Now construct_runtime must include treasury config so account is created at genesis.
      * if it doesn't though it is ok, account will be created when the amount put is more than existential deposit.
      81618967
    • Pierre Krieger's avatar
      Service builder clean-up (#3906) · fa7864e7
      Pierre Krieger authored
      * Rename NewService to Service
      
      * Move new_impl! macro to builder module
      
      * Inline new_impl!
      
      * Minor cleanup
      
      * Inline the offchain_workers() function
      
      * Fix indentation level
      
      * Inline start_rpc
      
      * Remove RpcBuilder trait
      fa7864e7
    • Gavin Wood's avatar
      Add SECP256k1/ECDSA support for transaction signing (#3861) · cc0b1d08
      Gavin Wood authored
      
      
      * Add SECP256k1/ECDSA support for transaction signing.
      
      * Refactoring and fixes
      
      * Fix for contracts
      
      * Avoid breaking runtime host function
      
      * Build fixes, make subkey work more generaically.
      
      * Fix tests
      
      * Dedpulicate a bit of code, remove unneeded code, docs
      
      * Bump runtime version
      
      * Fix a test and clean up some code.
      
      * Derivation can derive seed.
      
      * Whitespace
      
      * Bump runtime again.
      
      * Update core/primitives/src/crypto.rs
      
      Co-Authored-By: default avatarKian Paimani <[email protected]>
      
      * Update core/primitives/src/ecdsa.rs
      
      Co-Authored-By: default avatarKian Paimani <[email protected]>
      
      * Fix AppVerify
      cc0b1d08
    • André Silva's avatar
      node: spawn grandpa voter as essential task (#3899) · a1226ebd
      André Silva authored
      * node: spawn grandpa voter as essential task
      
      * node: stop babe authoring task on exit
      
      * node: remove unnecessary future boxing
      
      * Apply suggestions from code review
      a1226ebd
  8. Oct 23, 2019
  9. Oct 18, 2019
    • André Silva's avatar
      grandpa: pluggable voting rules (#3673) · 4f25b470
      André Silva authored and asynchronous rob's avatar asynchronous rob committed
      * grandpa: support pluggable custom voting rules
      
      * grandpa: add docs to grandpa voting rule
      
      * grandpa: make voting rule mandatory
      
      * grandpa: add test for voting rule
      
      * node: add GRANDPA voting rule
      
      * grandpa: pass backend to VotingRule
      
      * core: fix docs in SelectChain::finality_target
      
      * grandpa: implement 3/4 of unfinalized chain restriction as voting rule
      
      * grandpa: rename AlwaysBehindBestBlock voting rule
      
      * grandpa: fix tests
      
      * grandpa: remove useless test
      
      * grandpa: extend environemnt voting rule test
      
      * grandpa: add proofs to unreachable statements
      
      * grandpa: fix typo
      
      * grandpa: fix docs
      4f25b470
  10. Oct 17, 2019
    • Kian Paimani's avatar
      refactor: Transaction-Payment module (#3816) · df1582be
      Kian Paimani authored
      * Initial draft that compiles
      
      * Extract payment stuff from balances
      
      * Extract multiplier update stuff from system
      
      * Some fixes.
      
      * Update len-fee as well
      
      * some review comments.
      
      * Remove todo
      
      * bump
      df1582be
  11. Oct 12, 2019
  12. 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
  13. Oct 01, 2019
  14. 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
  15. Sep 27, 2019
  16. Sep 24, 2019
  17. Sep 23, 2019
    • asynchronous rob's avatar
      Fixing BABE epochs to change between blocks (#3583) · 426c26b8
      asynchronous rob authored
      
      
      * always fetch epoch from runtime
      
      * node integration tests don't test light nodes
      
      * give stand-in full node a FULL role
      
      * rejig babe APIs
      
      * introduce next-epoch-descriptor type
      
      * overhaul srml-BABE epoch logic
      
      * ensure VRF outputs end up in the right epoch-randomness
      
      * rewrite `do_initialize` to remove unnecessary loop
      
      * begin accounting for next epoch in epoch function
      
      * slots passes header to epoch_data
      
      * pass slot_number to SlotWorker::epoch_data
      
      * begin extracting epoch-change logic into its own module
      
      * aux methods for block weight
      
      * aux methods for genesis configuration
      
      * comment-out most, refactor header-check pipeline
      
      * mostly flesh out verifier again
      
      * reinstantiate babe BlockImport implementation
      
      * reinstate import-queue instantiation
      
      * reintroduce slot-worker implementation
      
      * reinstate pretty much all the rest
      
      * move fork-choice logic to BlockImport
      
      * fix some, but not all errors
      
      * patch test-runtime
      
      * make is_descendent of slightly more generic
      
      * get skeleton compiling when passing is_descendent_of
      
      * make descendent-of-builder more succinct
      
      * restore ordering of authority_index / slot_number
      
      * start fiddling with tests
      
      * fix warnings
      
      * improve initialization architecture and handle genesis
      
      * tests use correct block-import
      
      * fix BABE tests
      
      * fix some compiler errors
      
      * fix node-cli compilation
      
      * all crates compile
      
      * bump runtime versions and fix some warnings
      
      * tweak fork-tree search implementation
      
      * do backtracking search in fork-tree
      
      * node-cli integration tests now work
      
      * fix broken assumption in test_connectivity
      
      * babe tests fail for the right reasons.
      
      * test genesis epoch logic for epoch_changes
      
      * test that epochs can change between blocks
      
      * First BABE SRML test
      
      * Testing infrastructure for BABE
      
      Also includes a trivial additional test.
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * A little more test progress
      
      * More work on BABE testing
      
      * Try to get the tests working
      
      * Implement `UintAuthorityId`-based test mocks
      
      * Fix compilation errors
      
      * Adjust to upstream changes
      
      * Block numbers are ignored in BABE epoch calculation
      
      * authority_index() should ignore invalid authorities
      
      * Fix compile error
      
      * Add tests that session transitions happen
      
      * Check if BABE produces logs
      
      It currently does not.
      
      * Fix test suite
      
      This was really nasty, due to a type confusion that showed up as an
      off-by-1 buffer error.
      
      * Add additional tests
      
      Most of these were derived from the current output, so they are only
      useful to guard against regressions.
      
      * Make the tests more readable
      
      Also bump impl_version.
      
      * Fix excessive line width
      
      * Remove unused imports
      
      * Update srml/babe/src/lib.rs
      
      Co-Authored-By: default avatarAndré Silva <[email protected]>
      
      * try to fix imports
      
      * Fix build errors in test suite
      
      * tests did not pass
      
      * Try to get at least one digest to be output
      
      Currently, the code emits either no digests (if I don’t call
      `Session::rotate_session()` or two digests (if I do), which is wrong.
      
      * More tests
      
      They still don’t work, but this should help debugging.
      
      * fix silly error
      
      * Don’t even try to compile a broken test
      
      * remove broken check_epoch test and add one for genesis epoch
      
      * Check that the length of the pre-digests is correct
      
      * Bump `impl_version`
      
      * use epoch_for_descendent_of even for genesis
      
      * account for competing block 1s
      
      * finish srml-babe docs
      
      Co-Authored-By: default avatarAndré Silva <[email protected]>
      
      * address grumbles
      426c26b8
  18. Sep 20, 2019
  19. Sep 17, 2019
  20. Sep 13, 2019
    • Tomasz Drwięga's avatar
      RPC call to get all RPC methods (#3613) · 6d48cce2
      Tomasz Drwięga authored
      * Add meta rpc_methods call.
      
      * Sort methods.
      
      * Bump runtime.
      
      * Change format a bit to support versioning.
      6d48cce2
    • 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
  21. Sep 12, 2019
  22. Sep 10, 2019
  23. Sep 06, 2019
    • Max Inden's avatar
      core/authority-discovery: Enable authorities to discover each other (#3452) · 7fc21cea
      Max Inden authored
      With the *authority-discovery* module an authoritative node makes itself
      discoverable and is able to discover other authorities. Once discovered, a node
      can directly connect to other authorities instead of multi-hop gossiping
      information.
      
      1. **Making itself discoverable**
      
          1. Retrieve its external addresses
      
          2. Adds its network peer id to the addresses
      
          3. Sign the above
      
          4. Put the signature and the addresses on the libp2p Kademlia DHT
      
      2. **Discovering other authorities**
      
          1. Retrieve the current set of authorities
      
          2. Start DHT queries for the ids of the authorities
      
          3. Validate the signatures of the retrieved key value pairs
      
          4. Add the retrieved external addresses as ~reserved~ priority nodes to the
             peerset
      
      
      * node/runtime: Add authority-discovery as session handler
      
      The srml/authority-discovery module implements the OneSessionHandler in
      order to keep its authority set in sync. This commit adds the module to
      the set of session handlers.
      
      * core/network: Make network worker return Dht events on poll
      
      Instead of network worker implement the Future trait, have it implement
      the Stream interface returning Dht events.
      
      For now these events are ignored in build_network_future but will be
      used by the core/authority-discovery module in subsequent commits.
      
      * *: Add scaffolding and integration for core/authority-discovery module
      
      * core/authority-discovery: Implement module logic itself
      7fc21cea
  24. Sep 04, 2019
    • Bastian Köcher's avatar
      Custom runtime module errors (#3433) · 5420de3f
      Bastian Köcher authored
      
      
      * srml-system checks
      
      * wip
      
      * more modules compiles
      
      * node-runtime checks
      
      * build.sh passes
      
      * include dispatch error in failed event
      
      * revert some unnecessary changes
      
      * refactor based on comments
      
      * more compile error fixes
      
      * avoid unnecessary into
      
      * reorder code
      
      * fixes some tests
      
      * manually implement encode & decode to avoid i8 workaround
      
      * more test fixes
      
      * more fixes
      
      * more error fixes
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarTomasz Drwięga <[email protected]>
      
      * address comments
      
      * test for DispatchError encoding
      
      * tyep alias for democracy
      
      * make error printable
      
      * line width
      
      * fix balances tests
      
      * fix executive test
      
      * fix system tests
      
      * bump version
      
      * ensure consistent method signature
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarGavin Wood <[email protected]>
      
      * changes based on review
      
      * Add issue number for TODOs
      
      * fix
      
      * line width
      
      * fix test
      
      * Update core/sr-primitives/src/lib.rs
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Update core/sr-primitives/src/traits.rs
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Update srml/council/src/motions.rs
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * Update srml/council/src/motions.rs
      
      Co-Authored-By: default avatarBastian Köcher <[email protected]>
      
      * update based on review
      
      * More concrete macro matching
      
      * fix test build issue
      
      * Update hex-literal dependency version. (#3141)
      
      * Update hex-literal dep version.
      
      * Update lock file.
      
      * Start to rework the new error handling
      
      * More work to get it back compiling
      
      * Start to fix after master merge
      
      * The great transaction error handling refactoring
      
      * Make `decl_error` errors convertible to `&'static str`
      
      * Make srml-executive build again
      
      * Fix `sr-primitives` tests
      
      * More fixes
      
      * Last round of fix ups
      
      * Fix build
      
      * Fix build
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarTomasz Drwięga <[email protected]>
      
      * Rename some stuff
      
      * Fixes after master merge
      
      * Adds `CheckBlockGasLimit` signed extension
      
      * Remove debug stuff
      
      * Fix srml-balances test
      
      * Rename `InvalidIndex` to `CannotLookup`
      
      * Remove weird generic parameters
      
      * Rename function again
      
      * Fix import
      
      * Document the signed extension
      
      * Change from `Into` to `From`
      
      * Update srml/contracts/src/lib.rs
      
      Co-Authored-By: default avatarSergei Pepyakin <[email protected]>
      
      * Fix compilation
      
      * Update srml/contracts/src/lib.rs
      
      Co-Authored-By: default avatarTomasz Drwięga <[email protected]>
      
      * Update core/sr-primitives/src/transaction_validity.rs
      
      Co-Authored-By: default avatarTomasz Drwięga <[email protected]>
      
      * Remove unused code
      
      * Fix compilation
      
      * Some cleanups
      
      * Fix compile errors
      
      * Make `TransactionValidity` a `Result`
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarGavin Wood <[email protected]>
      
      * Beautify the code a little bit and fix test
      
      * Make `CannotLookup` an inherent error declared by `decl_error!`
      
      * Adds some documentation
      
      * Make `ApplyOutcome` a result
      
      * Up the spec_version
      
      * Apply suggestions from code review
      
      Co-Authored-By: default avatarGavin Wood <[email protected]>
      Co-Authored-By: default avatarDemiMarie-parity <[email protected]>
      5420de3f
  25. Sep 01, 2019