Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign of BaseVMState descriptor #923

Merged
merged 9 commits into from
Jan 18, 2022
Merged

Conversation

mjfh
Copy link
Contributor

@mjfh mjfh commented Jan 10, 2022

why:
BaseVMState provides an environment for executing transactions. The
current descriptor also provides data that cannot generally be known
within the execution environment, e.g. the total gasUsed which is
available not before after all transactions have finished.

Also, the BaseVMState constructor has been replaced by a constructor
that does not need pre-initialised input of the account database.

also:
Previous constructor and some fields are provided with a deprecated
annotation (producing a lot of noise.)

@mjfh mjfh force-pushed the jordan/base-vmstate-redesign branch 2 times, most recently from b1058b7 to ab08f19 Compare January 10, 2022 17:54
@mjfh mjfh requested review from jangko, jlokier and zah and removed request for jangko January 11, 2022 11:04
@mjfh mjfh force-pushed the jordan/base-vmstate-redesign branch 12 times, most recently from 518af25 to ae550f2 Compare January 12, 2022 11:32
why:
  BaseVMState provides an environment for executing transactions. The
  current descriptor also provides data that cannot generally be known
  within the execution environment, e.g. the total gasUsed which is
  available not before after all transactions have finished.

  Also, the BaseVMState constructor has been replaced by a constructor
  that does not need pre-initialised input of the account database.

also:
  Previous constructor and some fields are provided with a deprecated
  annotation (producing a lot of noise.)
@mjfh mjfh force-pushed the jordan/base-vmstate-redesign branch from ae550f2 to 69925d0 Compare January 13, 2022 09:31
…e' re-initialisation

why:
  Constructing a new 'AccountsCache' descriptor can be avoided sometimes
  when the current state root is properly positioned already. Such a
  feature existed already as the update function 'initStateDB()' for the
  'BaseChanDB' where the accounts cache was linked into this desctiptor.

  The function 'initStateDB()' was removed and re-implemented into the
  'BaseVmState' constructor without optimisation. The old version was of
  restricted use as a wrong accounts cache state would unconditionally
  throw an exception rather than conceptually ask for a remedy.

  The optimised 'BaseVmState' re-initialisation has been implemented for
  the 'persistBlocks()' function.

also:
  moved some test helpers to 'test/replay' folder
why:
  Reduces attack surface in general & improves reading the code.
@mjfh mjfh merged commit 261c0b5 into master Jan 18, 2022
@mjfh mjfh deleted the jordan/base-vmstate-redesign branch January 18, 2022 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant