Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Wallet key recovery #72

Merged
merged 7 commits into from
Dec 23, 2021
Merged

Wallet key recovery #72

merged 7 commits into from
Dec 23, 2021

Conversation

jzaki
Copy link
Collaborator

@jzaki jzaki commented Dec 22, 2021

What is this PR doing?

Adding recovery functionality to wallets

How can these changes be manually tested?

yarn hardhat test from contracts

Does this PR resolve or contribute to any issues?

Closes #70

Checklist

  • I have manually tested these changes
  • Post a link to the PR in the group chat

Guidelines

  • If your PR is not ready, mark it as a draft
  • The resolve conversation button is for reviewers, not authors
    • (But add a 'done' comment or similar)

@jzaki jzaki requested a review from jacque006 December 22, 2021 12:54
@github-actions github-actions bot added the contracts Smart contract related label Dec 22, 2021
Copy link
Collaborator

@jacque006 jacque006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Solid test coverage as well

Comment on lines +17 to +59
bytes32 public recoveryHash;
bytes32 pendingRecoveryHash;
uint256 pendingRecoveryHashTime;
bytes public approvedProxyAdminFunction;
bytes pendingPAFunction;
uint256 pendingPAFunctionTime;

// BLS variables
uint256[4] public blsPublicKey;
uint256[4] pendingBLSPublicKey;
uint256 pendingBLSPublicKeyTime;
address public trustedBLSGateway;
address pendingBLSGateway;
uint256 pendingGatewayTime;

event PendingRecoveryHashSet(
bytes32 pendingRecoveryHash
);
event PendingBLSKeySet(
uint256[4] pendingBLSKey
);
event PendingGatewaySet(
address pendingGateway
);
event PendingProxyAdminFunctionSet(
bytes pendingProxyAdminFunction
);

event RecoveryHashUpdated(
bytes32 oldHash,
bytes32 newHash
);
event BLSKeySet(
uint256[4] oldBLSKey,
uint256[4] newBLSKey
);
event GatewayUpdated(
address oldGateway,
address newGateway
);
event ProxyAdminFunctionApproved(
bytes approvedProxyAdmin
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to consider for the future would be to break this down into separate abstract component contracts that manage the state/pending/recovery of these sensitive fields. i.e. blsPublicKey and its pending fields, events, mutators, and set pending calls, then have BLSWallet inherit them. This would reduce the code size/complexity of BLSWallet.sol, and make it easier to break out isolated unit test suites for them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, at that stage it would be good to factor in upgradability of wallets (bls and potentially non-bls). Which needs to consider the inheritance order since memory locations when upgrading are important. -> Created #73

@jzaki jzaki merged commit 87e115b into main Dec 23, 2021
@jzaki jzaki deleted the wallet-key-recovery branch December 23, 2021 00:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contracts Smart contract related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BLSWallet recovery
2 participants