0

If we have some program that uses let epoch_now = Clock::get()?.epoch; and we want to write typescript tests around what happens when the epoch advances, is there a way to advance the localnet time or make epochs on localnet very short (e.g., several seconds)?

For time, it's easy to compile with a localnet flag that turns any time-equivalent into something small like a few seconds. For epochs, they are unfortunately always two days.

Obviously waiting 2 days is not ideal.

1 Answer 1

3

Consider Bankrun. I haven't used it but it aims to be a wrapper around solana-program-test which means it likely has what you want.

The clock-related functions shown here are examples of the useful functionality solana-program-test provides that should help in your case. With it, you can modify the clock sysvar information at will. Bankrun should in theory offer a way to do the same in Typescript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.