diff --git a/lib/preprocess.js b/lib/preprocess.js index 9733a9ce..b7fdc519 100644 --- a/lib/preprocess.js +++ b/lib/preprocess.js @@ -59,6 +59,11 @@ const fetchMeasurements = async (web3Storage, cid) => { } export const parseParticipantAddress = filWalletAddress => { + // ETH addresses don't need any conversion + if (filWalletAddress.startsWith('0x')) { + return filWalletAddress + } + if (!filWalletAddress || filWalletAddress.startsWith('f1') || filWalletAddress.startsWith('t1')) { // As a temporary fix to allow us to build & test the fraud detection pipeline, // we assign measurements from f1/t1 addresses to the same 0x participant. diff --git a/test/preprocess.js b/test/preprocess.js index aa53bc90..5202f0d4 100644 --- a/test/preprocess.js +++ b/test/preprocess.js @@ -86,4 +86,9 @@ describe('preprocess', () => { const converted = parseParticipantAddress('t17uoq6tp427uzv7fztkbsnn64iwotfrristwpryy') assert.strictEqual(converted, '0xf100Ac342b7DE48e5c89f7029624eE6c3Cde68aC') }) + + it('accepts ETH 0x address', () => { + const converted = parseParticipantAddress('0x3356fd7D01F001f5FdA3dc032e8bA14E54C2a1a1') + assert.strictEqual(converted, '0x3356fd7D01F001f5FdA3dc032e8bA14E54C2a1a1') + }) })