Skip to content

test: add unit tests for abiEncodeClearValues ebool and eaddress paths#4

Closed
luchobonatti wants to merge 1 commit intomainfrom
fix/353-abiEncodeClearValues-bool-address
Closed

test: add unit tests for abiEncodeClearValues ebool and eaddress paths#4
luchobonatti wants to merge 1 commit intomainfrom
fix/353-abiEncodeClearValues-bool-address

Conversation

@luchobonatti
Copy link
Copy Markdown
Member

Closes zama-ai#353

Summary

  • Export abiEncodeClearValues from publicDecrypt.ts with @internal to enable unit testing
  • Add 5 unit tests covering the untested ebool and eaddress code paths, plus a euint32 regression

Changes

File Change
src/relayer/publicDecrypt.ts Export abiEncodeClearValues with @internal annotation
src/relayer/publicDecrypt.test.ts New describe('abiEncodeClearValues') block with 5 unit tests

Test plan

  • tsc --noEmit passes
  • All 13 tests in publicDecrypt.test.ts pass (8 pre-existing + 5 new)
  • ebool trueabiValues[0] === 1n
  • ebool falseabiValues[0] === 0n
  • ebool invalid value 2n → throws with correct message
  • eaddress bigint → 40-char lowercase hex string in abiValues
  • euint32 42n passes through unchanged (regression)

Export abiEncodeClearValues as @internal to enable unit testing.
Add 5 tests covering ebool true/false/invalid and eaddress encoding,
plus a euint32 regression.

Closes zama-ai#353
Copilot AI review requested due to automatic review settings April 10, 2026 16:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds unit coverage for abiEncodeClearValues edge paths in the relayer public decrypt flow, ensuring correct ABI-ready value formatting for ebool/eaddress and preventing a euint32 regression.

Changes:

  • Export abiEncodeClearValues from src/relayer/publicDecrypt.ts with @internal to enable direct unit testing.
  • Add 5 unit tests covering ebool true/false/invalid, eaddress bigint formatting, and an euint32 pass-through regression.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/relayer/publicDecrypt.ts Exposes abiEncodeClearValues as an @internal export for test access.
src/relayer/publicDecrypt.test.ts Adds a focused abiEncodeClearValues test suite for previously untested type paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@luchobonatti
Copy link
Copy Markdown
Member Author

Closing — upstream PR zama-ai#356 already addresses this issue.

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.

Verify abiEncodeClearValues in the case of bool and address

2 participants