Skip to content

Commit

Permalink
comment realWorld test case
Browse files Browse the repository at this point in the history
  • Loading branch information
imduchuyyy committed Jun 28, 2024
1 parent a47df92 commit eb0dc34
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions test/Wallet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@ contract WalletTest is Test {
entryPoint.handleOps(ops, beneficiary);
}

function testWalletPasskey() external {
bytes32 salt = keccak256("testCreateWalletWithPasskey");
PasskeyModule passkeyModule = walletFactory.createPasskey(
28203248099655634232680422976510411012986437076966613883671554831358983509938,
79473938854726638551736530376995476499049493858003728502280535141260854783821,
salt
);

UserOperation memory op = entryPoint.fillUserOp(address(0), "");
bytes memory signature =
hex"00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001eb6f6689e7b96f60dcae3542888f9d094a9abb8e04bd391104d6ee79a9f0967d3bc293dc51c51b23f9063ae81bb2e4a99b520f5f04cda804f0dd80b4c8d7f353000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22644c4836595a6f78345332616a6f4e4a384c374d47734657436c75584c6258514a62306e466c7377685930222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000";
op.signature = abi.encodePacked(address(passkeyModule), signature);
// function testWalletPasskey() external {
// bytes32 salt = keccak256("testCreateWalletWithPasskey");
// PasskeyModule passkeyModule = walletFactory.createPasskey(
// 28203248099655634232680422976510411012986437076966613883671554831358983509938,
// 79473938854726638551736530376995476499049493858003728502280535141260854783821,
// salt
// );

// UserOperation memory op = entryPoint.fillUserOp(address(0), "");
// bytes memory signature =
// hex"00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001eb6f6689e7b96f60dcae3542888f9d094a9abb8e04bd391104d6ee79a9f0967d3bc293dc51c51b23f9063ae81bb2e4a99b520f5f04cda804f0dd80b4c8d7f353000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22644c4836595a6f78345332616a6f4e4a384c374d47734657436c75584c6258514a62306e466c7377685930222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000";
// op.signature = abi.encodePacked(address(passkeyModule), signature);

vm.startPrank(address(entryPoint));
// vm.startPrank(address(entryPoint));

wallet.addKey(address(passkeyModule));
uint256 valid = wallet.validateUserOp(op, 0x74b1fa619a31e12d9a8e8349f0becc1ac1560a5b972db5d025bd27165b30858d, 0);
// wallet.addKey(address(passkeyModule));
// uint256 valid = wallet.validateUserOp(op, 0x74b1fa619a31e12d9a8e8349f0becc1ac1560a5b972db5d025bd27165b30858d, 0);

console.log("valid", valid);
// console.log("valid", valid);

}
// }

