From 5e789337ab8df95259a06c3552c926a42cf821c0 Mon Sep 17 00:00:00 2001 From: Jack Frain Date: Thu, 8 Aug 2024 09:39:52 -0400 Subject: [PATCH 1/2] fix(connect): stop adding random bits to empty data in aoconnect --- connect/src/lib/message/upload-message.js | 2 +- connect/src/lib/monitor/upload-monitor.js | 2 +- connect/src/lib/spawn/upload-process.js | 2 +- connect/src/lib/unmonitor/upload-unmonitor.js | 2 +- servers/mu/src/domain/clients/signer.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/connect/src/lib/message/upload-message.js b/connect/src/lib/message/upload-message.js index a82a607ba..dd3d71b79 100644 --- a/connect/src/lib/message/upload-message.js +++ b/connect/src/lib/message/upload-message.js @@ -70,7 +70,7 @@ function buildDataWith ({ logger }) { /** * Just generate a random value for data */ - () => Resolved(Math.random().toString().slice(-4)) + () => Resolved(' ') .map(assoc('data', __, ctx)) /** * Since we generate the data value, we know it's Content-Type, diff --git a/connect/src/lib/monitor/upload-monitor.js b/connect/src/lib/monitor/upload-monitor.js index ee60bd12e..9ae0e0db1 100644 --- a/connect/src/lib/monitor/upload-monitor.js +++ b/connect/src/lib/monitor/upload-monitor.js @@ -40,7 +40,7 @@ export function uploadMonitorWith (env) { * * so just randomize data and set tags to an empty array */ - data: Math.random().toString().slice(-4), + data: ' ', tags: [] }) )) diff --git a/connect/src/lib/spawn/upload-process.js b/connect/src/lib/spawn/upload-process.js index ac4cceb30..927ad9631 100644 --- a/connect/src/lib/spawn/upload-process.js +++ b/connect/src/lib/spawn/upload-process.js @@ -61,7 +61,7 @@ function buildDataWith ({ logger }) { /** * Just generate a random value for data */ - () => Resolved(Math.random().toString().slice(-4)) + () => Resolved(' ') .map(assoc('data', __, ctx)) /** * Since we generate the data value, we know it's Content-Type, diff --git a/connect/src/lib/unmonitor/upload-unmonitor.js b/connect/src/lib/unmonitor/upload-unmonitor.js index 24b49e3eb..b02689e6f 100644 --- a/connect/src/lib/unmonitor/upload-unmonitor.js +++ b/connect/src/lib/unmonitor/upload-unmonitor.js @@ -40,7 +40,7 @@ export function uploadUnmonitorWith (env) { * * so just randomize data and set tags to an empty array */ - data: Math.random().toString().slice(-4), + data: ' ', tags: [] }) )) diff --git a/servers/mu/src/domain/clients/signer.js b/servers/mu/src/domain/clients/signer.js index 4218c9c75..9a60509bb 100644 --- a/servers/mu/src/domain/clients/signer.js +++ b/servers/mu/src/domain/clients/signer.js @@ -3,7 +3,7 @@ const { createData, ArweaveSigner } = pkg function buildAndSignWith ({ MU_WALLET }) { return async ({ processId, data, tags, anchor }) => { - data = data || Math.random().toString().slice(-4) + data = data || ' ' const signer = new ArweaveSigner(MU_WALLET) const interactionDataItem = createData(data, signer, { target: processId, anchor, tags }) From 4cc47d68979766c2fa47dec8e2601510fd051697 Mon Sep 17 00:00:00 2001 From: Jack Frain Date: Thu, 8 Aug 2024 13:02:27 -0400 Subject: [PATCH 2/2] fix(mu): add comments to data bit replacement --- connect/src/lib/message/upload-message.js | 2 +- connect/src/lib/monitor/upload-monitor.js | 2 +- connect/src/lib/spawn/upload-process.js | 2 +- connect/src/lib/unmonitor/upload-unmonitor.js | 2 +- servers/mu/src/domain/clients/signer.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/connect/src/lib/message/upload-message.js b/connect/src/lib/message/upload-message.js index dd3d71b79..16cbc1117 100644 --- a/connect/src/lib/message/upload-message.js +++ b/connect/src/lib/message/upload-message.js @@ -68,7 +68,7 @@ function buildDataWith ({ logger }) { */ () => Resolved(ctx), /** - * Just generate a random value for data + * No data is provided, so replace with one space */ () => Resolved(' ') .map(assoc('data', __, ctx)) diff --git a/connect/src/lib/monitor/upload-monitor.js b/connect/src/lib/monitor/upload-monitor.js index 9ae0e0db1..e3b5ad33f 100644 --- a/connect/src/lib/monitor/upload-monitor.js +++ b/connect/src/lib/monitor/upload-monitor.js @@ -38,7 +38,7 @@ export function uploadMonitorWith (env) { /** * No tags or data can be provided right now, * - * so just randomize data and set tags to an empty array + * so just set data to single space and set tags to an empty array */ data: ' ', tags: [] diff --git a/connect/src/lib/spawn/upload-process.js b/connect/src/lib/spawn/upload-process.js index 927ad9631..090b6656a 100644 --- a/connect/src/lib/spawn/upload-process.js +++ b/connect/src/lib/spawn/upload-process.js @@ -59,7 +59,7 @@ function buildDataWith ({ logger }) { */ () => Resolved(ctx), /** - * Just generate a random value for data + * No data is provided, so replace with one space */ () => Resolved(' ') .map(assoc('data', __, ctx)) diff --git a/connect/src/lib/unmonitor/upload-unmonitor.js b/connect/src/lib/unmonitor/upload-unmonitor.js index b02689e6f..a2c592c1e 100644 --- a/connect/src/lib/unmonitor/upload-unmonitor.js +++ b/connect/src/lib/unmonitor/upload-unmonitor.js @@ -38,7 +38,7 @@ export function uploadUnmonitorWith (env) { /** * No tags or data can be provided right now, * - * so just randomize data and set tags to an empty array + * so just set data to single space and set tags to an empty array */ data: ' ', tags: [] diff --git a/servers/mu/src/domain/clients/signer.js b/servers/mu/src/domain/clients/signer.js index 9a60509bb..493436456 100644 --- a/servers/mu/src/domain/clients/signer.js +++ b/servers/mu/src/domain/clients/signer.js @@ -3,7 +3,7 @@ const { createData, ArweaveSigner } = pkg function buildAndSignWith ({ MU_WALLET }) { return async ({ processId, data, tags, anchor }) => { - data = data || ' ' + data = data || ' ' // If no data, send a single space const signer = new ArweaveSigner(MU_WALLET) const interactionDataItem = createData(data, signer, { target: processId, anchor, tags })