Not sure which dev is best to tag here @joshuef
I see that client now has chunk_artifacts give a name to the chunks directory according to the filename (with path/filename hashed). I worked this out when I noticed the bug
tl;dr if the file contents change then the uploader does not generate new chunks but reuses the ones from a previous upload of that file. Resulting in the new version not being uploaded
More research details
There is a bug in the client, (safe files upload testfile)
- Tested on a local network with SAFE_PEERS set to local network peer
and SN_LOG=v - The filename was the same but the contents were changed
- There was 3 versions of the testfile. The contents consisted of one line of 32 chars
and terminated with normal unix new line character - wallet had no funds
- chunk_artifacts directory of the chunks is not removed upon completion of the upload by
the client uploader
Below is the 3 attempts without touching the client or chunk_artifacts directories
Below those is the reattempt of contents 2 & 3 but removal of chunk_artifacts directory prior to attempt
Conclusion
If the filename is the same then the client reuses the chunk_artifacts directory
which results in the same chunks as previously being uploaded without consideration
that the contents could have changed
Consequences
For those who save their documents multiple times while
working on them will lose all subsquent changes to their files/documents
This means it is useless for workers who are updating files/documents/projects
by simply saving the files.
Workings & Findings
Attempt 1 (xor/hash correct) client directory empty
File contents: c4ca4238a0b923820dcc509a6f75849b
The 3 xor/hash of the 3 chunks
[2024-08-30T05:38:44.093807Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(593be5 - f1b33f5b88515c636dce94623d1605e0b7b672d37f8ca4e97a009547519a0ffe)
[2024-08-30T05:38:44.094082Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(c71aa7 - 4d6b9b8ced36d35f21b77a4ad764aa05a49279e461d1872277da786207d73171)
[2024-08-30T05:38:44.094163Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(7c8d07 - c0c6887d09b966eefa4f9d6d425402bc3539536aca3787897676ebe778400a51)
ls listing of the chunk_artifacts directory
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*
total 4
drwxr-xr-x 2 autonomi2 autonomi2 4096 Aug 30 15:38 5eb77fd8260350333ead4408ab383cb4d0cf1a1d03a0bdd2e5e24ae17f12b667
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*/5eb*
total 16
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 593be5a41c64879897b1bd3fd08def3f6183bfad29b2b4b85e1a8beca417ac05
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 7c8d0744708ac91f92b6be14cb847ab1e9b3fa2f31a52b7fb55acd182e7c32f0
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 c71aa7018fecc8764a02ad3db249e0728a2c7c00ecfeb52c3f1f8acd5e166960
-rw-r–r-- 1 autonomi2 autonomi2 383 Aug 30 15:38 metadata
Attempt 2
- Filename same as attempt 1
- Contents different to attempt 1
File contents: c81e728d9d4c2f636f067f89cc14862c
The 3 xor/hash of the 3 chunks
[2024-08-30T05:41:14.743079Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(593be5 - f1b33f5b88515c636dce94623d1605e0b7b672d37f8ca4e97a009547519a0ffe)
[2024-08-30T05:41:14.743913Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(c71aa7 - 4d6b9b8ced36d35f21b77a4ad764aa05a49279e461d1872277da786207d73171)
[2024-08-30T05:41:14.743953Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(7c8d07 - c0c6887d09b966eefa4f9d6d425402bc3539536aca3787897676ebe778400a51)
ls listing of the chunk_artifacts directory
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*
total 4
drwxr-xr-x 2 autonomi2 autonomi2 4096 Aug 30 15:38 5eb77fd8260350333ead4408ab383cb4d0cf1a1d03a0bdd2e5e24ae17f12b667
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*/5eb*
total 16
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 593be5a41c64879897b1bd3fd08def3f6183bfad29b2b4b85e1a8beca417ac05
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 7c8d0744708ac91f92b6be14cb847ab1e9b3fa2f31a52b7fb55acd182e7c32f0
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 c71aa7018fecc8764a02ad3db249e0728a2c7c00ecfeb52c3f1f8acd5e166960
-rw-r–r-- 1 autonomi2 autonomi2 383 Aug 30 15:38 metadata
Attempt 3
- Filename same as attempt 1
- Contents different to attempts 1 & 2
File contents: eccbc87e4b5ce2fe28308fd9f2a7baf3
The 3 xor/hash of the 3 chunks
[2024-08-30T05:43:13.619612Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(c71aa7 - 4d6b9b8ced36d35f21b77a4ad764aa05a49279e461d1872277da786207d73171)
[2024-08-30T05:43:13.619926Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(593be5 - f1b33f5b88515c636dce94623d1605e0b7b672d37f8ca4e97a009547519a0ffe)
[2024-08-30T05:43:13.619974Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(7c8d07 - c0c6887d09b966eefa4f9d6d425402bc3539536aca3787897676ebe778400a51)
ls listing of the chunk_artifacts directory
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*
total 4
drwxr-xr-x 2 autonomi2 autonomi2 4096 Aug 30 15:38 5eb77fd8260350333ead4408ab383cb4d0cf1a1d03a0bdd2e5e24ae17f12b667
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*/5eb*
total 16
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 593be5a41c64879897b1bd3fd08def3f6183bfad29b2b4b85e1a8beca417ac05
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 7c8d0744708ac91f92b6be14cb847ab1e9b3fa2f31a52b7fb55acd182e7c32f0
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:38 c71aa7018fecc8764a02ad3db249e0728a2c7c00ecfeb52c3f1f8acd5e166960
-rw-r–r-- 1 autonomi2 autonomi2 383 Aug 30 15:38 metadata
Attempt 4
- Filename same as attempt 1
- Contents same as attempt 2
- Removed the clients directory
File contents: c81e728d9d4c2f636f067f89cc14862c
Directory removal command
autonomi2@localhost:~/tstclient> rm -r ~/.local/share/safe/client/*
The 3 xor/hash of the 3 chunks
[2024-08-30T05:46:38.673352Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(5a84fa - a0b0d2bf8fcd49b2ad6cd2bdb51b2a08bed5fc71b08c1db141657f46d5c0a06a)
[2024-08-30T05:46:38.679458Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(21c670 - ac199813d74c8754ba69857bddadd9c252f41ec9a718f17cca67c3d266aa6fe4)
[2024-08-30T05:46:38.679675Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(3e1683 - 65a4f55b64de7e13be225ee6a492c10753a0991ab4876ceef8cbed5cc06fd7cb)
ls listing of the chunk_artifacts directory
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*
total 4
drwxr-xr-x 2 autonomi2 autonomi2 4096 Aug 30 15:46 5eb77fd8260350333ead4408ab383cb4d0cf1a1d03a0bdd2e5e24ae17f12b667
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*/5eb*
total 16
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:46 21c67020ba2db03f9d20c5086392e1880dc53c64eb39278b1839c5090b3e560b
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:46 3e1683066d0c53e66520ab71d10a5595cf351049a67d50c7d502203eb9bf9a09
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:46 5a84fa53525ee73685d53b116e51d6177d193a4c10097a8f86cfc865bad1e4b0
-rw-r–r-- 1 autonomi2 autonomi2 369 Aug 30 15:46 metadata
Attempt 5
- Filename same as attempt 1
- Contents same as attempt 3
- Removed chunk_artifacts directory
File contents: eccbc87e4b5ce2fe28308fd9f2a7baf3
Directory removal command
autonomi2@localhost:~/tstclient> rm -r ~/.local/share/safe/client/chunk*
The 3 xor/hash of the 3 chunks
[2024-08-30T05:49:56.024969Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(ea1c4b - 71af910815ebf73b0db8dd615381b32a96981b71406cdbacca86f6f87ca31a62)
[2024-08-30T05:49:56.025014Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(69aa61 - 6bea9295741678d91fba236553817feeab01600271b8d453c70469a356cceb72)
[2024-08-30T05:49:56.025032Z DEBUG sn_networking] Getting the closest peers to NetworkAddress::ChunkAddress(abb106 - a0581e16e58d86d781e72260b6992619aea8e0a357365ceec15eff55b96e7fb5)
ls listing of the chunk_artifacts directory
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*
total 4
drwxr-xr-x 2 autonomi2 autonomi2 4096 Aug 30 15:49 5eb77fd8260350333ead4408ab383cb4d0cf1a1d03a0bdd2e5e24ae17f12b667
autonomi2@localhost:~/tstclient> ls -l ~/.local/share/safe/client/chunk*/5eb*
total 16
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:49 69aa61afb634939acb35b7188a5e70c829cbffc97ee2fe56ce1c9740e0b4a0f1
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:49 abb1062dfee8afcba37a40903b44601c2a08cc61c76572ad104c58d1f5b1d74c
-rw-r–r-- 1 autonomi2 autonomi2 16 Aug 30 15:49 ea1c4b6d31c3eaa6207b256fd7855296d85f35c4364fb6884cddadea14bd3be7
-rw-r–r-- 1 autonomi2 autonomi2 382 Aug 30 15:49 metadata