Skip to content

Added support for C3 JAM SDK#112

Merged
tomusdrw merged 4 commits intomainfrom
maso-c3-jamsdk
Mar 14, 2026
Merged

Added support for C3 JAM SDK#112
tomusdrw merged 4 commits intomainfrom
maso-c3-jamsdk

Conversation

@DrEverr
Copy link
Copy Markdown
Member

@DrEverr DrEverr commented Mar 12, 2026

Add C3 JAM SDK (jamsdk)

Adding C3 as a new SDK option for building JAM services and authorizers via jamc3.

Why a new SDK?

The other SDKs are built with their own scope and priorities, which is fine, but I wanted something I fully own end-to-end, designed the way I think a JAM SDK should work. On top of that, I've been getting into C3 and it turns out to be a really nice fit for this kind of work:

  • No runtime, no GC. C3 compiles straight to native code with zero implicit allocations — exactly what you want when targeting PolkaVM, without writing actual C.
  • Cross-compiling to RISC-V. c3c has first-class rv64imac support with no-stdlib/no-libc out of the box. No toolchain wrestling.
  • Native C ABI. Host function bindings are clean extern fn declarations — no FFI wrappers, no unsafe blocks. All 27 host calls are one-liners.
  • Tiny blobs. No hidden runtime means .jam output is small and deterministic. Every byte counts on-chain.
  • Modern where it matters. Optional types, faults, defer, modules, slices — safety without the compile-time tax or binary bloat.

What's in the box

  • Full SDK library (jamc3.c3l) — all 27 host functions, Gray Paper types, high-level service/storage APIs, Appendix C codecs
  • Entry point dispatch for services (refine + accumulate) and authorizers (is_authorized)
  • Build pipeline: C3 → RISC-V → ELF → .polkavm.jam
  • Patched polkavm-to-jam converter (works with polkatool 0.29+)
  • Docker image with everything bundled: ghcr.io/dreverr/jamc3
  • Four examples: hello-world, storage-demo, simple-auth, fibonacci

Links

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

This pull request adds support for a new "c3sdk" template in the CLI creation command. The changes extend the template options and add corresponding SDK configuration for version 1.0.2 with build and test settings.

Changes

Cohort / File(s) Summary
CLI Template Addition
bin/cli/src/commands/create-command.ts
Added "c3sdk" template option to the Template union type and created a new TARGETS mapping entry linking "c3sdk" to "jammin-create/jammin-create-c3sdk".
SDK Configuration
packages/jammin-sdk/config/sdk-configs.ts
Added new SDK configuration entry "c3sdk-1.0.2" with image, build, and test field definitions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Ajanta SDK support #81: Modifies the same CLI and SDK configuration files with similar template and TARGETS mapping additions.

Suggested reviewers

  • tomusdrw
  • skoszuta
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding support for a new C3 JAM SDK option to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly relates to the changeset, describing the addition of C3 SDK support with detailed motivation and technical context.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch maso-c3-jamsdk
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/jammin-sdk/config/sdk-configs.ts`:
- Around line 25-29: The new SDK entry "c3sdk-1.0.2" in the exported config
object is missing the trailing comma after its closing brace and needs
formatting; update the object literal for the key "c3sdk-1.0.2" to include the
trailing comma after the block (after the closing brace) and then run the
project's formatter/biome to reformat the file so the entry matches project
style (ensure properties image, build, and test remain intact).
- Line 26: Replace the tag-only image value image:
"ghcr.io/dreverr/jamsdk:1.0.2" with a digest-pinned reference (e.g.
ghcr.io/dreverr/jamsdk:1.0.2@sha256:<actual-digest>) following the same pattern
used by jambrains-1cfc41c so the C3 toolchain image is immutable; also add the
missing trailing comma after the closing } of that object to satisfy Biome
formatting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9327845e-ea44-4f4e-965a-3412ae293538

📥 Commits

Reviewing files that changed from the base of the PR and between ba21a2c and bbc7db7.

📒 Files selected for processing (2)
  • bin/cli/src/commands/create-command.ts
  • packages/jammin-sdk/config/sdk-configs.ts

Comment thread packages/jammin-sdk/config/sdk-configs.ts Outdated
Comment thread packages/jammin-sdk/config/sdk-configs.ts Outdated
@tomusdrw tomusdrw merged commit b995067 into main Mar 14, 2026
8 checks passed
@tomusdrw tomusdrw deleted the maso-c3-jamsdk branch March 14, 2026 14:47
@coderabbitai coderabbitai Bot mentioned this pull request May 8, 2026
7 tasks
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