-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Refactor sp-sandbox
; make sure both sandbox executors are always tested
#10173
Refactor sp-sandbox
; make sure both sandbox executors are always tested
#10173
Conversation
} | ||
|
||
impl<T> EnvironmentDefinitionBuilder<T> { | ||
pub trait SandboxEnvironmentBuilder<State, Memory>: Sized { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving not using <T>
. These generic names are great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generic names
Isn't that a contradiction in terms?
I mean a 'generic' name is by definition meaningless and that is why I prefer symbols instead of 'names' for generic type parameters. For me, the semantic of a generic type parameter is not induced by it's name but by the respective type bounds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving it. This include_file!
stuff always bothered me.
've reexported the executor which was previously selected at compile time as sp_sandbox::default to make sure I don't inadvertently change which executor is used; do we want to get rid of that and explicitly refer to the concrete executor everywhere sp_sandbox::default is currently used? (Or perhaps move the logic of which one should be used to the places it's actually being used?)
For contracts I want be able to switch to wasmer
by only recompiling without source file changes. This change would complicate that. Ideally, I want be able to switch between wasmi/wasmer at runtime. This does not work because the host API does not allow selecting the execution engine.
I think for now it should stay the way it is. Eventually we want to overhaul the API exposed by the client. This change should also include selecting the execution engine (wasmtime, wasmer, wasmer singlepass).
@bkchr Okay, I've fixed the duplication; looks good now? (: |
Ty ❤️ |
bot merge |
…sted (paritytech#10173) * sp-sandbox: convert executors into normal `mod`s instead of using `include!` * sp-sandbox: run `cargo fmt` on `host_executor.rs` * sp-sandbox: abstract away the executors behind traits * sp_sandbox: always compile both executors when possible * sc-executor: make sure all sandbox tests run on both sandbox executors * sc-executor: fix brainfart: actually call into the sandbox through the trait * sc-runtime-test: fix cargo fmt * sc-runtime-test: deduplicate executor-specific sandbox test entrypoints * sc-executor: test each sandbox executor in a separate test * cargo fmt (Github's conflict resolving thingy broke indentation)
…sted (paritytech#10173) * sp-sandbox: convert executors into normal `mod`s instead of using `include!` * sp-sandbox: run `cargo fmt` on `host_executor.rs` * sp-sandbox: abstract away the executors behind traits * sp_sandbox: always compile both executors when possible * sc-executor: make sure all sandbox tests run on both sandbox executors * sc-executor: fix brainfart: actually call into the sandbox through the trait * sc-runtime-test: fix cargo fmt * sc-runtime-test: deduplicate executor-specific sandbox test entrypoints * sc-executor: test each sandbox executor in a separate test * cargo fmt (Github's conflict resolving thingy broke indentation)
…sted (paritytech#10173) * sp-sandbox: convert executors into normal `mod`s instead of using `include!` * sp-sandbox: run `cargo fmt` on `host_executor.rs` * sp-sandbox: abstract away the executors behind traits * sp_sandbox: always compile both executors when possible * sc-executor: make sure all sandbox tests run on both sandbox executors * sc-executor: fix brainfart: actually call into the sandbox through the trait * sc-runtime-test: fix cargo fmt * sc-runtime-test: deduplicate executor-specific sandbox test entrypoints * sc-executor: test each sandbox executor in a separate test * cargo fmt (Github's conflict resolving thingy broke indentation)
This PR refactors
sp-sandbox
so that (when possible) both execution backends are always compiled, and makes sure that both of them are actually tested in thesc-executor
integration tests. (Currently only theembedded_executor
codepath is tested; after this PR bothembedded_executor
andhost_executor
are.)Open questions/possible further work
sp_sandbox::default
to make sure I don't inadvertently change which executor is used; do we want to get rid of that and explicitly refer to the concrete executor everywheresp_sandbox::default
is currently used? (Or perhaps move the logic of which one should be used to the places it's actually being used?)