11use foundry_compilers:: artifacts:: EvmVersion ;
22
3- forgetest ! ( can_translate_balances_after_switch_to_pvm, |prj, cmd| {
4- prj. insert_ds_test( ) ;
5- prj. insert_vm( ) ;
6- prj. insert_console( ) ;
7- prj. add_source(
8- "BalanceTranslationTest.t.sol" ,
9- r#"
10- import "./test.sol";
11- import "./Vm.sol";
12- import {console} from "./console.sol";
13-
14- contract BalanceTranslationTest is DSTest {
15- Vm constant vm = Vm(HEVM_ADDRESS);
16-
17- function test_BalanceTranslationRevmPvm() public {
18- uint256 amount = 10 ether;
19- vm.deal(address(this), amount);
20-
21- uint256 initialBalance = address(this).balance;
22- assertEq(initialBalance, amount);
23-
24- vm.pvm(true);
25-
26- uint256 currentBalance = address(this).balance;
27- console.log(initialBalance, currentBalance);
28- assertEq(initialBalance, currentBalance);
29- }
30- }
31- "# ,
32- )
33- . unwrap( ) ;
34- prj. update_config( |config| config. evm_version = EvmVersion :: Cancun ) ;
35-
36- let res = cmd. args( [ "test" , "--resolc" , "-vvv" ] ) . assert_success( ) ;
37- res. stderr_eq( str ![ "" ] ) . stdout_eq( str ![ [ r#"
38- [COMPILING_FILES] with [SOLC_VERSION]
39- [SOLC_VERSION] [ELAPSED]
40- Compiler run successful!
41- [COMPILING_FILES] with [RESOLC_VERSION]
42- [RESOLC_VERSION] [ELAPSED]
43- Compiler run successful!
44-
45- Ran 1 test for src/BalanceTranslationTest.t.sol:BalanceTranslationTest
46- [PASS] test_BalanceTranslationRevmPvm() ([GAS])
47- Logs:
48- 10000000000000000000 10000000000000000000
49-
50- Suite result: ok. 1 passed; 0 failed; 0 skipped; [ELAPSED]
51-
52- Ran 1 test suite [ELAPSED]: 1 tests passed, 0 failed, 0 skipped (1 total tests)
53-
54- "# ] ] ) ;
55- } ) ;
56-
573forgetest ! ( counter_test, |prj, cmd| {
584 prj. insert_ds_test( ) ;
595 prj. insert_vm( ) ;
@@ -91,7 +37,6 @@ contract CounterTest is DSTest {
9137 Counter public counter;
9238
9339 function setUp() public {
94- vm.pvm(true);
9540 counter = new Counter();
9641 counter.setNumber(5);
9742 assertEq(counter.number(), 5);
@@ -128,7 +73,7 @@ contract CounterTest is DSTest {
12873 . unwrap( ) ;
12974 prj. update_config( |config| config. evm_version = EvmVersion :: Cancun ) ;
13075
131- let res = cmd. args( [ "test" , "--resolc" , "-vvv" ] ) . assert( ) ;
76+ let res = cmd. args( [ "test" , "--resolc" , "-vvv" , "--resolc-startup" ] ) . assert( ) ;
13277 res. stderr_eq( str ![ "" ] ) . stdout_eq( str ![ [ r#"
13378[COMPILING_FILES] with [SOLC_VERSION]
13479[SOLC_VERSION] [ELAPSED]
@@ -164,7 +109,6 @@ contract SetNonce is DSTest {
164109 Vm constant vm = Vm(HEVM_ADDRESS);
165110
166111 function test_SetNonce() public {
167- vm.pvm(true);
168112 uint64 original = vm.getNonce(address(this));
169113 vm.setNonce(address(this), 64);
170114 uint64 newValue = vm.getNonce(address(this));
@@ -177,7 +121,7 @@ contract SetNonce is DSTest {
177121 . unwrap( ) ;
178122 prj. update_config( |config| config. evm_version = EvmVersion :: Cancun ) ;
179123
180- let res = cmd. args( [ "test" , "--resolc" , "-vvv" ] ) . assert_success( ) ;
124+ let res = cmd. args( [ "test" , "--resolc" , "-vvv" , "--resolc-startup" ] ) . assert_success( ) ;
181125 res. stderr_eq( str ![ "" ] ) . stdout_eq( str ![ [ r#"
182126[COMPILING_FILES] with [SOLC_VERSION]
183127[SOLC_VERSION] [ELAPSED]
@@ -210,7 +154,6 @@ contract Roll is DSTest {
210154 Vm constant vm = Vm(HEVM_ADDRESS);
211155
212156 function test_Roll() public {
213- vm.pvm(true);
214157 uint256 original = block.number;
215158 vm.roll(10);
216159 uint256 newValue = block.number;
@@ -222,7 +165,7 @@ contract Roll is DSTest {
222165 )
223166 . unwrap( ) ;
224167
225- let res = cmd. args( [ "test" , "--resolc" , "-vvv" ] ) . assert_success( ) ;
168+ let res = cmd. args( [ "test" , "--resolc" , "-vvv" , "--resolc-startup" ] ) . assert_success( ) ;
226169 res. stderr_eq( str ![ "" ] ) . stdout_eq( str ![ [ r#"
227170[COMPILING_FILES] with [SOLC_VERSION]
228171[SOLC_VERSION] [ELAPSED]
@@ -255,7 +198,6 @@ contract Warp is DSTest {
255198 Vm constant vm = Vm(HEVM_ADDRESS);
256199
257200 function test_Warp() public {
258- vm.pvm(true);
259201 uint256 original = block.timestamp;
260202 vm.warp(100);
261203 uint256 newValue = block.timestamp;
@@ -267,7 +209,6 @@ contract Warp is DSTest {
267209 )
268210 . unwrap( ) ;
269211
270- cmd. env( "RUST_LOG" , "revive_strategy" ) ;
271212 let res = cmd. args( [ "test" , "--resolc" , "-vvv" , "--resolc-startup" ] ) . assert_success( ) ;
272213 res. stderr_eq( str ![ "" ] ) . stdout_eq( str ![ [ r#"
273214[COMPILING_FILES] with [SOLC_VERSION]
@@ -276,12 +217,6 @@ Compiler run successful!
276217[COMPILING_FILES] with [RESOLC_VERSION]
277218[RESOLC_VERSION] [ELAPSED]
278219Compiler run successful!
279- [..] INFO revive_strategy::cheatcodes: startup PVM migration initiated
280- [..] INFO revive_strategy::cheatcodes: switching to PVM
281- [..] INFO revive_strategy::cheatcodes: startup PVM migration completed
282- [..] INFO revive_strategy::cheatcodes: cheatcode=pvmCall { enabled: true } using_pvm=true
283- [..] INFO revive_strategy::cheatcodes: already in PVM
284- [..] INFO revive_strategy::cheatcodes: cheatcode=warpCall { newTimestamp: 100 } using_pvm=true
285220
286221Ran 1 test for src/Warp.t.sol:Warp
287222[PASS] test_Warp() ([GAS])
@@ -319,7 +254,6 @@ function test_Balance() public {
319254 )
320255 . unwrap( ) ;
321256
322- cmd. env( "RUST_LOG" , "revive_strategy" ) ;
323257 let res = cmd. args( [ "test" , "--resolc" , "-vvv" , "--resolc-startup" ] ) . assert_success( ) ;
324258 res. stderr_eq( str ![ "" ] ) . stdout_eq( str ![ [ r#"
325259[COMPILING_FILES] with [SOLC_VERSION]
@@ -328,13 +262,6 @@ Compiler run successful!
328262[COMPILING_FILES] with [RESOLC_VERSION]
329263[RESOLC_VERSION] [ELAPSED]
330264Compiler run successful!
331- [..] INFO revive_strategy::cheatcodes: startup PVM migration initiated
332- [..] INFO revive_strategy::cheatcodes: switching to PVM
333- [..] INFO revive_strategy::cheatcodes: startup PVM migration completed
334- [..] INFO revive_strategy::cheatcodes: cheatcode=dealCall { account: 0x7fa9385be102ac3eac297483dd6233d62b3e1496, newBalance: 64000000000000000000 } using_pvm=true
335- [..] INFO revive_strategy::cheatcodes: operation="get_balance" using_pvm=true target=0x7fa9385be102ac3eac297483dd6233d62b3e1496 balance=64000000000000000000
336- [..] INFO revive_strategy::cheatcodes: cheatcode=dealCall { account: 0x7fa9385be102ac3eac297483dd6233d62b3e1496, newBalance: 65000000000000000000 } using_pvm=true
337- [..] INFO revive_strategy::cheatcodes: operation="get_balance" using_pvm=true target=0x7fa9385be102ac3eac297483dd6233d62b3e1496 balance=65000000000000000000
338265
339266Ran 1 test for src/Balance.t.sol:Balance
340267[PASS] test_Balance() ([GAS])
0 commit comments