Document immediate-trap behavior of epochs (#4345)

Closes #4342
This commit is contained in:
Alex Crichton
2022-06-28 11:29:40 -05:00
committed by GitHub
parent 9c695b492a
commit 17ed95ad8c
2 changed files with 11 additions and 3 deletions

View File

@@ -449,9 +449,9 @@ impl Config {
/// not available. This means epoch-based interruption can only /// not available. This means epoch-based interruption can only
/// serve as a simple external-interruption mechanism. /// serve as a simple external-interruption mechanism.
/// ///
/// An initial deadline can be set before executing code by /// An initial deadline must be set before executing code by calling
/// calling /// [`Store::set_epoch_deadline`](crate::Store::set_epoch_deadline). If this
/// [`Store::set_epoch_deadline`](crate::Store::set_epoch_deadline). /// deadline is not configured then wasm will immediately trap.
/// ///
/// ## When to use fuel vs. epochs /// ## When to use fuel vs. epochs
/// ///

View File

@@ -870,6 +870,10 @@ impl<T> Store<T> {
/// [`Engine::increment_epoch()`] has been invoked at least /// [`Engine::increment_epoch()`] has been invoked at least
/// `ticks_beyond_current` times. /// `ticks_beyond_current` times.
/// ///
/// By default a store will trap immediately with an epoch deadline of 0
/// (which has always "elapsed"). This method is required to be configured
/// for stores with epochs enabled to some future epoch deadline.
///
/// See documentation on /// See documentation on
/// [`Config::epoch_interruption()`](crate::Config::epoch_interruption) /// [`Config::epoch_interruption()`](crate::Config::epoch_interruption)
/// for an introduction to epoch-based interruption. /// for an introduction to epoch-based interruption.
@@ -896,6 +900,10 @@ impl<T> Store<T> {
/// finite interval. For deterministic interruption, see the /// finite interval. For deterministic interruption, see the
/// "fuel" mechanism instead. /// "fuel" mechanism instead.
/// ///
/// Note that when this is used it's required to call
/// [`Store::set_epoch_deadline`] or otherwise wasm will always immediately
/// trap.
///
/// See documentation on /// See documentation on
/// [`Config::epoch_interruption()`](crate::Config::epoch_interruption) /// [`Config::epoch_interruption()`](crate::Config::epoch_interruption)
/// for an introduction to epoch-based interruption. /// for an introduction to epoch-based interruption.