feat(external-signer): add Visibility arg to file_prepare_upload#39
Open
Nic-dorman wants to merge 1 commit intomainfrom
Open
feat(external-signer): add Visibility arg to file_prepare_upload#39Nic-dorman wants to merge 1 commit intomainfrom
Nic-dorman wants to merge 1 commit intomainfrom
Conversation
Adds an external-signer path for public uploads. When a PreparedUpload
is prepared with Visibility::Public, the serialized DataMap is bundled
into the payment batch (wave-batch or merkle) as an additional chunk.
FileUploadResult::data_map_address then carries the chunk address of
the stored DataMap, giving the uploader a single network address to
share for retrieval.
Motivation: ant-gui (the Autonomi desktop GUI) currently has to block
its Public upload option in the UI because no external-signer pathway
exists for publishing the data map — `data_map_store` internally calls
`pay_for_storage`, which hard-requires a wallet, and the chunk-storage
plumbing (`store_paid_chunks`, `chunk_put_to_close_group`,
`merkle_upload_chunks`) is pub(crate), so consumers on the
external-signer path cannot hand-roll it. Bundling the data map chunk
into the existing payment batch reuses the one-signature flow that
wave-batch and merkle already use for file chunks, which lets ant-gui
thread a `visibility` flag through its existing code path and re-enable
the Public option with no extra wallet round-trip.
- `Visibility::{Private, Public}` enum (default Private)
- `Client::file_prepare_upload_with_visibility(path, visibility)`;
the existing `file_prepare_upload(path)` now delegates with Private
for backward compatibility
- `PreparedUpload.data_map_address: Option<[u8; 32]>` carries the
address between prepare and finalize
- `FileUploadResult.data_map_address` is Some for public uploads
- Both `finalize_upload` and `finalize_upload_merkle` propagate the
field; no separate network call is needed because the data map chunk
is stored alongside the rest of the batch
- e2e test verifies Private leaves the address unset, Public records
it, and the recorded address matches the serialized data map
The internal-wallet path (`file_upload_with_mode`) is unchanged —
ant-cli continues to use `file_upload` followed by `data_map_store`
for its public upload flow.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mickvandijke
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an external-signer pathway for public file uploads. Calling
Client::file_prepare_upload_with_visibility(path, Visibility::Public)bundles the serializedDataMapinto the existing payment batch (wave-batch or merkle) as one additional chunk. Afterfinalize_upload/finalize_upload_merkle,FileUploadResult.data_map_addresscarries the chunk address of the publishedDataMap— a single network address the uploader can share so anyone can retrieve the file.This unblocks public uploads in the Autonomi desktop GUI (ant-gui). The GUI currently has its Public upload option disabled in the UI (WithAutonomi/ant-ui#12, merged) because no external-signer pathway exists for publishing the data map. Once this lands and ant-gui bumps the git dep, a follow-up PR on that repo will thread the
visibilityflag through the Tauri commands and re-enable the Public button.Why bundling, not a separate call
Publishing the data map means storing one extra content-addressed chunk. The two obvious alternatives both hit dead ends on the external-signer path:
client.data_map_store(&data_map)afterfinalize_upload— what ant-cli does. Internally goes throughpay_for_storage, which hard-requiresself.require_wallet()?(ant-core/src/data/client/payment.rs:46). ant-gui's Rust client has no wallet — all payments go via WalletConnect / direct-wallet on the frontend.store_paid_chunks,chunk_put_to_close_group,merkle_upload_chunks) are allpub(crate), so external callers cannot reproduce the flow.Bundling the data map chunk into the existing
PaymentIntent(wave-batch) or merkle batch reuses the one-signature flow that already works for file chunks. The external signer pays for the data chunks and the data map chunk in a single on-chain transaction, andfinalize_upload[_merkle]stores them all in the same wave.Changes
Visibilityenum (Privatedefault,Public) indata::client::file, re-exported fromdata::.Client::file_prepare_upload_with_visibility(path, visibility). The existingfile_prepare_upload(path)delegates withVisibility::Private— signature and behaviour are preserved for existing callers.PreparedUpload.data_map_address: Option<[u8; 32]>carries the address between prepare and finalize.FileUploadResult.data_map_address: Option<[u8; 32]>isSome(addr)for public uploads. Pair it withdata_map_fetch(&addr)+file_download(&data_map, dest)to retrieve the file.finalize_uploadandfinalize_upload_merklepropagatedata_map_address; no extra network call needed, since the data map chunk is stored alongside the rest of the batch.file_upload_with_mode) is unchanged — ant-cli continues to usefile_upload+data_map_storefor its public flow.Test plan
cargo fmt -p ant-corecleancargo check --workspace --all-featurespassescargo clippy --tests -p ant-core --all-features -- -D warningscleantest_file_prepare_upload_visibilityinant-core/tests/e2e_file.rsverifies:data_map_addressunsetcompute_address(rmp_serde::to_vec(&data_map))🤖 Generated with Claude Code