Skip to content

The sok_digest field gets mangled if you attempt to use it in json logging #17544

@cjjdespres

Description

@cjjdespres

Preliminary Checks

Description

In 3dbe05a, a log message was added to display received snark work for debugging purposes. This results in a message containing:

"sok_digest":"��c}&�������\u000b[f�VRj�\u0006Mm�˚Hz m1-"

in a nightly CI run. This appears to be because the sok_digest is this type:

type t = Mina_stdlib.Bounded_types.String.Stable.V1.t
[@@deriving sexp, hash, compare, equal, yojson]

It looks like we handle the sok_digest internally as a raw byte string with the string type, and the to_yojson instance for string doesn't do any kind of encoding or decoding on strings. The "�" replacement characters are probably a result of something (the renderer in the logger?) converting the byte string to a UTF-8 string by replacing the invalid bytes with that character.

The sok_digest should really be rendered as UTF-8 text (probably hex-encoded) if we expect any outside json processing tools to work with it properly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions