Commit Graph

11 Commits

Author SHA1 Message Date
Benjamin Kampmann d3208aa7bc Better wasm instance cache (#5109)
* Wasm instance cache

* Reduce slot locking

* Fixed test

* Dispose of instance in case of error

* Fixed benches

* Style, comments, some renames

* Replaced upgradable lock with mutex

* Bump dependencies

* Re-export CallInWasm

* Update client/executor/src/wasm_runtime.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/executor/src/native_executor.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/executor/src/native_executor.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/executor/src/wasm_runtime.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/executor/wasmtime/src/runtime.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/executor/src/wasm_runtime.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/executor/src/wasm_runtime.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/executor/src/wasm_runtime.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Indents

* Whitespace

* Formatting

* Added issue link

Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-03-05 14:02:04 +01:00
Arkadiy Paronyan 9a1b3b53f2 Revert "Don't include :code by default in storage proofs (#5060)" (#5136)
This reverts commit 6ee39261c8.
2020-03-05 10:55:05 +01:00
Benjamin Kampmann 5a33228ea9 Reduce usage of Blake2Hasher (#5132)
This reduces the usage of `Blake2Hasher` in the code base and replaces
it with `BlakeTwo256`. The most important change is the removal of the
custom extern function for `Blake2Hasher`. The runtime `Hash` trait is
now also simplified and directly requires that the implementing type
implements `Hashable`.
2020-03-05 08:51:03 +01:00
Benjamin Kampmann 6ee39261c8 Don't include :code by default in storage proofs (#5060)
* Adds test to verify that the runtime currently is always contained in
the proof

* Start passing the runtime wasm code from the outside

* Fix compilation

* More build fixes

* Make the test work as expected now :)

* Last fixes

* Fixes benchmarks

* Review feedback

* Apply suggestions from code review

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

* Review feedback

* Fix compilation

Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>
2020-03-04 20:26:16 +01:00
Gavin Wood afa5861f3b Lazy reaping (#4895)
* Squash and rebase from gav-lazy-reaping

* Bump version

* Bump runtime again

* Docs.

* Remove old functions

* Update frame/balances/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/contracts/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Warnings

* Bump runtime version

* Update frame/democracy/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/system/src/lib.rs

* Clean up OnReapAccount

* Use frame_support debug

* Bump spec

* Renames and fix

* Fix

* Fix rename

* Fix

* Increase time for test

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
2020-02-24 18:04:42 +01:00
Kian Paimani b368736be4 Unsigned transactions should also note weight (#4998)
* Make unsigned also note weight

* Bump.

* Fix tests

* Better fee test

* Fix another test

* Update lock file
2020-02-20 16:46:11 +01:00
Gavin Wood 5b7512e2e4 Composite accounts (#4820)
* Basic account composition.

* Add try_mutate_exists

* De-duplicate

* Refactor away the UpdateBalanceOutcome

* Expunge final UpdateBalanceOutcome refs

* Refactor transfer

* Refactor reservable currency stuff.

* Test with the alternative setup.

* Fixes

* Test with both setups.

* Fixes

* Fix

* Fix macros

* Make indices opt-in

* Remove CreationFee, and make indices opt-in.

* Fix construct_runtime

* Fix last few bits

* Fix tests

* Update trait impls

* Don't hardcode the system event

* Make tests build and fix some stuff.

* Pointlessly bump runtime version

* Fix benchmark

* Another fix

* Whitespace

* Make indices module economically safe

* Migrations for indices.

* Fix

* Whilespace

* Trim defunct migrations

* Remove unused storage item

* More contains_key fixes

* Docs.

* Bump runtime

* Remove unneeded code

* Fix test

* Fix test

* Update frame/balances/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Fix ED logic

* Repatriate reserved logic

* Typo

* Fix typo

* Update frame/system/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/system/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Last few fixes

* Another fix

* Build fix

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2020-02-14 00:47:51 +00:00
Gavin Wood d52d8692f9 Refactor the balances module (#4649)
* Initially scoping out of the problem

* Remove need for exiry in balance locks.

* Remove expiry from locks.

* Remove supefluous balance test

* Amalgamate pieces of balance module

* Split out vesting

* Fix tests

* Fixes for vesting.

* Docs.

* Weight docs.

* Refactor things in terms of set_balances.

* Switch out ED to be free + reserved.

* Remove on_free_balance_zero and some docs.

* Build fixes

* Update frame/vesting/src/lib.rs

Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com>

* Update frame/vesting/src/lib.rs

Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com>

* Migration

* Remove superfluous code.

* Test fixes

* Fix some tests

* Fix repatriate reserve

* Fixes

* Add test for migration

* Final cleanups

* Fix

* Indentation.

* Undo unneeded referencing

* Bump runtime version

* Fixes

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
2020-02-01 13:20:16 +00:00
Sergei Pepyakin 9a77b299df Add fool protection and comment construct_block (#4715)
* Add fool protection and comment construct_block

* Update bin/node/executor/tests/common.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-01-22 18:34:41 +01:00
Bastian Köcher fd6b29dd2c Remove requirement on Hash = H256, make Proposer return StorageChanges and Proof (#3860)
* Extend `Proposer` to optionally generate a proof of the proposal

* Something

* Refactor sr-api to not depend on client anymore

* Fix benches

* Apply suggestions from code review

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Apply suggestions from code review

* Introduce new `into_storage_changes` function

* Switch to runtime api for `execute_block` and don't require `H256`
anywhere in the code

* Put the `StorageChanges` into the `Proposal`

* Move the runtime api error to its own trait

* Adds `StorageTransactionCache` to the runtime api

This requires that we add `type NodeBlock = ` to the
`impl_runtime_apis!` macro to work around some bugs in rustc :(

* Remove `type NodeBlock` and switch to a "better" hack

* Start using the transaction cache from the runtime api

* Make it compile

* Move `InMemory` to its own file

* Make all tests work again

* Return block, storage_changes and proof from Blockbuilder::bake()

* Make sure that we use/set `storage_changes` when possible

* Add test

* Fix deadlock

* Remove accidentally added folders

* Introduce `RecordProof` as argument type to be more explicit

* Update client/src/client.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update primitives/state-machine/src/ext.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Integrates review feedback

* Remove `unsafe` usage

* Update client/block-builder/src/lib.rs

Co-Authored-By: Benjamin Kampmann <ben@gnunicorn.org>

* Update client/src/call_executor.rs

* Bump versions

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
2020-01-10 10:48:32 +01:00
Tomasz Drwięga 74d6e660c6 Add documentation to SubmitSignedTransaction and actually make it work (#4200)
* Add documentation to signed transactions and actually make them work.

* Fix naming and bounds.

* Forgotten import.

* Remove warning.

* Make accounts optional, fix logic.

* Split the method to avoid confusing type error message.

* Move executor tests to integration.

* Add submit transactions tests.

* Make `submit_transaction` tests compile

* Remove a file that was accidently committed

* Add can_sign helper function.

* Fix compilation.

* Add a key to keystore.

* Fix the tests.

* Remove env_logger.

* Fix sending multiple transactions.

* Remove commented code.

* Bring back criterion.

* Remove stray debug log.

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Make sure to initialize block correctly.

* Initialize block for offchain workers.

* Add test for transaction validity.

* Fix tests.

* Review suggestions.

* Remove redundant comment.

* Make sure to use correct block number of authoring.

* Change the runtime API.

* Support both versions.

* Bump spec version, fix RPC test.

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-01-10 01:46:55 +01:00