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

Commit

Permalink
Remove signatureExpiryTimestamp from setBLSKeyForWallet
Browse files Browse the repository at this point in the history
Remove signatureExpiryTimestamp param from setBLSKeyForWallet as it is no longer used.
Rework branching logic in setBLSKeyForWallet to use single if.
  • Loading branch information
jacque006 committed Jun 27, 2023
1 parent 906538a commit 3251dec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
11 changes: 4 additions & 7 deletions contracts/contracts/VerificationGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,17 @@ contract VerificationGateway
@dev overrides previous wallet address registered with the given public key
@param messageSenderSignature signature of message containing only the calling address
@param publicKey that signed the caller's address
@param signatureExpiryTimestamp that the signature is valid until
*/
function setBLSKeyForWallet(
uint256[2] memory messageSenderSignature,
uint256[BLS_KEY_LEN] memory publicKey,
uint256 signatureExpiryTimestamp
uint256[BLS_KEY_LEN] memory publicKey
) public {
require(blsLib.isZeroBLSKey(publicKey) == false, "VG: key is zero");
IWallet wallet = IWallet(msg.sender);
bytes32 existingHash = hashFromWallet[wallet];
if (existingHash == bytes32(0)) { // wallet does not yet have a bls key registered with this gateway
// Can't register new wallet contracts, only what this gateway deployed.
}
else { // wallet already has a key registered, set after delay

// Can't register new wallet contracts, only what this gateway deployed.
if (existingHash != bytes32(0)) { // wallet already has a key registered, set after delay
pendingMessageSenderSignatureFromHash[existingHash] = messageSenderSignature;
pendingBLSPublicKeyFromHash[existingHash] = publicKey;
pendingBLSPublicKeyTimeFromHash[existingHash] = block.timestamp + 604800; // 1 week from now
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/recovery-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe("Recovery", async function () {
wallet1,
vg,
"setBLSKeyForWallet",
[addressSignature, wallet2.PublicKey(), signatureExpiryTimestamp],
[addressSignature, wallet2.PublicKey()],
1,
30_000_000,
);
Expand Down Expand Up @@ -372,7 +372,7 @@ describe("Recovery", async function () {
wallet1,
vg,
"setBLSKeyForWallet",
[attackSignature, walletAttacker.PublicKey(), signatureExpiryTimestamp],
[attackSignature, walletAttacker.PublicKey()],
recoveredWalletNonce++,
30_000_000,
);
Expand Down Expand Up @@ -660,7 +660,7 @@ describe("Recovery", async function () {
wallet1,
vg,
"setBLSKeyForWallet",
[addressSignature, wallet2.PublicKey(), invalidSignatureExpiryTimestamp],
[addressSignature, wallet2.PublicKey()],
1,
30_000_000,
);
Expand Down Expand Up @@ -724,7 +724,7 @@ describe("Recovery", async function () {
wallet1,
vg,
"setBLSKeyForWallet",
[addressSignature, wallet2.PublicKey(), signatureExpiryTimestamp],
[addressSignature, wallet2.PublicKey()],
1,
30_000_000,
);
Expand Down
1 change: 0 additions & 1 deletion contracts/test/upgrade-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ describe("Upgrade", async function () {
encodedFunction: vg1.interface.encodeFunctionData("setBLSKeyForWallet", [
addressSignature,
wallet2.PublicKey(),
signatureExpiryTimestamp,
]),
};

Expand Down

0 comments on commit 3251dec

Please sign in to comment.