Skip to content

[evm] Use slice instead map to record stack info when taking snapshot #3024

Open
@Liuhaai

Description

@Liuhaai

What would you like to be added:

Todo1: Reinitiate a new statedb of snapshot when running each execution()

Todo2: Use slice instead map to record stack info when taking snapshot

Why is this needed:

  • The snapshot is useless and can be cleared after running the execution. When the number of tx is large, the copy of a number of useless snapshot causes performance bad .

  • It's unnecessary to use map to record the snapshot info, because the height of snapshot increases one by one.

  • Todo 1 must be finished before Todo 2, because slice will be panic if the idx is incorrect.

potential codes in evmstatedbadapter.go to be improved:

contractSnapshot    map[int]contractMap
suicideSnapshot     map[int]deleteAccount
preimageSnapshot    map[int]preimageMap

func (stateDB *StateDBAdapter) clear()

Metadata

Metadata

Assignees

No one assigned

    Labels

    EVMRelated to EVMenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions