This commit is contained in:
Jaco
2023-02-22 09:35:50 +02:00
committed by GitHub
parent 8ac03a8d61
commit d8f9064e7d
6 changed files with 362 additions and 1508 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
"version": "0.19.4-23-x",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@babel/runtime": "^7.21.0",
"@polkadot/util": "^10.4.2",
"@polkadot/util-crypto": "^10.4.2",
"@polkadot/x-fetch": "^10.4.2"
+11 -2
View File
@@ -158,11 +158,18 @@ function checkAll (): Promise<[string, string[]][]> {
}
describe('addrcheck', (): void => {
beforeAll((): void => {
jest.setTimeout(2 * 60 * 1000);
let counter = 0;
let errors = 0;
afterEach((): void => {
if (++counter === 1) {
process.exit(errors);
}
});
it('has all known addresses', async (): Promise<void> => {
errors++;
const _results = await checkAll();
const results = _results.map(([url, addrs]): [string, string[]] => {
return [url, addrs.filter((a) => {
@@ -198,5 +205,7 @@ describe('addrcheck', (): void => {
sites.length && process.env.CI_LOG && fs.appendFileSync('./.github/addrcheck.md', `\n\n${sites.length} urls with missing entries found at ${new Date().toUTCString()}:\n\n${TICKS}\n${JSON.stringify(mapMiss, null, 2)}\n${TICKS}\n`);
expect(sites).toEqual([]);
errors--;
});
});
+15 -2
View File
@@ -3,6 +3,7 @@
import fs from 'fs';
import { load as yamlParse } from 'js-yaml';
import process from 'process';
import { fetchJson, fetchText } from './fetch';
@@ -50,12 +51,18 @@ const ETHPHISH = 'https://raw.githubusercontent.com/MetaMask/eth-phishing-detect
describe('crosscheck', (): void => {
const ours: string[] = ourSiteList.deny;
let counter = 0;
let errors = 0;
beforeAll((): void => {
jest.setTimeout(120000);
afterEach((): void => {
if (++counter === 2) {
process.exit(errors);
}
});
it('has all the relevant entries from CryptoScamDb', async (): Promise<void> => {
errors++;
const raw = await fetchText(CRYPTODB);
// this is a hack, the text slipped in upstream
@@ -69,9 +76,13 @@ describe('crosscheck', (): void => {
console.log('CryptoScamDb missing\n', JSON.stringify(missing, null, 2));
assertAndLog(missing.length === 0, 'CryptoScamDB', missing);
errors--;
});
it('has polkadot/kusama entries from eth-phishing-detect', async (): Promise<void> => {
errors++;
const ethDb = await fetchJson<EthPhishing>(ETHPHISH);
const filtered = ethDb.blacklist.filter((url) => matchName(url));
const missing = filtered.filter((url) => !ours.includes(url));
@@ -80,5 +91,7 @@ describe('crosscheck', (): void => {
console.log('eth-phishing-detect missing\n', JSON.stringify(missing, null, 2));
assertAndLog(missing.length === 0, 'eth-phishing-detect', missing);
errors--;
});
});