feat(antd-cpp): gRPC external-signer prepare/finalize parity with REST - #152
Closed
Nic-dorman wants to merge 1 commit into
Closed
Conversation
Adds 7 V2-284 methods on antd::GrpcClient mirroring the existing REST antd::Client external-signer surface: * prepare_upload(path, visibility=nullopt) / prepare_upload_public(path) * prepare_data_upload(data, visibility=nullopt) * finalize_upload(upload_id, tx_hashes, store_data_map=false) (wave-batch) * finalize_merkle_upload(upload_id, winner_pool_hash, store_data_map=false) * prepare_chunk_upload(data) / finalize_chunk_upload(upload_id, tx_hashes) Implementation notes: * New `UploadService::Stub` on the existing pimpl. Two free helpers (`map_prepare_upload_response`, `map_finalize_upload_response`) isolate the wire-shape mapping. Merkle-only fields (depth, pool_commitments, merkle_payment_timestamp) are gated on payment_type == "merkle" — proto3 scalar defaults are not enough because REST omits these entirely on wave-batch and the model layer expects them empty/zero there. * visibility is sent only when std::optional has a value, preserving the proto3 empty-default wire shape for daemons that predate the public-prepare addition. * prepare_chunk_upload short-circuits the wave-batch mapping when already_stored == true. Tests (tests/test_grpc_external_signer.cpp, new): * Spins up a real grpc++ server on 127.0.0.1:0 with MockUploadService + MockChunkService, then dials with a real antd::GrpcClient. Exercises the actual proto wire-shape mapping (visibility round-trip via upload_id encoding, MERKLE vs wave-batch branch, EXISTS short-circuit). * 12 new tests parallel to the antd-rust / antd-go / antd-py / antd-java / antd-kotlin / antd-csharp / antd-ruby / antd-dart / antd-swift suites — includes the canonical store_data_map=true variant since cpp keeps that param (unlike kotlin/swift). * Gated on -DANTD_BUILD_GRPC=ON since they link against the grpc++ service stubs. The existing isolated antd_grpc_tests stays unchanged and still runs on the default config. Gates on dev2: * cmake -DANTD_BUILD_GRPC=ON -DProtobuf_PROTOC_EXECUTABLE=/usr/bin/protoc (must point CMake at the apt-installed protoc — dev2 also has a newer /usr/local/bin/protoc 25.x for swift codegen, which would produce stubs incompatible with the apt-installed libprotobuf 3.21.x runtime). * cmake --build — clean. * ctest — 4/4 passing: antd_tests, antd_async_tests, antd_grpc_tests (isolated, no gRPC linkage), antd_grpc_external_signer_tests (12/12 V2-284 mock-server wire-mapping tests). * Default config (no flags) still builds and passes 3/3 tests — the new test target is fully gated on ANTD_BUILD_GRPC. Depends on the antd-side daemon PR landing first. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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 7 V2-284 methods on
antd::GrpcClientmirroring the existing RESTantd::Clientexternal-signer surface:prepare_upload(path, visibility=nullopt)/prepare_upload_public(path)prepare_data_upload(data, visibility=nullopt)finalize_upload(upload_id, tx_hashes, store_data_map=false)(wave-batch)finalize_merkle_upload(upload_id, winner_pool_hash, store_data_map=false)prepare_chunk_upload(data)/finalize_chunk_upload(upload_id, tx_hashes)Includes the canonical
store_data_map=truevariant — cpp keeps that param (unlike kotlin/swift).Depends on #140.
Implementation notes
UploadService::Stubon the existing pimpl. Two free helpers (map_prepare_upload_response,map_finalize_upload_response) isolate the wire-shape mapping.depth,pool_commitments,merkle_payment_timestamp) are gated onpayment_type == "merkle"— proto3 scalar defaults are not enough because REST omits these entirely on wave-batch and the model layer expects them empty/zero there.visibilityis sent only whenstd::optionalhas a value, preserving the proto3 empty-default wire shape for daemons predating the public-prepare addition.prepare_chunk_uploadshort-circuits the wave-batch mapping whenalready_stored == true.Tests
New file
tests/test_grpc_external_signer.cpp. Spins up a real grpc++ server on127.0.0.1:0withMockUploadService+MockChunkService, then dials with a realantd::GrpcClient. Exercises the actual proto wire-shape mapping (visibility round-trip viaupload_idencoding, MERKLE vs wave-batch branch, EXISTS short-circuit).12 new tests parallel to the antd-rust / antd-go / antd-py / antd-java / antd-kotlin / antd-csharp / antd-ruby / antd-dart / antd-swift suites — full canonical matrix including
store_data_map=true.Gated on
-DANTD_BUILD_GRPC=ONsince they link against the grpc++ service stubs. The existing isolatedantd_grpc_testsstays unchanged and still runs on the default config.Gates passed on dev2
cmake --build— cleanctest— 4/4 passing (antd_tests,antd_async_tests,antd_grpc_testsisolated,antd_grpc_external_signer_tests12/12 V2-284 mock-server wire-mapping tests)ANTD_BUILD_GRPCNote: on dev2, point CMake at the apt-installed protoc — there is also a newer
/usr/local/bin/protoc25.x for swift codegen, which would produce stubs incompatible with the apt-installedlibprotobuf3.21.x runtime.Test plan
ctestagainst the real daemon protos