diego pfp
diego
@tomorrow
πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’πŸ”’ Introducing Transience, a library for safely using transient storage in Solidity (without assembly). https://github.com/ethereum-optimism/transience
1 reply
0 recast
0 reaction

diego pfp
diego
@tomorrow
What does the library offer? - It allows writing and reading transient storage without assembly/Yul - It prevents reentrant calls from overwriting transient storage
1 reply
0 recast
0 reaction

diego pfp
diego
@tomorrow
You get these methods: - get(bytes32 _slot) for retrieving a transient value - set(bytes32 _slot, uint256 _value) for setting a transient value _slot and the current call depth are used to determine a unique location in transient storage.
1 reply
0 recast
0 reaction

diego pfp
diego
@tomorrow
Use modifier 𝘳𝘦𝘦𝘯𝘡𝘳𝘒𝘯𝘡𝘈𝘸𝘒𝘳𝘦 to prevent a reentrant call from overwriting a slot in transient storage. This is possible because the modifier automatically increments and decrements the call depth when entering and exiting the function.
1 reply
0 recast
0 reaction

diego pfp
diego
@tomorrow
Transience was developed for the interop contracts of the OP Stack/Optimism, specifically for CrossL2Inbox, where it's used for storing the identifier of a cross-chain message during its execution. https://github.com/ethereum-optimism/optimism/blob/3aeb6bdd3efe798713098f890359513eaaa91522/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol
1 reply
0 recast
0 reaction