@@ -41,16 +41,20 @@ contract EndToEndTest is SmartWalletTestBase {
4141
4242 // Native ETH transfer comparison between ERC-4337 and EOA
4343 function test_transfer_native () public {
44+ // Dust recipient to control for gas increase for first non-zero balance
45+ vm.deal (address (0x1234 ), 1 wei);
46+ usdc.mint (eoaUser, 1 wei);
47+
4448 userOpCalldata = abi.encodeCall (CoinbaseSmartWallet.execute, (address (0x1234 ), 1 ether, "" ));
4549 UserOperation memory op = _getUserOpWithSignature ();
4650
4751 bytes memory handleOpsCalldata = abi.encodeCall (entryPoint.handleOps, (_makeOpsArray (op), payable (bundler)));
48- console2.log ("test_transfer_native ERC-4337 calldata size: " , handleOpsCalldata.length );
52+ console2.log ("test_transfer_native Base Account calldata size: " , handleOpsCalldata.length );
4953
50- vm.startSnapshotGas ("e2e_transfer_native_4337 " );
54+ vm.startSnapshotGas ("e2e_transfer_native_baseAccount " );
5155 _sendUserOperation (op);
5256 uint256 gas4337 = vm.stopSnapshotGas ();
53- console2.log ("test_transfer_native ERC-4337 gas: " , gas4337);
57+ console2.log ("test_transfer_native Base Account gas: " , gas4337);
5458
5559 console2.log ("test_transfer_native EOA calldata size: " , uint256 (0 ));
5660
@@ -59,24 +63,28 @@ contract EndToEndTest is SmartWalletTestBase {
5963 payable (address (0x1234 )).transfer (1 ether);
6064 uint256 gasEOA = vm.stopSnapshotGas ();
6165 console2.log ("test_transfer_native EOA gas: " , gasEOA);
62- console2.log ("Gas overhead (4337/ EOA): " , (gas4337 * 100 ) / gasEOA, "% " );
66+ console2.log ("Gas overhead (4337 Base Account / EOA): " , (gas4337 * 100 ) / gasEOA, "% " );
6367 }
6468
6569 // ERC20 transfer comparison between ERC-4337 and EOA
6670 function test_transfer_erc20 () public {
71+ // Dust recipient to control for gas increase for first non-zero balance
72+ vm.deal (address (0x5678 ), 1 wei);
73+ usdc.mint (eoaUser, 1 wei);
74+
6775 userOpCalldata = abi.encodeCall (
6876 CoinbaseSmartWallet.execute,
6977 (address (usdc), 0 , abi.encodeCall (usdc.transfer, (address (0x5678 ), 100e6 )))
7078 );
7179 UserOperation memory op = _getUserOpWithSignature ();
7280
7381 bytes memory handleOpsCalldata = abi.encodeCall (entryPoint.handleOps, (_makeOpsArray (op), payable (bundler)));
74- console2.log ("test_transfer_erc20 ERC-4337 calldata size: " , handleOpsCalldata.length );
82+ console2.log ("test_transfer_erc20 Base Account calldata size: " , handleOpsCalldata.length );
7583
76- vm.startSnapshotGas ("e2e_transfer_erc20_4337 " );
84+ vm.startSnapshotGas ("e2e_transfer_erc20_baseAccount " );
7785 _sendUserOperation (op);
7886 uint256 gas4337 = vm.stopSnapshotGas ();
79- console2.log ("test_transfer_erc20 ERC-4337 gas: " , gas4337);
87+ console2.log ("test_transfer_erc20 Base Account gas: " , gas4337);
8088
8189 bytes memory eoaCalldata = abi.encodeCall (usdc.transfer, (address (0x5678 ), 100e6 ));
8290 console2.log ("test_transfer_erc20 EOA calldata size: " , eoaCalldata.length );
@@ -86,7 +94,7 @@ contract EndToEndTest is SmartWalletTestBase {
8694 usdc.transfer (address (0x5678 ), 100e6 );
8795 uint256 gasEOA = vm.stopSnapshotGas ();
8896 console2.log ("test_transfer_erc20 EOA gas: " , gasEOA);
89- console2.log ("Gas overhead (4337/ EOA): " , (gas4337 * 100 ) / gasEOA, "% " );
97+ console2.log ("Gas overhead (4337 Base Account / EOA): " , (gas4337 * 100 ) / gasEOA, "% " );
9098 }
9199
92100 function _makeOpsArray (UserOperation memory op ) internal pure returns (UserOperation[] memory ) {
0 commit comments