Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve fast_forward docs #299

Merged
merged 2 commits into from Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading