Closed ritzdorf closed 2 weeks ago
Thanks for the feedback. I will try to get it to it. Am a bit busy though.
Hi @DanielSchiavini @charles-cooper, thanks to @trocher we made the journaling changes here. We tested it and so far it works well for us.
What I did
Currently, when
boa.env.anchor()
is used to revert to a previous snapshot, the evm state is reverted, but newly created contracts that have been registered since the snapshot has been taken, are not unregistered. Hence, repeated snapshots lead to an ever growing memory consumption. Hence, I added code to unregister contracts that have been deployed since the last snapshot has been taken.How I did it
I added a list to remember to newly deployed contracts as
_new_contracts
. The list elements are tuples. They contain:addr
: the address, of typeAddress
novel_bytecode
: a boolean indicating whether or not the bytecode of this contract was seen for the first time as part of this deploymentThe
_new_contracts
list is cleared when a snapshot is taken.When the state is reverted to a previous snapshot, the newly created contracts are unregistered. Where the bytecode was novel, it is also unregistered.
How to verify it
This script with the current master:
This script with the new version:
Description for the changelog
Unregistering newly created contracts when reverting to snapshot
Cute Animal Picture