Skip to content

fix(sdk): encode large chain IDs in zk metadata - #316

Closed
burak33bb wants to merge 1 commit into
FhenixProtocol:masterfrom
burak33bb:codex/fix-zk-metadata-large-chainid
Closed

burak33bb wants to merge 1 commit into
FhenixProtocol:masterfrom
burak33bb:codex/fix-zk-metadata-large-chainid

Conversation

@burak33bb

@burak33bb burak33bb commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • Encode ZK proof metadata chain IDs with BigInt instead of JS bitwise shifts
  • Add regression coverage for a chain ID above 32 bits
  • Add a patch changeset

Problem

constructZkPoKMetadata writes chainId as a 32-byte uint, but the previous loop used >>>. JavaScript bitwise operators coerce through uint32, so chain IDs above 32 bits were truncated in the proof metadata while zkVerify still sent the full chain_id in the request payload.

Testing

  • pnpm --filter @cofhe/sdk exec vitest run --project node core/test/zkPackProveVerify.test.ts
  • pnpm --filter @cofhe/sdk lint (passes with existing warnings)
  • pnpm --filter @cofhe/sdk build

Not run to completion locally:

  • pnpm run test:setup requires TEST_PRIVATE_KEY for @cofhe/test-setup
  • pnpm --filter @cofhe/sdk test needs the Playwright browser binary for the web project and the test setup fixture
  • pnpm --filter @cofhe/sdk check:types currently fails because @cofhe/test-setup is not generated without setup

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

@burak33bb is attempting to deploy a commit to the Fhenix Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 323b575

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@cofhe/sdk Patch
@cofhe/abi Patch
@cofhe/hardhat-3-plugin Patch
@cofhe/hardhat-plugin Patch
@cofhe/mock-contracts Patch
@cofhe/react Patch
@cofhe/site Patch
@cofhe/example-react Patch
@cofhe/foundry-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@burak33bb
burak33bb force-pushed the codex/fix-zk-metadata-large-chainid branch from e3a1b38 to 0e9d17a Compare September 3, 2026 01:56
@burak33bb

Copy link
Copy Markdown
Author

Rebased onto the latest master and re-ran the focused SDK test, lint, and build. The change is still focused and ready from my side.

@architect-dev — when you get a chance, could you let me know whether this is still something you'd like to merge? Happy to keep it updated, or close it if it's no longer needed. Thanks!

@burak33bb
burak33bb force-pushed the codex/fix-zk-metadata-large-chainid branch from 0e9d17a to 323b575 Compare September 13, 2026 11:10
@burak33bb burak33bb closed this Sep 13, 2026
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