Skip to content

Instantly share code, notes, and snippets.

View wangkui0508's full-sized avatar

wangkui0508 wangkui0508

View GitHub Profile

How to use transient storage

TL;DR You must manually make sure the storage is transient within the life cycle of an external function, stead of a transaction. Never let the EVM clear non-zero transient storages.

The Solidity's Blog discussed the composibility problem of transient storage very well. Let's see what it says:

So far the EVM largely guaranteed composable behaviour, since multiple calls into a smart contract within a complex transaction are virtually indistinguishable from multiple calls to the contract stretched over several transactions. However, transient storage allows a violation to this principle and incorrect use may lead to complex bugs that only surface when used across several calls.