Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduced params for commitEmailVerificationHash() and updated test #23

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/prebuilts/account/interface/IAccountRecovery.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IAccountRecovery {
* @dev This function will be called from the Email verification service updating the user's recovery token & nounce hash.
* Nonce is to make sure that the one token is being used only once.
*/
function commitEmailVerificationHash(bytes calldata recoveryToken, uint256 recoveryTokenNonce) external;
function commitEmailVerificationHash(bytes32 emailVerificationHash) external;

/**
* @dev This function is used to generate the account recovery request.
Expand Down
7 changes: 2 additions & 5 deletions contracts/prebuilts/account/utils/AccountRecovery.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ contract AccountRecovery is IAccountRecovery {
_;
}

function commitEmailVerificationHash(
bytes calldata recoveryToken,
uint256 recoveryTokenNonce
) external onlyEmailVerificationService {
emailVerificationHash = keccak256(abi.encodePacked(recoveryToken, recoveryTokenNonce));
function commitEmailVerificationHash(bytes32 _emailVerificationHash) external onlyEmailVerificationService {
emailVerificationHash = _emailVerificationHash;
}

function generateRecoveryRequest(
Expand Down
5 changes: 3 additions & 2 deletions src/test/smart-wallet/utils/AccountRecovery.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract AccountRecoveryTest is Test {
address newEmbeddedWallet = makeAddr("newEmbeddedWallet");
address emailService = address(0xa0Ee7A142d267C1f36714E4a8F75612F20a79720); // TODO: To be updated with the wallet address of the actual email
string userEmail = "[email protected]";
uint64 nonce = 38;
uint256 nonce = 38;
bytes recoveryToken = abi.encodePacked(userEmail, emailService);

address smartWallet;
Expand Down Expand Up @@ -86,7 +86,8 @@ contract AccountRecoveryTest is Test {
vm.startPrank(emailService);
emit EmailServiceGeneratingHashUsing(recoveryToken, nonce);

accountRecovery.commitEmailVerificationHash(recoveryToken, nonce);
bytes32 emailVerificationHash = keccak256(abi.encodePacked(recoveryToken, nonce));
accountRecovery.commitEmailVerificationHash(emailVerificationHash);
vm.stopPrank();
}

Expand Down