@@ -334,6 +334,46 @@ describe("GasOptimizationUpgrade.spec", async () => {
334
334
"L1GatewayRouter.depositERC20 USDC after upgrade"
335
335
) ;
336
336
} ) ;
337
+
338
+ it . skip ( "should succeed on L1LidoGateway" , async ( ) => {
339
+ const L1_WSTETH = "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0" ;
340
+ const L2_WSTETH = "0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32" ;
341
+ const L1_GATEWAY = "0x6625C6332c9F91F2D27c304E729B86db87A3f504" ;
342
+ const L2_GATEWAY = "0x8aE8f22226B9d789A36AC81474e633f8bE2856c9" ;
343
+ const L1LidoGateway = await ethers . getContractFactory ( "L1LidoGateway" , deployer ) ;
344
+ const impl = await L1LidoGateway . deploy ( L1_WSTETH , L2_WSTETH , L2_GATEWAY , L1_ROUTER , L1_MESSENGER ) ;
345
+ const gateway = await ethers . getContractAt ( "L1LidoGateway" , L1_GATEWAY , deployer ) ;
346
+ const amountIn = ethers . utils . parseUnits ( "1" , 6 ) ;
347
+ const fee = await queue . estimateCrossDomainMessageFee ( 1e6 ) ;
348
+ const token = await ethers . getContractAt ( "MockERC20" , L1_WSTETH , deployer ) ;
349
+ await mockERC20Balance ( token . address , amountIn . mul ( 10 ) , 0 ) ;
350
+ await token . approve ( L1_GATEWAY , constants . MaxUint256 ) ;
351
+ await token . approve ( L1_ROUTER , constants . MaxUint256 ) ;
352
+
353
+ // before upgrade
354
+ await showGasUsage (
355
+ await gateway [ "depositERC20(address,uint256,uint256)" ] ( L1_WSTETH , amountIn , 1e6 , { value : fee } ) ,
356
+ "L1LidoGateway.depositERC20 wstETH before upgrade"
357
+ ) ;
358
+ await showGasUsage (
359
+ await router [ "depositERC20(address,uint256,uint256)" ] ( L1_WSTETH , amountIn , 1e6 , { value : fee } ) ,
360
+ "L1GatewayRouter.depositERC20 wstETH before upgrade"
361
+ ) ;
362
+
363
+ // do upgrade
364
+ await upgradeL1 ( L1_GATEWAY , impl . address ) ;
365
+ await gateway . initializeV2 ( deployer . address , deployer . address , deployer . address , deployer . address ) ;
366
+
367
+ // after upgrade
368
+ await showGasUsage (
369
+ await gateway [ "depositERC20(address,uint256,uint256)" ] ( L1_WSTETH , amountIn , 1e6 , { value : fee } ) ,
370
+ "L1LidoGateway.depositERC20 wstETH after upgrade"
371
+ ) ;
372
+ await showGasUsage (
373
+ await router [ "depositERC20(address,uint256,uint256)" ] ( L1_WSTETH , amountIn , 1e6 , { value : fee } ) ,
374
+ "L1GatewayRouter.depositERC20 wstETH after upgrade"
375
+ ) ;
376
+ } ) ;
337
377
} ) ;
338
378
339
379
context ( "L2 upgrade" , async ( ) => {
@@ -584,5 +624,44 @@ describe("GasOptimizationUpgrade.spec", async () => {
584
624
"L2GatewayRouter.withdrawERC20 USDC after upgrade"
585
625
) ;
586
626
} ) ;
627
+
628
+ it . skip ( "should succeed on L2LidoGateway" , async ( ) => {
629
+ const L1_WSTETH = "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0" ;
630
+ const L2_WSTETH = "0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32" ;
631
+ const L1_GATEWAY = "0x6625C6332c9F91F2D27c304E729B86db87A3f504" ;
632
+ const L2_GATEWAY = "0x8aE8f22226B9d789A36AC81474e633f8bE2856c9" ;
633
+ const L2LidoGateway = await ethers . getContractFactory ( "L2LidoGateway" , deployer ) ;
634
+ const impl = await L2LidoGateway . deploy ( L1_WSTETH , L2_WSTETH , L1_GATEWAY , L2_ROUTER , L2_MESSENGER ) ;
635
+ const gateway = await ethers . getContractAt ( "L2LidoGateway" , L2_GATEWAY , deployer ) ;
636
+ const amountIn = ethers . utils . parseUnits ( "1" , 6 ) ;
637
+ const token = await ethers . getContractAt ( "MockERC20" , L2_WSTETH , deployer ) ;
638
+ await mockERC20Balance ( token . address , amountIn . mul ( 10 ) , 51 ) ;
639
+ await token . approve ( L2_GATEWAY , constants . MaxUint256 ) ;
640
+ await token . approve ( L2_ROUTER , constants . MaxUint256 ) ;
641
+
642
+ // before upgrade
643
+ await showGasUsage (
644
+ await gateway [ "withdrawERC20(address,uint256,uint256)" ] ( L2_WSTETH , amountIn , 1e6 ) ,
645
+ "L2LidoGateway.withdrawERC20 wstETH before upgrade"
646
+ ) ;
647
+ await showGasUsage (
648
+ await router [ "withdrawERC20(address,uint256,uint256)" ] ( L2_WSTETH , amountIn , 1e6 ) ,
649
+ "L2GatewayRouter.withdrawERC20 wstETH before upgrade"
650
+ ) ;
651
+
652
+ // do upgrade
653
+ await upgradeL2 ( L2_GATEWAY , impl . address ) ;
654
+ await gateway . initializeV2 ( deployer . address , deployer . address , deployer . address , deployer . address ) ;
655
+
656
+ // after upgrade
657
+ await showGasUsage (
658
+ await gateway [ "withdrawERC20(address,uint256,uint256)" ] ( L2_WSTETH , amountIn , 1e6 ) ,
659
+ "L2LidoGateway.withdrawERC20 wstETH after upgrade"
660
+ ) ;
661
+ await showGasUsage (
662
+ await router [ "withdrawERC20(address,uint256,uint256)" ] ( L2_WSTETH , amountIn , 1e6 ) ,
663
+ "L2GatewayRouter.withdrawERC20 wstETH after upgrade"
664
+ ) ;
665
+ } ) ;
587
666
} ) ;
588
667
} ) ;
0 commit comments