Skip to content

feat(antd-elixir): gRPC external-signer prepare/finalize parity with REST - #179

Merged
Nic-dorman merged 1 commit into
mainfrom
nic/v2-284-antd-elixir-grpc-external-signer
May 28, 2026
Merged

feat(antd-elixir): gRPC external-signer prepare/finalize parity with REST#179
Nic-dorman merged 1 commit into
mainfrom
nic/v2-284-antd-elixir-grpc-external-signer

Conversation

@Nic-dorman

Copy link
Copy Markdown
Collaborator

Summary

Adds 7 V2-284 functions on Antd.GrpcClient mirroring the existing REST Antd.Client external-signer surface:

  • prepare_upload(client, path, opts) / prepare_upload_public(client, path)
  • prepare_data_upload(client, data, opts)
  • finalize_upload(client, upload_id, tx_hashes) (wave-batch)
  • finalize_merkle_upload(client, upload_id, winner_pool_hash, opts)
  • prepare_chunk_upload(client, data) / finalize_chunk_upload(client, upload_id, tx_hashes)

Bang variants throughout. Full canonical 12-test matrix including store_data_map: true.

Depends on #140.

Proto regen

  • New lib/antd/v1/upload.pb.ex — UploadService + request/response messages + PoolCommitmentEntry + CandidateNodeEntry.
  • lib/antd/v1/chunks.pb.ex extended with PrepareChunk + FinalizeChunk RPCs and request/response messages.
  • lib/antd/v1/common.pb.ex extended with PaymentEntry.
  • All .pb.ex regenerated with protoc-gen-elixir 0.16.0 (was 0.13.0). The bump fixes a latent runtime bug: protobuf 0.16 dropped the generated .new/1 constructor. All calls inside Antd.GrpcClient are now %Module{...} struct literals (the forward-compatible idiom). The existing gRPC functions did not exercise this at runtime because the test suite simulates rather than calls the protobuf modules.

Implementation notes

  • 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 fields entirely on wave-batch.
  • visibility is forwarded as the proto3 default "" when not supplied via opts.
  • prepare_chunk_upload short-circuits the wave-batch mapping when already_stored == true.

Tests

New file test/antd/grpc_external_signer_test.exs. Spins up a real grpc-elixir server on 127.0.0.1:0 via GRPC.Server.start_endpoint(TestEndpoint, 0) with MockUploadServer + MockChunkServer, 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 / antd-cpp suites.

The suite starts GRPC.Client.Supervisor in setup_all — grpc-elixir 0.11 does not start it as part of its application supervision tree, and Antd.GrpcClient.new/1 calls GRPC.Stub.connect/1 which requires it. async: false because the supervisor is process-global.

Gates passed on dev2

  • mix compile — clean
  • mix test — 86/86 passing (74 existing + 12 new V2-284)

Test plan

  • Once feat(antd): gRPC UploadService + chunks prepare/finalize #140 lands: rebase and re-run mix test against the real daemon protos
  • Confirm the protoc_gen_elixir_version bump (0.13 → 0.16) does not break downstream applications that depend on antd and construct request types directly (none expected — generated *.pb.ex modules are not part of the public surface)

Supersedes #153 (force-push after daemon merge auto-closed the original PR).

…REST

Adds 7 V2-284 functions on Antd.GrpcClient mirroring the existing REST
Antd.Client external-signer surface:

* prepare_upload(client, path, opts) /
  prepare_upload_public(client, path)
* prepare_data_upload(client, data, opts)
* finalize_upload(client, upload_id, tx_hashes) (wave-batch)
* finalize_merkle_upload(client, upload_id, winner_pool_hash, opts)
* prepare_chunk_upload(client, data) /
  finalize_chunk_upload(client, upload_id, tx_hashes)

Bang variants (!/N) included throughout. Full canonical 12-test matrix
including the store_data_map=true variant.

Proto regen:

* New lib/antd/v1/upload.pb.ex (UploadService + request/response
  messages + PoolCommitmentEntry + CandidateNodeEntry).
* lib/antd/v1/chunks.pb.ex extended with PrepareChunk + FinalizeChunk
  RPCs and request/response messages.
* lib/antd/v1/common.pb.ex extended with PaymentEntry.
* All .pb.ex regenerated with protoc-gen-elixir 0.16.0 (was 0.13.0).
  This bump fixes a latent runtime bug: protobuf 0.16 dropped the
  generated .new/1 constructor — all calls inside Antd.GrpcClient have
  been converted to %Module{...} struct literals, the forward-
  compatible idiom. Existing gRPC functions did not exercise this at
  runtime because the test suite simulates rather than calls the
  protobuf modules.

