Skip to content

Commit

Permalink
Merge pull request #945 from permaweb/jfrain99/remove-random-data-bits
Browse files Browse the repository at this point in the history
fix(connect): stop adding random bits to empty data in aoconnect
  • Loading branch information
jfrain99 authored Aug 19, 2024
2 parents da46b9e + 4cc47d6 commit 186414d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions connect/src/lib/message/upload-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ function buildDataWith ({ logger }) {
*/
() => Resolved(ctx),
/**
* Just generate a random value for data
* No data is provided, so replace with one space
*/
() => Resolved(Math.random().toString().slice(-4))
() => Resolved(' ')
.map(assoc('data', __, ctx))
/**
* Since we generate the data value, we know it's Content-Type,
Expand Down
4 changes: 2 additions & 2 deletions connect/src/lib/monitor/upload-monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ 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: Math.random().toString().slice(-4),
data: ' ',
tags: []
})
))
Expand Down
4 changes: 2 additions & 2 deletions connect/src/lib/spawn/upload-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ function buildDataWith ({ logger }) {
*/
() => Resolved(ctx),
/**
* Just generate a random value for data
* No data is provided, so replace with one space
*/
() => Resolved(Math.random().toString().slice(-4))
() => Resolved(' ')
.map(assoc('data', __, ctx))
/**
* Since we generate the data value, we know it's Content-Type,
Expand Down
4 changes: 2 additions & 2 deletions connect/src/lib/unmonitor/upload-unmonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ 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: Math.random().toString().slice(-4),
data: ' ',
tags: []
})
))
Expand Down
2 changes: 1 addition & 1 deletion servers/mu/src/domain/clients/signer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || ' ' // If no data, send a single space
const signer = new ArweaveSigner(MU_WALLET)

const interactionDataItem = createData(data, signer, { target: processId, anchor, tags })
Expand Down

0 comments on commit 186414d

Please sign in to comment.