pscott
046fda914a
Improve overall performance ( #6699 )
...
* Improve overall performance
* Clean up code
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Remove needless ::
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Remove needless ::
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2020-07-21 14:46:49 +02:00
Sergei Pepyakin
0629f999ff
Reuse wasmtime instances, the PR ( #5567 )
...
* Preserve a single wasmtime instance.
* Sketch of wasm instance reusing.
* Refactor and docs.
* Rename state_snapshot to util module.
* Renaming.
* Comments.
* Error handling
* More fixes.
2020-04-08 18:45:25 +02:00
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
Shawn Tabrizi
c7a14db792
Fix various spelling errors ( #4940 )
...
* meaningfull -> meaningful
* initialise -> initialize
* tokans -> tokens
* incentivise -> incentivize
* lenght -> length
* incentivisation -> incentivization
* doesnt't -> doesn't
* overwriten -> overwritten
* lifecycle -> life cycle
* lifecycle -> life cycle
* usefull -> useful
* noone -> no one
* spaming -> spamming
* defered -> deferred
* hieght -> height
* sumation -> summation
* ingore -> ignore
* registed -> registered
* Auxialary -> Auxiliary
* loggin -> logging
* independance -> independence
* trailling -> trailing
* responsability -> responsibility
* trunkated -> truncated
* Weither -> Whether
* informations -> information
* Runtume -> Runtime
* choosen -> chosen
* delcataion -> declaration
* Unchekced -> Unchecked
* defintion -> definition
* scrach -> scratch
* imput -> input
* transfered -> transferred
* endownment -> endowment
* Determinator -> Determiner
* relevent -> relevant
* emited -> emitted
* acocunt -> account
* proprotional -> proportional
* instantiaion -> instantiation
* commited -> committed
* tombstonedead -> tombstone
* uwnrap -> unwrap
* acount -> account
* specialised -> specialized
* existant -> existent
* requried -> required
* Anull -> Annul
* AUTHORITES -> AUTHORITIES
* underyling -> underlying
* recognisable -> recognizable
* Capitalise -> Capitalize
* reportfor -> report for
* hearbeat -> heartbeat
* onlineness -> being online
* creater -> creator
* Bytearray -> Byte array
* Despoit -> Deposit
* substratced -> subtracted
* Curent -> Current
* imbalanes -> imbalances
* countfown -> countdown
* inexisting -> inexistent
* additionaly -> additionally
* substracted -> subtracted
* auxilary -> auxiliary
* parital -> partial
* in't -> isn't
* compatability -> compatibility
* infomation -> information
* etected -> detected
* extrinsiscs -> extrinsics
* reprensentation -> representation
* coonfiguration -> configuration
* primtives -> primitives
* miscelanious -> miscellaneous
* VERISON -> VERSION
* endcoded -> encoded
* Genrates -> Generates
* miliseconds -> milliseconds
* occured -> occurred
* trully -> truely
* truely -> truly
* conjuction -> conjunction
* encouters -> encounters
* customised -> customized
* deterministicly -> deterministically
* finalisation -> finalization
* pluggable -> plugable
* wakeup -> wake-up
* interemdiate -> intermediate
* intepreting -> interpreting
* finalzied -> finalized
* throgh -> through
* extinsic -> extrinsic
* convient -> convenient
* allocater -> allocator
* propagateable -> propagatable
* succesfuly -> successfully
* finalising -> finalizing
* publically -> publicly
* phrasee -> phrase
* substration -> substractions
* substractions -> subtractions
* neccessarily -> necessarily
* Inlucde -> Include
* unefficient -> inefficient
* thay -> they
* funtion -> function
* datastructures -> data structures
* infromation -> information
* propagatable -> propagable
* ecountered -> encountered
* recognise -> recognize
* intergration -> integration
* lastet -> latest
* datatypes -> data types
* datatype -> data type
* Strongarming -> Strong Arming
* avaible -> available
* Commiting -> Committing
* Retreiving -> Retrieving
* shoud -> should
* canonicaliziation -> canonicalization
* comitted -> committed
* clonable -> cloneable
* Uknown -> Unknown
* reponse -> response
* arbitary -> arbitrary
* Capapbilities -> Capabilities
* responsbile -> responsible
* initialisation -> initialization
* cames -> came
* intemediate -> intermediate
* reqeust -> request
* intance -> instance
* explcitly -> explicitly
* neighor -> neighbor
* reolving -> resolving
* untill -> until
* Validte -> Validate
* deserailize -> deserialize
* literaly -> literally
* preceeding -> preceding
* abpve -> above
* chcecked -> checked
* numbet -> number
* Unknow -> Unknown
* halfs -> halves
* gossup -> gossip
* givent -> given
* immediatelly -> immediately
* slicable -> sliceable
* conensus -> consensus
* Mimicks -> Mimics
* acccept -> accept
* serialise -> serialize
* exstrinsics -> extrinsics
* panicks -> panics
* maintaince -> maintenance
* repeatidely -> repeatedly
* anecstor -> ancestor
* becasue -> because
* processer -> processor
* Prunning -> Pruning
* insterested -> interested
* unuseful -> not useful
* yeided -> yielded
* descendfing -> descending
* corresponts -> corresponds
* survivew -> survive
* keps -> keeps
* ligh -> light
* prerequisities -> prerequisites
* positiion -> position
* depedency -> dependency
* extrinisic -> extrinsic
* atomicaly -> atomically
* staticly -> statically
* resul -> result
* timestamb -> timestamp
* Utilites -> Utilities
* ammount -> amount
* pocess -> process
* exteral -> external
* Update client/finality-grandpa/src/tests.rs
* Update primitives/io/src/lib.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update primitives/blockchain/src/lib.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update frame/support/src/weights.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update bin/node/cli/tests/common.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update client/api/src/execution_extensions.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update client/cli/src/params.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update client/executor/common/src/sandbox.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update client/api/src/execution_extensions.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update client/finality-grandpa/src/communication/mod.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update client/state-db/src/pruning.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update frame/contracts/src/tests.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
* Update client/api/src/execution_extensions.rs
* bump impl
* timestamb -> timestamp
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com >
2020-02-17 15:07:24 +01:00
Bastian Köcher
d3fa8c91af
Adds a test to ensure that we clear the heap between calls into runtime ( #4903 )
...
* Adds a test to ensure that we clear the heap between calls into runtime
The tests shows that we currently not clearing the heap in wasmtime.
For now we don't run the test for wasmtime.
* Fix compilation
2020-02-14 01:42:27 +01:00
Sergei Pepyakin
49af986ad4
executor: Migrate wasmtime backend to a high-level API ( #4686 )
...
* Migrate wasmtime backend to wasmtime-api
* Port to a newer version of wasmtime
* Update to the latest changes.
* Rejig the sandbox module a bit
* Materialze
* Fixes.
* executor wasm_runtime fix
* Refactor everything
* More refactoring
* Even more refactorings
* More cleaning.
* Update to the latest wasmtime
* Reformat
* Renames
* Refactoring and comments.
* Docs
* Rename FunctionExecutor to host.
* Imrpove docs.
* fmt
* Remove panic
* Assert the number of arguments are equal between wasmtime and hostfunc.
* Comment a possible panic if there is no corresponding value variant.
* Check signature of the entrypoint.
* Use git version of wasmtime
* Refine and doc the sandbox code.
* Comment RefCells.
* Update wasmtime to the latest-ish master.
This may solve a problem with segfaults.
* Apply suggestions from code review
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com >
* Use full SHA1 hash of wasmtime commit.
* Add a panic message.
* Add some documentation
* Update wasmtime version to include SIGSEGV fix
* Update to crates.io version of wasmtime
* Make it work.
* Move the creation of memory into `InstanceWrapper::new`
* Make `InstanceWrapper` !Send & !Sync
* Avoid using `take_mut`
* Update client/executor/wasmtime/Cargo.toml
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com >
* Limit maximum size of memory.
* Rename `init_state` to `with_initialized_state`
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com >
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2020-02-13 14:54:19 +01:00
Sergei Pepyakin
1af9e4f3ee
executor: Simplify the SandboxCapabilities interface ( #4825 )
...
* Don't require `store` and `store_mut` in `SandboxCapabilities`.
* Simplify the sandbox a bit
2020-02-05 18:20:25 +01:00
Bastian Köcher
4c36143375
Add get_global for Sandbox ( #4756 )
...
* Add `get_global` for `Sandbox`
This pr adds `get_global` to retrieve a `global` variable from an
instantiated sandbox wasm blob.
* Bump `spec_version`
* Update primitives/wasm-interface/src/lib.rs
Co-Authored-By: Sergei Pepyakin <sergei@parity.io >
* `get_global` -> `get_global_val`
Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com >
Co-authored-by: Gavin Wood <github@gavwood.com >
2020-01-29 16:24:40 +01:00
Bastian Köcher
793a1eb053
WASM runtime switch to import memory ( #4737 )
...
* WASM runtime switch to import memory
Up to now runtimes have exported their memory. To unify it with
sandboxing, this pr switches runtimes to import memory as well.
From a functional perspective, exporting/importing memory makes no
difference to the runtime.
To provide backwards compatibility, WASM exported memory is still supported.
* Revert debug stuff
* Revert some stuff
2020-01-28 09:36:57 +01:00
Sergei Pepyakin
2421576f91
Cursed implementation of allowing missing imports on wasmtime ( #4730 )
...
* Quick and dirty impl.
* Clean up
* Check the signatures.
* Fix tests.
* Apply suggestions from code review
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com >
* Ignore non function members.
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2020-01-25 23:53:08 +01:00
Bastian Köcher
5bd6e94e64
Move "wasm" allocator into its own crate ( #4716 )
...
This moves the wasm-allocator (`FreeingBumpHeapAllocator`) into its own
crate `sp-allocator`. This new crate can theoretically provide multiple
different allocators. Besides moving the allocator, this pr also makes
`FreeingBumpHeapAllocator` compile on `no_std`.
2020-01-22 18:13:17 +01:00
Bastian Köcher
afc3318f21
Implement runtime version checks in set_code ( #4548 )
...
* Implement runtime version checks in `set_code`
Check that the new runtime code given to `set_code` fullfills some
requirements:
- `spec_name` matches
- `spec_version` does not decreases
- `impl_version` does not decreases
- Either `spec_version` and `impl_version` increase
* Make tests almost work
* Some fixes after master merge
* Fix tests
* Add missed file
* Make depedency check happy?
* Remove leftover `sc-executor`
* AHHHHH
* Reset debug stuff
* Remove some 'static
* More 'static
* Some docs
* Update `Cargo.lock`
2020-01-16 13:58:37 +01:00
Cecile Tonglet
cc573bc106
Wasm executor should provide stubs for unknown externs (wasmi) ( #4550 )
...
Related to #4456
2020-01-09 11:18:14 +01:00
Shawn Tabrizi
7efa62725e
Update copyright year ( #4532 )
2020-01-05 14:05:44 +01:00
Sergei Pepyakin
1782fbbbba
Extract execution engines definitions into their own crates ( #4489 )
...
* Clean imports in wasmi_execution
* Replace `interpret_runtime_api_result` with `pointer_and_len_from_u64`.
* Extract sc-executor-common crate
* Extract `sc-executor-wasmi` into its own crate
* Extract `sc-executor-wasmtime` into its own crate.
* Add missing headers.
* Clean and docs
* Docs for sc-executor-wasmi
* Expand a comment about sandboxing
* Fix assert_matches
* Rename (un)pack_ptr_and_len and move them into util module
* Remove wasmtime errors in sc-executor-common
2019-12-24 13:17:41 +01:00