Repository navigation
fix(eip712): make EIP712Domain.verifyingContract deserializable by Jackson - #18
Open
Alicepoltora wants to merge 1 commit into
Open
Alicepoltora wants to merge 1 commit into
Alicepoltora wants to merge 1 commit into
Conversation
…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.
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.
Summary
Fixes #14
StructuredDataEncoder.parseJSONMessage()deserializes typed-data JSON with a plain JacksonObjectMapperintoEIP712Message/EIP712Domain. The Moshi@Jsonannotations on the DTOs are invisible to Jackson, so Jackson relies on setter-based property detection.Every
EIP712Domainfield was avar(setter present) exceptverifyingContract, which was aval— so any typed-data payload containingdomain.verifyingContractfailed with: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
verifyingContractfrom 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
valgetter remains, setter is added)getCircleDomainMessage) unaffectedverifyingContractin EIP712Domain (Jackson UnrecognizedPropertyException) #14 and Jackson's documented property-detection rules