* updated direct dependencies to parity-wasm
* fixed tests and incremented impl_version of the runtime
* update wasmi to 0.5.1 in sr-sandbox, bringing all parity-wasm deps up to 0.40
* 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: Bastian Köcher <bkchr@users.noreply.github.com>
* 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
* Implement support for `patch` section in wasm-builder
* Update core/utils/wasm-builder/src/wasm_project.rs
* Support patch by path
* Go down to the actual data
* Sketch
* Some work on docs.
* Doc improvements.
* More docs.
* Some more docs.
* Yet another comment.
* Bump impl_version.
* Accept the block hash
* Use NumberOrHex
* Update node/rpc/src/contracts.rs
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* Move rpc/primitives
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
* 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: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* 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: Gavin Wood <github@gavwood.com>
* changes based on review
* Add issue number for TODOs
* fix
* line width
* fix test
* Update core/sr-primitives/src/lib.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Update core/sr-primitives/src/traits.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Update srml/council/src/motions.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Update srml/council/src/motions.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* 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: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* 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: Sergei Pepyakin <sergei@parity.io>
* Fix compilation
* Update srml/contracts/src/lib.rs
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* Update core/sr-primitives/src/transaction_validity.rs
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* Remove unused code
* Fix compilation
* Some cleanups
* Fix compile errors
* Make `TransactionValidity` a `Result`
* Apply suggestions from code review
Co-Authored-By: Gavin Wood <gavin@parity.io>
* 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: Gavin Wood <gavin@parity.io>
Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
* 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: Bastian Köcher <bkchr@users.noreply.github.com>
* address grumbles
* simplify finalize block on client
* move block back into inner function
* Apply suggestions from code review
Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
* use as.ref instead of match
* Update core/client/src/backend.rs
Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
* Adds `WASM_TARGET_DIRECTORY` env variable to `wasm-builder`
* Create the `wasm-builder-runner`'s in a common workspace
* Make `wasm-builder` trigger less rebuilds
* Version up
* Adds script for building only the WASM files
* Apply suggestions from code review
Co-Authored-By: André Silva <andre.beat@gmail.com>
Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
* Add ability to supply extra storage in test-client
* Don't use native_equivalent in tests.
* Get rid of native_equivalent
* Try to make fields private
* Apply Basti's suggestions
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* 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: Gavin Wood <i@gavwood.com>
* Address some concerns
* Remove TelemetryOnConnect
* Remove informant::start
* Update jsonrpc
* Rename factory to builder
* Line widths 😩
* introduce some type aliases for round and set-id
* overhaul session "changed" flag and document better
* do_initialize in BABE when getting new session
* grandpa module tracks set IDs
* update runtime versions
* doc comment -> comment
* Include docs fixes from Gav
Co-Authored-By: Gavin Wood <gavin@parity.io>
* some more review changes
* fix srml-grandpa compilation
* Add ability to destroy a contract in the overlay.
* Don't allow contracts to be destroyed in recursive execution.
* Tests for contract self-destruction.
* Don't allow constructor to exit with insufficient balance.
* Remove dead code.
* Bump node runtime spec version.
In order to have authorities (validators) discover each other, they need
to publish their public addresses by their ip address on the Kademlia
Dht indexed by their public key. This payload needs to be signed by a
key identifying them as a valid authority.
Code inside `/core` does not know the current set of authorities nor
can it assume what kind of cryptography primitives are currently in use.
Instead it can retrieve its public key and the current set of
authorities from the runtime and have it sign and verify Dht payloads.
This commit enables code in `/core` to do so by introducing a srml
module and runtime api to:
1. Retrieve own public key.
2. Retrieve public keys of current authority set.
3. Sign a Dht payload.
4. Verify a Dht payload.
This commit makes the logic from the previous commit
(`core/consensus/common/primitives.ConsensusApi`)
cf80af9255 obsolete and thus removes it.
* Introduce srml/scored-pool
* Bump impl_version
* Apply suggestions from code review
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Remove unnecessary pub use
* Remove unnecessary import
* Adapt to InitializeMembers
* Bump impl_version
* Implement remarks (shortens code)
* Improve complexity of score()
Search and remove and search again for the
new spot and insert then => O(2LogN).
* Get rid of a clone()
* Reduce complexity of issue_candidacy()
* Add CandidateScored event + Improve comments
* Fix naming
* Use Lookup instead of AccountId as param
* Use set_members_sorted instead of computing diff
* Remove function which is only used during genesis
* Get rid of rev() by changing sort order of Pool
* Rename issue_candidacy to submit_candidacy
* Shorten code
* Remove find_in_pool() and have transactor submit index
* Remove unnecessary dependency
* Improve error messages
* Improve naming
* Improve comments
* Make code clearer wrt which receiver to invoke
* Adapt to new system trait
* Refactor to request CandidateDeposit only once
* Refactor to request Pool only once
* Improve structure and comments