Skip to content

transition: also convert code if account is touched #536

@gballet

Description

@gballet

This issue is used to investigate a request by Besu, to also convert the code if an account is touched.

Current state of affairs:

  • When a storage slot of an account that hasn't yet been converted is written, this will trigger the update of its state root, which means that the account needs to be converted.
  • The code isn't converted, owing to the fact that the account is pre-existing and that the code isn't "dirty" (see here]
  • When the account is reached by the base tree sweep, the destination tree will be checked to ensure that nothing gets overwritten, so everything the the account header will be ignored, while the code itself will be translated.

What Besu wants:

  • Also convert the code as the yet-unconverted account is converted upon the storage write to the overlay tree.

For geth, this is a bit difficult because of this same dirtyCode check : one needs to ensure that the account is only converted once, and at the right time. Namely:

  • We don't want to write the code every time during the conversion, so a check for InTransition has to be used
  • We don't want to write the code every time once the code has been written.

This means that line could be replaced by something like:

	if obj.dirtyCode || (s.db.InTransition() && obj.Root() != (common.Hash{})) {

Which sort-of works because if the account is read from the verkle tree, then its root hash is 0. That solves the issue of the code being rewritten multiple times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions