-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
.and_then(|r| Ok(unpack_ptr_and_len(r))); | ||
|
||
// Take the host state | ||
ctx.as_context_mut().data_mut().host_state.take(); |
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.
This will make it clear that it's deliberate
ctx.as_context_mut().data_mut().host_state.take(); | |
let _ = ctx.as_context_mut().data_mut().host_state.take(); |
|
||
let ret = entrypoint | ||
.call(&mut ctx, data_ptr, data_len) | ||
.and_then(|r| Ok(unpack_ptr_and_len(r))); |
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.
I assume that call
returns a Result
. If so, then and_then
here seems useless and we can get away with a map
?
use wasmtime::{AsContext, AsContextMut, Engine, StoreLimits}; | ||
|
||
pub(crate) struct StoreData { | ||
limits: StoreLimits, |
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.
I assume this is here only to be able to return this from the limiter
and it is not possible to move the StoreLimits
into the closure that limiter
accepts. If so, it would be good to mention that here as a doc comment.
|
||
pub(crate) struct StoreData { | ||
limits: StoreLimits, | ||
host_state: Option<Rc<HostState>>, |
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.
It would be nice to leave a note that this is only Some
during the call into the runtime.
.data() | ||
.host_state() | ||
.expect( | ||
"host functions can be called only from wasm instance; | ||
wasm instance is always called initializing context; | ||
therefore host_ctx cannot be None; | ||
qed | ||
", |
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.
Can we preserve vertical alignment for this change?
It's a shame the reads require |
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.
I get it now: memory_as_slice_mut
removed for data_mut
( https://docs.wasmtime.dev/api/wasmtime/struct.Store.html#method.data_mut ). Yeah that's much nicer.
FYI: I see the dev release of the next version of wasmtime just dropped - looks like some module loading speedups just landed (not that I know what a veneer is...)
Looks like you'll have to bump the zstd on polkadot... |
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.
The changes look good. Some nits left above.
Forgot to push my changes :D |
bot merge |
Waiting for commit status. |
bot merge |
Waiting for commit status. |
Merge aborted: Checks failed for f011fa2 |
bot merge |
Trying merge. |
* master: (67 commits) Downstream `node-template` pull (#9915) Implement core::fmt::Debug for BoundedVec (#9914) Quickly skip invalid transactions during block authorship. (#9789) Add SS58 prefix for Automata (#9805) Clean up sc-peerset (#9806) Test each benchmark case in own #[test] (#9860) Add build with docker section to README (#9792) Simple Trait to Inspect Metadata (#9893) Pallet Assets: Create new asset classes from genesis config (#9742) doc: subkey usage (#9905) Silence alert about large-statement-fetcher (#9882) Fix democracy on-initialize weight (#9890) Fix basic authorship flaky test (#9906) contracts: Add event field names (#9896) subkey readme update on install (#9900) add feature wasmtime-jitdump (#9871) Return `target_hash` for finality_target instead of an Option (#9867) Update wasmtime to 0.29.0 (#9552) Less sleeps (#9848) remove unidiomatic (#9895) ...
This updates wasmtime to 0.29.0 and its new api.
WasmRuntime
trait take mut selfCloses: #9068
polkadot companion: paritytech/polkadot#3834