function test_SendEth() external {
vm.deal(address(wallet), 1 ether);
Expand Down Expand Up @@ -128,37 +128,37 @@ contract WalletTest is Test {
_logKey();
}

function testPasskeySigner() external {
bytes32 salt = 0x928c5170d19f5bfc6e4e688388ee5698d6433f0629b216ee89bab1fe65aa92e1;
console.logBytes32(salt);
uint256 x = 57354212301228404074007314998280670312526661933892141818826008780783055520895;
uint256 y = 25303925085401504347584682025814887674906274142473434094161374620451608452689;
// function testPasskeySigner() external {
// bytes32 salt = 0x928c5170d19f5bfc6e4e688388ee5698d6433f0629b216ee89bab1fe65aa92e1;
// console.logBytes32(salt);
// uint256 x = 57354212301228404074007314998280670312526661933892141818826008780783055520895;
// uint256 y = 25303925085401504347584682025814887674906274142473434094161374620451608452689;

EntryPoint realWorldEntryPoint = EntryPoint(payable(0x7e33db170e8b1FF05599064405fdF1F06b7d7D75));
WalletFactory realWorldFactory = WalletFactory(0x4077317dbD603DB74a96808C70545302f833965E);
// EntryPoint realWorldEntryPoint = EntryPoint(payable(0x7e33db170e8b1FF05599064405fdF1F06b7d7D75));
// WalletFactory realWorldFactory = WalletFactory(0x4077317dbD603DB74a96808C70545302f833965E);

Wallet realWorldWallet = Wallet(realWorldFactory.getWalletAddress(salt));
PasskeyModule realWorldPasskey = realWorldFactory.createPasskey(x, y, salt);
// Wallet realWorldWallet = Wallet(realWorldFactory.getWalletAddress(salt));
// PasskeyModule realWorldPasskey = realWorldFactory.createPasskey(x, y, salt);

console.log(address(realWorldPasskey));
// console.log(address(realWorldPasskey));

UserOperation memory op = entryPoint.fillUserOp(address(realWorldWallet), "");
op.initCode = hex'2094DC38C48F12BFd6B3732695Ba23673e2Bd38480d1bfde7ecd55725b011adf060acd7d4ea294360d148717f9f9567d6920c5861fc7c47f37f18399a20f8fa5deac08f455d6e56b32d3aabf8f889bb04c1ccc9bfe5bde51928c5170d19f5bfc6e4e688388ee5698d6433f0629b216ee89bab1fe65aa92e1';
op.callData = hex'b61d27f6000000000000000000000000674a25787b18938919bd84f37f0f774651a0c40f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000';
op.signature = hex'F1cBf96412c21F66C31eC93cE43E86fEd8473dE100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001bde8ddcdc6b370a2d51cf9e0c33cd1af2b3db4c2cac6137da3220e03d48a707e84c9df7c4b2fb740de3e2095f16a2f6b408efb65580faee269e7250fd2aaa6b5000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a226a5f4361324730484c656959344f6a38444152356643536c3552483776424253514e734141722d57763877222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000';
// UserOperation memory op = entryPoint.fillUserOp(address(realWorldWallet), "");
// op.initCode = hex'2094DC38C48F12BFd6B3732695Ba23673e2Bd38480d1bfde7ecd55725b011adf060acd7d4ea294360d148717f9f9567d6920c5861fc7c47f37f18399a20f8fa5deac08f455d6e56b32d3aabf8f889bb04c1ccc9bfe5bde51928c5170d19f5bfc6e4e688388ee5698d6433f0629b216ee89bab1fe65aa92e1';
// op.callData = hex'b61d27f6000000000000000000000000674a25787b18938919bd84f37f0f774651a0c40f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000';
// op.signature = hex'F1cBf96412c21F66C31eC93cE43E86fEd8473dE100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001bde8ddcdc6b370a2d51cf9e0c33cd1af2b3db4c2cac6137da3220e03d48a707e84c9df7c4b2fb740de3e2095f16a2f6b408efb65580faee269e7250fd2aaa6b5000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a226a5f4361324730484c656959344f6a38444152356643536c3552483776424253514e734141722d57763877222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000';

bytes32 digest = realWorldEntryPoint.getUserOpHash(op);
// bytes32 digest = realWorldEntryPoint.getUserOpHash(op);

console.logBytes32(digest);
// console.logBytes32(digest);

UserOperation[] memory ops = new UserOperation[](1);
ops[0] = op;
// UserOperation[] memory ops = new UserOperation[](1);
// ops[0] = op;

uint256 value = realWorldPasskey.validateUserOp(op, 0x8ff09ad86d072de898e0e8fc0c04797c24a5e511fbbc105240db0002bf96bfcc);
console.log(value);
// uint256 value = realWorldPasskey.validateUserOp(op, 0x8ff09ad86d072de898e0e8fc0c04797c24a5e511fbbc105240db0002bf96bfcc);
// console.log(value);

// realWorldEntryPoint.handleOps(ops, beneficiary);
}
// // realWorldEntryPoint.handleOps(ops, beneficiary);
// }

function testRealWorldData() external {
(bool success, bytes memory message) = address(0x7e33db170e8b1FF05599064405fdF1F06b7d7D75).call(hex'1fad948c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000049827013c5a9ac04136ba5576b0dd56408daef34000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000004db08ad2167a9bf7731d49f9fae186b946fbd31900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000005b8d8000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000784077317dbd603db74a96808c70545302f833965e80d1bfded393fc3c8ed8985abcff7e0f0e392f2b5fa6b0910fd46fae72724823384d7fbde5c5fae8faa35c1dd0be3217266b34df2537eb11df0fd9233cc23cc491d18cdc8fb8f66d2f353aabd1488ce4f513785387c5ca8442a14ec1ada49a8cd1168c5700000000000000000000000000000000000000000000000000000000000000000000000000000084b61d27f60000000000000000000000004db08ad2167a9bf7731d49f9fae186b946fbd31900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002147f6dc2bcd32efe83bce0657a5d22940db91f2832000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001f9b8f3ca588191c6a6dd086c19db3192cf09ca9a9d96b384c4cbd34e4eaa05e8111fec54a8c7aee3d8d8b14fac5305664084948b5bdb08aabe4a9696964a84c7000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a223162754b6f596730687a3846716f4b566c4b36497036447076474363564871635435577771304358506951222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000000000000000000000000000');
Expand Down

0 comments on commit eb0dc34

Please sign in to comment.