Skip to content

Commit

Permalink
fix non responsive node attestation (#6966)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecsavvy authored Dec 19, 2023
1 parent 8967859 commit a46ca96
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,13 @@ const canSuccessfullyAttest = async (
challengeId,
oracleEthAddress
)
const res = await fetch(url)
return res && res.ok
try {
const res = await fetch(url)
return res && res.ok;
} catch (e) {
console.warn("Can't attest", e, url)
return false
}
}

const makeAttestationEndpoint = (
Expand Down Expand Up @@ -218,7 +223,7 @@ const getAllChallenges = async (
// select again if needed
if (!isValidNodeSet) {
possibleNodeSet = []
console.log('Node set not valid. Selecting nodes...')
console.log('Node set not valid. Selecting nodes...', possibleNodeSet)
for (const nodeGroup of groups.values()) {
if (possibleNodeSet.length === 3) {
console.log(`Got 3 nodes!: ${JSON.stringify(possibleNodeSet)}`)
Expand Down Expand Up @@ -248,9 +253,9 @@ const getAllChallenges = async (
// did we succeed?
if (possibleNodeSet.length !== 3) {
console.log(
`Could not find a valid node set for challenge: ${JSON.stringify(
challenge
)}, skipping.`
`Could not find a valid node set for challenge: ${
challenge.specifier
}, skipping.`, possibleNodeSet
)
impossibleChallenges.push(challenge)
// reset it for next time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const initAudiusLibs = async (): Promise<AudiusLibs> => {
rewardsManagerProgramId: process.env.rewardsManagerProgramId,
rewardsManagerProgramPDA: process.env.rewardsManagerProgramPDA,
rewardsManagerTokenPDA: process.env.rewardsManagerTokenPDA,
usdcMintAddress: process.env.usdcMintAddress,
useRelay: process.env.useRelay,
},
ethWeb3Config: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export const getChallengesDisbursementsUserbanks = async (
export const getChallengesDisbursementsUserbanksFriendly = async (
discoveryDb: Knex,
specifier: string
): Promise<ChallengeDisbursementUserbankFriendly[]> =>
await discoveryDb<ChallengeDisbursementUserbankFriendly>(
): Promise<ChallengeDisbursementUserbankFriendly[]> => {
const query = discoveryDb<ChallengeDisbursementUserbankFriendly>(
'user_challenges as u'
)
.select(
Expand All @@ -79,6 +79,9 @@ export const getChallengesDisbursementsUserbanksFriendly = async (
.orderBy('u.challenge_id')
.orderBy('u.specifier')

return await query
}

export const getChallengesDisbursementsUserbanksFriendlyEnsureSlots = async (
discoveryDb: Knex,
specifier: string
Expand Down

0 comments on commit a46ca96

Please sign in to comment.