Skip to content

Commit

Permalink
docs: Improved fast_forward docs (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasir Shariff committed Sep 12, 2023
1 parent 5c4b2e8 commit 482c194
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ Following that we will have to init the contract again with our own metadata. Th

### Time Traveling

`workspaces` testing offers support for forwarding the state of the blockchain to the future. This means contracts which require time sensitive data do not need to sit and wait the same amount of time for blocks on the sandbox to be produced. We can simply just call `worker.fast_forward` to get us further in time:
`workspaces` testing offers support for forwarding the state of the blockchain to the future. This means contracts which require time sensitive data do not need to sit and wait the same amount of time for blocks on the sandbox to be produced. We can simply just call `worker.fast_forward` to get us further in time.
Note: This is not to be confused with speeding up the current in-flight transactions; the state being forwarded in this case refers to time-related state (the block height, timestamp and epoch).

```rust
#[tokio::test]
Expand Down
3 changes: 3 additions & 0 deletions workspaces/src/worker/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ impl Worker<Sandbox> {
///
/// Estimate as to how long it takes: if our delta_height crosses `X` epochs, then it would
/// roughly take `X * 5` seconds for the fast forward request to be processed.
///
/// Note: This is not to be confused with speeding up the current in-flight transactions;
/// the state being forwarded in this case refers to time-related state (the block height, timestamp and epoch).
pub async fn fast_forward(&self, delta_height: u64) -> Result<()> {
self.workspace.fast_forward(delta_height).await
}
Expand Down

0 comments on commit 482c194

Please sign in to comment.