@@ -7,10 +7,12 @@ import { TransparentProxyOZv4_9_5 } from "../src/TransparentProxyOZv4_9_5.sol";
7
7
import { LibString } from "../dependencies/@solady-0.0.228/src/utils/LibString.sol " ;
8
8
import { console } from "../dependencies/@forge-std-1.9.1/src/console.sol " ;
9
9
import { StdStyle } from "../dependencies/@forge-std-1.9.1/src/StdStyle.sol " ;
10
+ import { Vm } from "../dependencies/@forge-std-1.9.1/src/Vm.sol " ;
10
11
import { ScriptExtended, IScriptExtended } from "./extensions/ScriptExtended.s.sol " ;
11
12
import { OnchainExecutor } from "./OnchainExecutor.s.sol " ; // cheat to load artifact to parent `out` directory
12
13
import { IMigrationScript } from "./interfaces/IMigrationScript.sol " ;
13
14
import { LibProxy } from "./libraries/LibProxy.sol " ;
15
+ import { LibInitializeGuard } from "./libraries/LibInitializeGuard.sol " ;
14
16
import { DefaultContract } from "./utils/DefaultContract.sol " ;
15
17
import { ProxyInterface, LibDeploy, DeployInfo, UpgradeInfo } from "./libraries/LibDeploy.sol " ;
16
18
import { cheatBroadcast } from "./utils/Helpers.sol " ;
@@ -38,6 +40,18 @@ abstract contract BaseMigration is ScriptExtended {
38
40
ProxyInterface /* proxyInterface */
39
41
) internal virtual { }
40
42
43
+ function _beforeRunningScript () internal virtual override {
44
+ vm.recordLogs ();
45
+ vm.startStateDiffRecording ();
46
+ }
47
+
48
+ function _afterRunningScript () internal virtual override {
49
+ Vm.Log[] memory recordedLogs = vm.getRecordedLogs ();
50
+ Vm.AccountAccess[] memory stateDiffs = vm.stopAndReturnStateDiff ();
51
+
52
+ LibInitializeGuard.validate ({ logs: recordedLogs, stateDiffs: stateDiffs });
53
+ }
54
+
41
55
function _sharedArguments () internal virtual returns (bytes memory rawSharedArgs );
42
56
43
57
function _injectDependencies () internal virtual { }
0 commit comments