Skip to content

Commit 3d9a2f9

Browse files
authored
chore: add test case for storage bug (#25)
* chore: add test case for storage bug * chore: add test case for loading from random account * chore: fmt
1 parent 38f8193 commit 3d9a2f9

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.13;
3+
4+
import {Assertion} from "../../Assertion.sol";
5+
import {PhEvm} from "../../PhEvm.sol";
6+
import {Target, TARGET} from "../common/Target.sol";
7+
8+
contract TestAccessAssertionStorage is Assertion {
9+
address public someAddress;
10+
11+
function accessAssertionStorage() external {
12+
someAddress = address(this);
13+
}
14+
15+
function triggers() external view override {
16+
registerCallTrigger(this.accessAssertionStorage.selector);
17+
}
18+
}
19+
20+
contract TriggeringTx {
21+
constructor() payable {
22+
TARGET.incrementStorage();
23+
}
24+
}

src/test-cases/precompiles/Load.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ contract TestLoad is Assertion {
2525
require(TARGET.readStorage() == _loadCount(), "readStorage != postStateCount (switch)");
2626
}
2727

28+
function loadRandomAccount() external view {
29+
require(ph.load(address(0x00000000000000000000000000000000001bd5a0), 0) == 0, "load(randomAccount) != 0");
30+
}
31+
2832
function triggers() external view override {
2933
registerCallTrigger(this.load.selector);
34+
registerCallTrigger(this.loadRandomAccount.selector);
3035
}
3136
}
3237

0 commit comments

Comments
 (0)