Implementation notes:

* 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
  fields entirely on wave-batch and the model layer expects them
  empty/zero there.
* visibility is forwarded as the proto3 default "" when not supplied
  via opts, preserving the wire shape for daemons that predate the
  public-prepare addition.
* prepare_chunk_upload short-circuits the wave-batch mapping when
  already_stored == true.

Tests (test/antd/grpc_external_signer_test.exs, new):

* Spins up a real grpc-elixir server on 127.0.0.1:0 via
  GRPC.Server.start_endpoint(TestEndpoint, 0) with MockUploadServer +
  MockChunkServer, 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 / antd-cpp suites.
* The suite starts GRPC.Client.Supervisor in setup_all — grpc-elixir
  0.11 does not start it as part of its application supervision tree,
  and Antd.GrpcClient.new/1 calls GRPC.Stub.connect/1 which requires
  it. async: false because the global supervisor is shared.

Gates on dev2:

* mix compile — clean.
* mix test — 86/86 passing (74 existing + 12 new V2-284).

Depends on the antd-side daemon PR landing first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman merged commit 6ec190e into main May 28, 2026
@Nic-dorman
Nic-dorman deleted the nic/v2-284-antd-elixir-grpc-external-signer branch May 28, 2026 16:53
Nic-dorman added a commit that referenced this pull request May 28, 2026
Closes the gRPC parity gap with REST: external-signer (UploadService +
chunks PrepareChunk/FinalizeChunk) and WalletService are now reachable
over gRPC, plus stream-download stubs return honest UNIMPLEMENTED/501
instead of pretending. All 11 gRPC-capable SDKs follow with matching
fan-out.

## Additive (antd daemon)

- gRPC UploadService + chunks prepare/finalize — external-signer two-phase
  upload + single-chunk publish over gRPC, mirroring REST 1:1 (#140)
- gRPC WalletService — GetAddress / GetBalance / Approve, parity with
  REST /v1/wallet/* (#154)
- /v1/data/prepare now honors visibility for public DataMap chunk
  bundling via data_prepare_upload_with_visibility (#138)

## Fixes (antd daemon)

- Stream-download stubs (DataServiceStub.StreamDownload, REST
  /v1/data/stream/*) now return UNIMPLEMENTED / 501 honestly rather
  than empty success (#155)

## SDK fan-out — external-signer (gRPC prepare/finalize)

All 11 gRPC-capable SDKs replace their stub raises with real gRPC calls
to the new UploadService + ChunkService PrepareChunk/FinalizeChunk RPCs:

- antd-rust (#169), antd-go (#170), antd-py (#171), antd-java (#172),
  antd-kotlin (#173), antd-csharp (#174), antd-ruby (#175),
  antd-dart (#176), antd-swift (#177), antd-cpp (#178),
  antd-elixir (#179)

## SDK fan-out — WalletService

Same 11 SDKs gain walletAddress / walletBalance / walletApprove over gRPC:

- antd-rust (#180), antd-go (#181), antd-py (#182), antd-java (#183),
  antd-kotlin (#184), antd-csharp (#185), antd-ruby (#186),
  antd-dart (#187), antd-swift (#188), antd-cpp (#189),
  antd-elixir (#190)

## SDK examples + build fixes

- antd-ruby: payForQuotes tuple args as Hash for eth-0.5.13
  compatibility (#131)
- antd-go + ant-dev: add 03-chunks + 06-private-data examples;
  renumber 03-files to 04-files (#132)
- antd-java + antd-cpp: close async client surface gaps (#133)
- ant-dev: pull antd[rest,grpc] extras so 08_grpc example runs out
  of the box (#134)
- antd-js + antd-py + antd-go READMEs: surface external-signer
  methods + 07 example (#135)
- antd-elixir: 07_external_signer example via cast shell-out (#136)
- antd-swift: 07_external_signer example + fix FinalizeUploadDTO
  optional address (#137)
- antd-php: empty tx_hashes serializes as JSON object on finalize
  (#139)

## FFI

- ant-ffi refresh against current ant-core API + Swift xcframework
  build pipeline (#150)
- Android AAR build pipeline (#156)

## Infra

- CI: auto-tag Go submodules on umbrella release tag push (#129)
- Deploy: publish multi-arch withautonomi/antd image from ant-sdk
  release (#130)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant