atomic-server icon indicating copy to clipboard operation
atomic-server copied to clipboard

Incorrect signature when parsing mismatching datatypes

Open joepio opened this issue 5 months ago • 3 comments

@AlexMikhalev noticed that one of the commits failed in his repo:

Incorrect signature for Commit. This could be due to an error during signing or serialization of the commit. Compare this to the serialized commit in the client:

{"https://atomicdata.dev/properties/createdAt":1750927650009,"https://atomicdata.dev/properties/isA":["https://atomicdata.dev/classes/Commit"],"https://atomicdata.dev/properties/set":{"https://atomicdata.dev/properties/isA":["https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/class/eligibility-step"],"https://atomicdata.dev/properties/parent":"https://common.terraphim.io/01jynpn23jeedmqzsrx3wsqpy6","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/annual-revenue":5000,"https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/business-type":"https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/tag/sole-partnership","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/company-name":"Zestic ","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/contact-name":"Alex M","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/email":"[email protected]","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/existing-loans-or-debt":true,"https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/industry":"https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/tag/agriculture","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/loan-request":45566,"https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/phone-number":"0784291274","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/select-loan-purposes":"https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/tag/working-capital","https://common.terraphim.io/01jxw2jx8qze6yakh4fz24mnhy/property/years-in-business":23000},"https://atomicdata.dev/properties/signer":"https://common.terraphim.io/agents/Jn1nkEuUaQz5XgB+Ur6JpWAkfUNDok1NpUngKmq3u2Q=","https://atomicdata.dev/properties/subject":"https://common.terraphim.io/01jynpn255kwes4reankrd44yt"}

Both the front-end as the back-end should serialize to JSON canonically, but their implementation is different. A mismatch between these is likely the cause of the issue.

I could dive into the exact differences in serialization, but maybe its better to change the library we use (fast-json-stable-stringify) isn't perfect at canonicalization.

EDIT: this is likely happening because a float type was expected but a string type was passed. The JSON parser might be too forgiving, accepting a data type that doesn't match the property type.

joepio avatar Jun 26 '25 09:06 joepio