Skip to content

Globally cache domain separator  #6031

@robertkiel

Description

@robertkiel

To properly handle the smart contract being part of a chain fork, such as Gnosis Chain splits into two chains, hopr uses a chain_id specific domain separator which makes tickets issued by smart contracts issues on different forks incompatible to each other so they cannot get replayed.

Problem

Since the domain_separator is by design not static, the hopr client stores it in the database and fetches it whenever needed - which causes lots of unnecessary and costly database requests per packet.

Solution

Globally cache domain_separator in memory and update its value once the indexer notices a change.

Could be done using some thread-safe mechanism that supports interior mutability to which only the indexer ever acquires a write lock. As an alternative, the value could be loaded at startup and stored for the entire lifetime of the program. Changes to the domain_separator - which will presumably happen very rarely - will then require a node restart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestnew issueA reviewer has to check this issue and apply all necessary labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions