From 2df4e415759ad007579d21047e55bcd2f36fa9e1 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Sat, 28 Sep 2024 09:25:03 -0400 Subject: [PATCH 1/4] chore: move some logging to debug mode --- src/tasks/payouts.ts | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/tasks/payouts.ts b/src/tasks/payouts.ts index 8e07d8f..de2c81e 100644 --- a/src/tasks/payouts.ts +++ b/src/tasks/payouts.ts @@ -6,7 +6,7 @@ import { DigChallenge, DataStore, getStoresList, - Environment + Environment, } from "@dignetwork/dig-sdk"; import { Mutex } from "async-mutex"; import { IncentiveProgram } from "../utils/IncentiveProgram"; @@ -110,7 +110,7 @@ const runIncentiveProgram = async ( console.error( `Failed to connect to peer ${peerIp}: ${error.message}` ); - // await program.addToBlacklist(peerIp); + // await program.addToBlacklist(peerIp); continue; } @@ -124,7 +124,10 @@ const runIncentiveProgram = async ( const challengePromises = randomKeysHex.map(async (hexKey) => { try { - console.log(`Generating challenge for key: ${hexKey}`); + if (Environment.DEBUG) { + console.log(`Generating challenge for key: ${hexKey}`); + } + const digChallenge = new DigChallenge( program.storeId, hexKey, @@ -134,11 +137,13 @@ const runIncentiveProgram = async ( const challenge = await digChallenge.generateChallenge(seed); const serializedChallenge = DigChallenge.serializeChallenge(challenge); - console.log( - `Sending challenge to peer ${peerIp} for key ${hexToUtf8( - hexKey - )}` - ); + if (Environment.DEBUG) { + console.log( + `Sending challenge to peer ${peerIp} for key ${hexToUtf8( + hexKey + )}` + ); + } const peerChallengeResponse = await digPeer.contentServer.getKey( hexToUtf8(hexKey), @@ -147,9 +152,11 @@ const runIncentiveProgram = async ( ); const expectedChallengeResponse = await digChallenge.createChallengeResponse(challenge); - console.log( - `Received response from peer ${peerIp}, expected response: ${expectedChallengeResponse}` - ); + if (Environment.DEBUG) { + console.log( + `Received response from peer ${peerIp}, expected response: ${expectedChallengeResponse}` + ); + } return peerChallengeResponse === expectedChallengeResponse; } catch (error: any) { console.error( From b84d27b0c19a9af67644f8b0c1a7b3f2a02b9ab1 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Sat, 28 Sep 2024 09:25:50 -0400 Subject: [PATCH 2/4] chore(release): 0.0.1-alpha.32 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e5e70..de250c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.1-alpha.32](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.31...v0.0.1-alpha.32) (2024-09-28) + ### [0.0.1-alpha.31](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.30...v0.0.1-alpha.31) (2024-09-27) diff --git a/package-lock.json b/package-lock.json index ca516e8..83cb35d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dig-incentive-server", - "version": "0.0.1-alpha.31", + "version": "0.0.1-alpha.32", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dig-incentive-server", - "version": "0.0.1-alpha.31", + "version": "0.0.1-alpha.32", "license": "ISC", "dependencies": { "@dignetwork/datalayer-driver": "^0.1.28", diff --git a/package.json b/package.json index b0bc075..2dd800f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dig-incentive-server", - "version": "0.0.1-alpha.31", + "version": "0.0.1-alpha.32", "description": "", "type": "commonjs", "main": "./dist/index.js", From 8ce45d2ac4a526dd7d1c4dc307e1c3dc88dda2be Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Sat, 28 Sep 2024 10:49:35 -0400 Subject: [PATCH 3/4] chore: move some logging to debug mode --- src/tasks/payouts.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tasks/payouts.ts b/src/tasks/payouts.ts index de2c81e..a07bdaa 100644 --- a/src/tasks/payouts.ts +++ b/src/tasks/payouts.ts @@ -116,9 +116,12 @@ const runIncentiveProgram = async ( if (response.success) { const peerGenerationHash = response.headers?.["x-generation-hash"]; - console.log( - `Peer ${peerIp} generation hash: ${peerGenerationHash}, expected: ${rootHash}` - ); + + if (Environment.DEBUG) { + console.log( + `Peer ${peerIp} generation hash: ${peerGenerationHash}, expected: ${rootHash}` + ); + } if (peerGenerationHash === rootHash) { console.log(`Peer ${peerIp} has correct generation hash.`); From aa234f9c6f01265fd6bf8eb87c42cf973b15b46b Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Sat, 28 Sep 2024 10:50:42 -0400 Subject: [PATCH 4/4] chore(release): 0.0.1-alpha.33 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de250c3..4fdc215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.1-alpha.33](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.32...v0.0.1-alpha.33) (2024-09-28) + ### [0.0.1-alpha.32](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.31...v0.0.1-alpha.32) (2024-09-28) ### [0.0.1-alpha.31](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.30...v0.0.1-alpha.31) (2024-09-27) diff --git a/package-lock.json b/package-lock.json index 83cb35d..d4b700a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dig-incentive-server", - "version": "0.0.1-alpha.32", + "version": "0.0.1-alpha.33", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dig-incentive-server", - "version": "0.0.1-alpha.32", + "version": "0.0.1-alpha.33", "license": "ISC", "dependencies": { "@dignetwork/datalayer-driver": "^0.1.28", diff --git a/package.json b/package.json index 2dd800f..7953400 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dig-incentive-server", - "version": "0.0.1-alpha.32", + "version": "0.0.1-alpha.33", "description": "", "type": "commonjs", "main": "./dist/index.js",