feat(bindings)!: support C application engines - #36
Open
GCdePaula wants to merge 7 commits into
Open
Conversation
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.
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.
Adapt @edubart C application support from #32 to the current
Applicationcontract.Add reusable
c-app-engineandc-app-sequencercrates underbindings/: a C ABI adapter and an optional sequencer CLI host, supporting externally built static archives. Keep the wallet engine, genesis tool, and wallet sequencer underexamples/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:
Application::MAX_METHOD_PAYLOAD_BYTESwithmax_method_payload_bytes().Application::delete_dump; the host deletes self-contained checkpoint directories.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.