-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transient storage test to e2e tests (#811)
* Add `testTransientStoreLoad`, Cancun schedule to end-to-end tests * Set schedule in `foundry_prove` in e2e tests * Fix `foundry.toml` update
- Loading branch information
1 parent
765d1f6
commit 58819e1
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/tests/integration/test-data/src/TransientStorage.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.25; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
contract TransientStorageTest is Test { | ||
function testTransientStoreLoad(uint256 key, uint256 value) public { | ||
// Store `value` at `key` in transient storage | ||
assembly { | ||
tstore(key, value) | ||
} | ||
|
||
uint256 loadedValue; | ||
|
||
// Load `value` from `key` in transient storage | ||
assembly { | ||
loadedValue := tload(key) | ||
} | ||
|
||
assertEq(loadedValue, value, "TLOAD did not return the correct value"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters