-
Notifications
You must be signed in to change notification settings - Fork 97
Description
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.