Skip to content

feat(bindings)!: support C application engines - #36

Open
GCdePaula wants to merge 7 commits into
mainfrom
feature/application-c-bridge
Open

feat(bindings)!: support C application engines#36
GCdePaula wants to merge 7 commits into
mainfrom
feature/application-c-bridge

Conversation

@GCdePaula

Copy link
Copy Markdown
Collaborator

Adapt @edubart C application support from #32 to the current Application contract.

Add reusable c-app-engine and c-app-sequencer crates under bindings/: a C ABI adapter and an optional sequencer CLI host, supporting externally built static archives. Keep the wallet engine, genesis tool, and wallet sequencer under examples/ as reference implementations.

The engine owns application state and progress. The bridge propagates typed application errors through the host’s failure policy and supports durable file or directory checkpoints. Genesis loading is lazy and fallible; missing/corrupt genesis dumps and snapshot-path failures follow the shared terminal-error policy.

Breaking Rust API changes:

  • Replace Application::MAX_METHOD_PAYLOAD_BYTES with max_method_payload_bytes().
  • Remove Application::delete_dump; the host deletes self-contained checkpoint directories.
  • Genesis factories return Result<A, AppError>.

Validation: workspace check, strict Clippy, formatting, bridge/reference tests, and external-archive and standalone downstream consumer builds. CI includes the downstream build check.

DEX native/canonical conformance and C++ scheduler integration remain follow-ups.

Adapt Eduardo Bart's C application support from PR #32 to the revised
Application contract. Keep exclusive movable engine ownership, native progress,
fallible validation/execution, and typed missing/corrupt checkpoint errors.
Add a reference wallet engine, host binaries, and tests through the actual ABI.

Source: #32
Source-Commit: 0fa1755
Let file-backed applications load genesis only when setup needs its initial
snapshot. Completed setup remains a no-op after the original genesis file is
gone. Expose run_command for custom parsers so the C host shares command-task
panic projection and the existing bootstrap error policy.

Remove the external engine's arbitrary payload ceiling and align checkpoint
deletion documentation with database-reference removal before garbage collection.

BREAKING CHANGE: genesis factories passed to run_main, run_command, dispatch,
and setup return Result<A, AppError>. Wrap infallible constructors in Ok(...).
Exercise mixed outputs through a test ABI that reuses its payload buffer, including a full-width nonzero voucher value. Restore the external archive CI smoke check and libclang dependency, and clarify bridge discovery and cross-target determinism responsibilities.

Validation: workspace check, strict Clippy, formatting, 718 host tests, and external archive build plus CLI smoke check passed.
Catch application snapshot-path panics at both HTTP handlers and invoke the host terminal-abort policy. Classify deterministic application bootstrap I/O failures as terminal while keeping operational I/O restartable and genesis construction lazy.

Validate both snapshot routes with subprocess SIGABRT tests and extend the exit-code table with terminal and retryable bootstrap cases.
Recognize --help and -h before treating the argument as a dump path. Pin successful help output and an untouched working directory in a CLI regression test, and remove the unused tracing dependency from the generic host.
Read the stable method payload bound from the linked engine, return count and clock together, and let the sequencer discard self-contained checkpoint directories with ordinary filesystem deletion. Remove the duplicated payload-limit build setting and cleanup-only Application type parameters.

Update the reference ABI implementation, file/directory independence tests, build instructions, and protocol guide. Keep engine-dependent output, layout, conformance, and linking work documented as follow-ups.

BREAKING CHANGE: Application implementations replace MAX_METHOD_PAYLOAD_BYTES with max_method_payload_bytes() and remove delete_dump. Native archives export application_engine_max_method_payload_bytes and application_engine_progress with ApplicationEngineProgress instead of scalar progress getters and a deletion hook. External builds require only the archive and header settings.

Validation: 722 host tests passed, with one existing ignored doctest; workspace check, strict Clippy, formatting, C11/C++17 header checks, and external archive build plus CLI smoke check passed.

@stephenctw stephenctw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.

2 participants