diff --git a/boa/environment.py b/boa/environment.py index d0656274..fdc48186 100644 --- a/boa/environment.py +++ b/boa/environment.py @@ -329,5 +329,10 @@ def time_travel( assert blocks is not None # mypy hint seconds = blocks * block_delta - self.evm.patch.timestamp += seconds - self.evm.patch.block_number += blocks + if (new_blknum := self.evm.patch.block_number + blocks) < 0: + raise ValueError(f"negative blocknumber: to set to {new_blknum}") + if (new_ts := self.evm.patch.timestamp + seconds) < 0: + raise ValueError(f"negative timestamp: to set to {new_ts}") + + self.evm.patch.timestamp = new_ts + self.evm.patch.block_number = new_blknum diff --git a/pyproject.toml b/pyproject.toml index d7804fc1..a5ba2b5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "titanoboa" -version = "0.1.9" +version = "0.1.10b1" description = "A Vyper interpreter" #authors = [] license = { file = "LICENSE" }