[internal] Do not automatically add tokens to denylist (#4847)

* Do not automatically add tokens to denylist.

* Removed orphan check; that case is OK

Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
Adam R 2020-11-19 10:18:14 +01:00 committed by GitHub
parent 2ea872b1fc
commit fa6bba6228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,14 +32,17 @@ async function checkUpdateAllowDenyList(chain: string, checkOnly: boolean ): Pro
if (commonElementsOrDuplicates && commonElementsOrDuplicates.length > 0) {
errorMsgs.push(`Denylist and allowlist for chain ${chain} should have no common elements or duplicates, found ${commonElementsOrDuplicates.length} ${commonElementsOrDuplicates[0]}`);
}
/*
const allowlistOrphan = arrayDiff(currentAllowlist, assets);
if (allowlistOrphan && allowlistOrphan.length > 0) {
// warning only
warningMsgs.push(`Allowlist for chain ${chain} contains non-exitent assets, found ${allowlistOrphan.length}, ${allowlistOrphan[0]}`);
}
*/
const newDeny = makeUnique(currentDenylist.concat(allowlistOrphan));
const newAllow = makeUnique(arrayDiffNocase(assets, newDeny));
//const newDeny = makeUnique(currentDenylist.concat(allowlistOrphan));
const tempAssetsOrAllow = makeUnique(currentAllowlist.concat(assets));
const newAllow = makeUnique(arrayDiffNocase(tempAssetsOrAllow, currentDenylist));
//console.log(currentAllowlist.length, "vs.", newAllow.length);
//console.log(currentDenylist.length, "vs.", newDeny.length);
@ -54,6 +57,7 @@ async function checkUpdateAllowDenyList(chain: string, checkOnly: boolean ): Pro
warningMsgs.push(`Some elements should be removed from allowlist for chain ${chain}: ${wDiff2.length} ${wDiff2[0]}`);
}
/*
const bDiff1 = arrayDiffNocase(newDeny, currentDenylist);
if (bDiff1.length > 0) {
warningMsgs.push(`Some elements are missing from denylist for chain ${chain}: ${bDiff1.length} ${bDiff1[0]}`);
@ -62,13 +66,14 @@ async function checkUpdateAllowDenyList(chain: string, checkOnly: boolean ): Pro
if (bDiff2.length > 0) {
warningMsgs.push(`Some elements should be removed from denylist for chain ${chain}: ${bDiff2.length} ${bDiff2[0]}`);
}
*/
// additionally check for nice formatting, sorting:
const newAllowText = formatSortJson(newAllow);
const newDenyText = formatSortJson(newDeny);
if (newAllowText !== currentAllowlistText) {
warningMsgs.push(`Allowlist for chain ${chain}: not formatted nicely `);
}
const newDenyText = formatSortJson(currentDenylist); // formatSortJson(newDeny);
if (newDenyText !== currentDenylistText) {
warningMsgs.push(`Denylist for chain ${chain}: not formatted nicely `);
}