Skip to content

(*Trie).Hash() doesn't sync storage reads properly #3336

@infrmtcs

Description

@infrmtcs

(*Trie).updateValueIfDirty is called recursively and possibly concurrently.
https://github.com/NethermindEth/juno/blob/v0.15.16/core/trie/trie.go#L656-L660
https://github.com/NethermindEth/juno/blob/v0.15.16/core/trie/trie.go#L707-L718

Calling (*Trie).Hash() temporarily replace storage by synced storage:
https://github.com/NethermindEth/juno/blob/v0.15.16/core/trie/trie.go#L793-L795

However, this doesn't replace the read storage with synced version, which means a read and a write can happen concurrently, which result in a race condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions