Skip to content

Commit ab55b0a

Browse files
Add multiple source test to ensure transient storage is emitted only once during compilation (ethereum#14935)
1 parent 9065a0a commit ab55b0a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
==== Source: A ====
2+
contract C {
3+
function f() external {
4+
assembly {
5+
tstore(0, 0)
6+
let a := tload(0)
7+
tstore(0, 1)
8+
tstore(1, a)
9+
}
10+
}
11+
}
12+
==== Source: B ====
13+
import {C as C} from "A";
14+
contract D {
15+
function g() external {
16+
assembly {
17+
tstore(0, 0)
18+
tstore(0, 1)
19+
}
20+
}
21+
}
22+
==== Source: C ====
23+
contract X {
24+
function h() external {
25+
assembly {
26+
tstore(0, 0)
27+
tstore(0, 0)
28+
}
29+
}
30+
}
31+
// ====
32+
// EVMVersion: >=cancun
33+
// ----
34+
// Warning 2394: (A:72-78): Transient storage as defined by EIP-1153 can break the composability of smart contracts: Since transient storage is cleared only at the end of the transaction and not at the end of the outermost call frame to the contract within a transaction, your contract may unintentionally misbehave when invoked multiple times in a complex transaction. To avoid this, be sure to clear all transient storage at the end of any call to your contract. The use of transient storage for reentrancy guards that are cleared at the end of the call is safe.

0 commit comments

Comments
 (0)