Skip to content

Commit

Permalink
Remove anon from SN_USER_IDS
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis committed May 30, 2024
1 parent 93289cd commit 2c0f37e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const USER_ID = {
ad: 9,
delete: 106
}
export const SN_USER_IDS = [USER_ID.k00b, USER_ID.ek, USER_ID.sn, USER_ID.anon]
export const SN_USER_IDS = [USER_ID.k00b, USER_ID.ek, USER_ID.sn]
export const SN_NO_REWARDS_IDS = [USER_ID.anon, USER_ID.sn]
export const ANON_INV_PENDING_LIMIT = 1000
export const ANON_BALANCE_LIMIT_MSATS = 0 // disable
Expand All @@ -69,7 +69,7 @@ export const LNURLP_COMMENT_MAX_LENGTH = 1000
export const RESERVED_MAX_USER_ID = 615
export const GLOBAL_SEED = 616
export const FREEBIE_BASE_COST_THRESHOLD = 10
export const USER_IDS_BALANCE_NO_LIMIT = [...SN_USER_IDS, USER_ID.ad]
export const USER_IDS_BALANCE_NO_LIMIT = [...SN_USER_IDS, USER_ID.anon, USER_ID.ad]

// WIP ultimately subject to this list: https://ofac.treasury.gov/sanctions-programs-and-country-information
// From lawyers: north korea, cuba, iran, ukraine, syria
Expand Down
7 changes: 4 additions & 3 deletions worker/trust.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export async function trust ({ boss, models }) {
}
}

const SEED_USER_IDS = [...SN_USER_IDS, USER_ID.anon]
const MAX_DEPTH = 10
const MAX_TRUST = 1
const MIN_SUCCESS = 1
Expand Down Expand Up @@ -68,7 +69,7 @@ function trustGivenGraph (graph) {

console.timeLog('trust', 'transforming result')

const seedIdxs = SN_USER_IDS.map(id => posByUserId[id])
const seedIdxs = SEED_USER_IDS.map(id => posByUserId[id])
const isOutlier = (fromIdx, idx) => [...seedIdxs, fromIdx].includes(idx)
const sqapply = (mat, fn) => {
let idx = 0
Expand Down Expand Up @@ -150,10 +151,10 @@ async function getGraph (models) {
confidence(before - disagree, b_total - after, ${Z_CONFIDENCE})
ELSE 0 END AS trust
FROM user_pair
WHERE NOT (b_id = ANY (${SN_USER_IDS}))
WHERE NOT (b_id = ANY (${SEED_USER_IDS}))
UNION ALL
SELECT a_id AS id, seed_id AS oid, ${MAX_TRUST}::numeric as trust
FROM user_pair, unnest(${SN_USER_IDS}::int[]) seed_id
FROM user_pair, unnest(${SEED_USER_IDS}::int[]) seed_id
GROUP BY a_id, a_total, seed_id
UNION ALL
SELECT a_id AS id, a_id AS oid, ${MAX_TRUST}::float as trust
Expand Down

0 comments on commit 2c0f37e

Please sign in to comment.