Skip to content

fix(eip712): make EIP712Domain.verifyingContract deserializable by Jackson - #18

Open
Alicepoltora wants to merge 1 commit into
circlefin:masterfrom
Alicepoltora:fix/eip712-verifying-contract-deserialization
Open

Alicepoltora wants to merge 1 commit into
circlefin:masterfrom
Alicepoltora:fix/eip712-verifying-contract-deserialization

Conversation

@Alicepoltora

Copy link
Copy Markdown

Summary

Fixes #14

StructuredDataEncoder.parseJSONMessage() deserializes typed-data JSON with a plain Jackson ObjectMapper into EIP712Message/EIP712Domain. The Moshi @Json annotations on the DTOs are invisible to Jackson, so Jackson relies on setter-based property detection.

Every EIP712Domain field was a var (setter present) except verifyingContract, which was a val — so any typed-data payload containing domain.verifyingContract failed with:

UnrecognizedPropertyException: Unrecognized field "verifyingContract"
(class com.circle.modularwallets.core.models.EIP712Domain),
not marked as ignorable

making signTypedData() unusable for EIP-712 flows that target a specific contract (i.e. most non-trivial typed-data use cases).

Fix

val verifyingContract → var verifyingContract — one word, matching the other four fields in the same class.

Why not @JsonIgnoreProperties(ignoreUnknown = true)

It would silence the crash but silently drop verifyingContract from the parsed domain, producing a domain-separator hash computed without the contract address — a worse failure mode (invalid signatures) than the current loud error.

Verification

…ckson

Fixes circlefin#14

StructuredDataEncoder.parseJSONMessage() deserializes typed-data JSON with a
plain Jackson ObjectMapper into EIP712Message/EIP712Domain. The Moshi @JSON
annotations on the DTOs are invisible to Jackson, so Jackson relies on
setter-based property detection: every EIP712Domain field was a var (setter
present) except verifyingContract, which was a val. A typed-data payload
containing domain.verifyingContract therefore failed with:

  UnrecognizedPropertyException: Unrecognized field "verifyingContract"
  (class com.circle.modularwallets.core.models.EIP712Domain),
  not marked as ignorable

making signTypedData() unusable for any EIP-712 flow that targets a specific
contract — i.e. most non-trivial typed-data use cases.

Change val to var so the property has a setter, matching the other four
fields in the same class. Note: @JsonIgnoreProperties(ignoreUnknown = true)
would "fix" the crash but silently DROP verifyingContract from the parsed
domain, producing wrong domain-separator hashes — not used here deliberately.
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.

Kotlin SDK rejects verifyingContract in EIP712Domain (Jackson UnrecognizedPropertyException)

1 participant