ApeWorX / archive-ape-starknet

StarkNet ecosystem plugin for the Ape Framework
https://www.apeworx.io/
Apache License 2.0
19 stars 12 forks source link

refactor: use `set_time` RPC in `set_timestamp()` method rather than `increase_time` #103

Closed antazoey closed 2 years ago

antazoey commented 2 years ago

What I did

Use set_time instead of increase_time(). Simplifies the implementation.

How I did it

How to verify it

Checklist

sanchopansa commented 2 years ago

Thanks for the change -- this works for me locally.

One thing worth noting is that starknet-devnet currently will not change the timestamp of the new block while the block is being built, so any calls to get_block_timestamp from a Cairo smart contract will not return the value that was provided to set_timestamp. A workaround for this is to create an empty block right after calling set_timestamp to force the timestamp change.