Skip to content

Commit

Permalink
chore: clarify var name
Browse files Browse the repository at this point in the history
  • Loading branch information
mds1 committed Sep 11, 2023
1 parent 3912fd1 commit 380155d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions umbra-js/src/classes/Umbra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { KeyPair } from './KeyPair';
import { RandomNumber } from './RandomNumber';
import {
blockedStealthAddresses,
invalidStealthAddresses,
getEthSweepGasInfo,
lookupRecipient,
assertSupportedAddress,
Expand Down Expand Up @@ -846,7 +846,7 @@ export async function assertSufficientBalance(signer: JsonRpcSigner | Wallet, to

export function assertValidStealthAddress(stealthAddress: string) {
// Ensure that the stealthKeyPair's address is not on the block list
if (blockedStealthAddresses.includes(stealthAddress)) throw new Error(`Invalid stealth address: ${stealthAddress}`);
if (invalidStealthAddresses.includes(stealthAddress)) throw new Error(`Invalid stealth address: ${stealthAddress}`);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions umbra-js/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const lengths = {

// Define addresses that should never be used as the stealth address. If you're sending to these a mistake was
// made somewhere and the funds will not be accessible. Ensure any addresses added to this list are checksum addresses
export const blockedStealthAddresses = [
export const invalidStealthAddresses = [
AddressZero,
'0xdcc703c0E500B653Ca82273B7BFAd8045D85a470', // generated from hashing an empty public key, e.g. keccak256('0x')
'0x59274E3aE531285c24e3cf57C11771ecBf72d9bf', // generated from hashing the zero public key, e.g. keccak256('0x000...000')
Expand Down Expand Up @@ -670,7 +670,7 @@ export async function assertSupportedAddress(recipientId: string) {
'0xffbac21a641dcfe4552920138d90f3638b3c9fba',
].map(getAddress);

const invalidAddresses = new Set([...blockedStealthAddresses, ...bannedAddresses]);
const invalidAddresses = new Set([...invalidStealthAddresses, ...bannedAddresses]);
if (invalidAddresses.has(getAddress(address))) throw new Error(errMsg);

// Next we check against the Chainalysis contract.
Expand Down
6 changes: 3 additions & 3 deletions umbra-js/test/Umbra.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { parseOverrides, assertSufficientBalance, assertValidStealthAddress } from '../src/classes/Umbra';
import { UMBRA_BATCH_SEND_ABI } from '../src/utils/constants';
import { KeyPair } from '../src';
import { blockedStealthAddresses } from '../src/utils/utils';
import { invalidStealthAddresses } from '../src/utils/utils';

const { parseEther } = ethers.utils;
const ethersProvider = ethers.provider;
Expand Down Expand Up @@ -888,8 +888,8 @@ describe('Umbra class', () => {
});

it('should throw an error for a blocked stealth address', () => {
for (const blockedAddress of blockedStealthAddresses) {
expect(() => assertValidStealthAddress(blockedAddress)).to.throw(`Invalid stealth address: ${blockedAddress}`);
for (const invalidAddress of invalidStealthAddresses) {
expect(() => assertValidStealthAddress(invalidAddress)).to.throw(`Invalid stealth address: ${blockedAddress}`);
}
});
});
Expand Down

0 comments on commit 380155d

Please sign in to comment.