feat(antd-ruby): gRPC external-signer prepare/finalize parity with REST - #147
Closed
Nic-dorman wants to merge 1 commit into
Closed
Conversation
Adds 7 new methods on `Antd::GrpcClient` mirroring the existing REST
`Antd::Client` external-signer surface:
* `prepare_upload(path, visibility:)` / `prepare_upload_public(path)`
* `prepare_data_upload(data, visibility:)`
* `finalize_upload(upload_id, tx_hashes)` (wave-batch)
* `finalize_merkle_upload(upload_id, winner_pool_hash, store_data_map:)`
* `prepare_chunk_upload(data)` / `finalize_chunk_upload(upload_id, tx_hashes)`
Consumers can now swap `Antd::Client` for `Antd::GrpcClient` without
code change in the external-signer flow.
Proto regen:
* `grpc_tools_ruby_protoc -I../antd/proto --ruby_out=lib --grpc_out=lib
antd/v1/{common,health,data,chunks,files,upload}.proto`
* New `upload_pb.rb` / `upload_services_pb.rb`. `chunks_pb.rb` /
`chunks_services_pb.rb` gain `PrepareChunk` / `FinalizeChunk`
messages and RPCs. `common_pb.rb` adds `PaymentEntry`.
Client (`lib/antd/grpc_client.rb`):
* New `@upload_stub = Antd::V1::UploadService::Stub.new(...)` field.
* Private `build_prepare_upload_result(resp)` helper maps the
`PrepareUploadResponse` proto into the `PrepareUploadResult` struct,
populating the merkle-only fields (`depth`, `pool_commitments`,
`merkle_payment_timestamp`) only when `payment_type == "merkle"`.
Tests (`test/test_grpc_client.rb`):
* `FakeGrpc::ChunkStub` gains `prepare_chunk` (new + already-stored
short-circuit) and `finalize_chunk` (echoes `upload_id`).
* New `FakeGrpc::UploadStub` covers `prepare_file_upload` /
`prepare_data_upload` / `finalize_upload` with visibility round-trip
via `upload_id` encoding and merkle vs wave-batch branches.
* `build_fake_client` / `build_error_client` updated to inject
`@upload_stub`.
* 12 new test cases parallel to the antd-rust / antd-go / antd-py /
antd-java / antd-kotlin / antd-csharp suites.
Gates on dev2:
* `bundle exec ruby -Ilib -Itest test/test_grpc_client.rb` — 12 new
cases pass; 4 pre-existing baseline failures in the cost mocks are
unrelated to this PR (verified by running on the parent commit).
Depends on the antd-side daemon PR landing first.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 task
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 new methods on
Antd::GrpcClientmirroring the existing RESTAntd::Clientexternal-signer surface. Consumers can now swapAntd::ClientforAntd::GrpcClientwithout code change in the prepare/finalize flow.Depends on #140 (antd-side
UploadService+ chunks prepare/finalize).Methods
prepare_upload(path, visibility:)prepare_upload_public(path)visibility: "public"prepare_data_upload(data, visibility:)finalize_upload(upload_id, tx_hashes)finalize_merkle_upload(upload_id, winner_pool_hash, store_data_map:)prepare_chunk_upload(data)finalize_chunk_upload(upload_id, tx_hashes)Proto regen
grpc_tools_ruby_protoc -I../antd/proto --ruby_out=lib --grpc_out=lib antd/v1/{common,health,data,chunks,files,upload}.proto:upload_pb.rb/upload_services_pb.rb.chunks_pb.rb/chunks_services_pb.rbgainPrepareChunk/FinalizeChunk.common_pb.rbaddsPaymentEntry.Implementation notes
@upload_stub = Antd::V1::UploadService::Stub.new(...)field onGrpcClient.build_prepare_upload_result(resp)helper mapsPrepareUploadResponseproto into the existingPrepareUploadResultstruct, populating merkle-only fields (depth,pool_commitments,merkle_payment_timestamp) only whenpayment_type == "merkle".Tests
test/test_grpc_client.rb:FakeGrpc::ChunkStubgainsprepare_chunk(new + already-stored short-circuit) andfinalize_chunk(echoesupload_idinto address).FakeGrpc::UploadStubcoversprepare_file_upload/prepare_data_upload/finalize_uploadwith visibility round-trip viaupload_idencoding and merkle vs wave-batch branches.build_fake_client/build_error_clientupdated to inject@upload_stub.Gates on dev2
test_data_cost,test_file_cost, etc.) where the fakecoststub returns a partialOpenStruct; unrelated to this PR (verified by running tests on the parent commit).