diff --git a/boa/environment.py b/boa/environment.py index d99d0339..4ea6399a 100644 --- a/boa/environment.py +++ b/boa/environment.py @@ -25,6 +25,7 @@ from boa.util.eip1167 import extract_eip1167_address, is_eip1167_contract from boa.util.lrudict import lrudict from boa.vm.fork import AccountDBFork +from boa.vm.fast_accountdb import FastAccountDB from boa.vm.gas_meters import GasMeter, NoGasMeter, ProfilingGasMeter from boa.vm.utils import to_bytes, to_int @@ -421,6 +422,8 @@ def _init_vm(self, reset_traces=True): ) self.vm.state.computation_class = c + # TODO: enable this with fast mode + # self.vm.state.account_db_class = FastAccountDB # we usually want to reset the trace data structures # but sometimes don't, give caller the option. diff --git a/boa/vm/fast_accountdb.py b/boa/vm/fast_accountdb.py new file mode 100644 index 00000000..f948c542 --- /dev/null +++ b/boa/vm/fast_accountdb.py @@ -0,0 +1,6 @@ +from eth.db.account import AccountDB + +class FastAccountDB(AccountDB): + # this is a hotspot in super(). + def touch_account(self, address): + self._accessed_accounts.add(address)