Skip to content

Commit

Permalink
wip: implement fast accountdb
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 8, 2023
1 parent f5bc9e3 commit b93f6c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions boa/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions boa/vm/fast_accountdb.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b93f6c5

Please sign in to comment.