Skip to content

Conversation

@georgeee
Copy link
Member

The sok message was previously passed to the verifier process solely to perform a lightweight check that's better handled in the main process. This forced the sok message to remain in the scan state structure despite having no other use there.

This PR moves the sok message digest check to the main process, removing it from the verifier interface and enabling future removal of the sok message field from scan state merge nodes.

This PR is split into two parts. First part removes the digest check completely:

  • Don't check sok message when verify tx snark
  • Remove unused sok message parameter

Second part reintroduces the digest check in all places which call the transaction snark verifier:

  • Reintroduce sok message digest checks
  • Change the location of snark pool's check
  • Add a clarifying comment

The sok message digest check is not re-introduced into verification of scan state in anticipation of #18325 being merged shortly after this PR.

Explain how you tested your changes:

  • Existing test suite should provide sufficient coverage
  • PR doesn't introduce new behavior, only refactors the code to make the check happen at different locations

Checklist:

  • Dependency versions are unchanged
    • Notify Velocity team if dependencies must change in CI
  • Modified the current draft of release notes with details on what is completed or incomplete within this project
  • Document code purpose, how to use it
    • Mention expected invariants, implicit constraints
  • Tests were added for the new behavior
    • Document test purpose, significance of failures
    • Test names should reflect their purpose
  • All tests pass (CI will check this if you didn't)
  • Serialized types are in stable-versioned modules
  • Does this close issues? None

Sok message has to be checked against digest, but it's better to be done
on a different level (not in verifier executed in parallel process).

This commit only removes the check, it is reintroduced in the follow-up
commit.
Ensure that sok message is checked against the digests in all of the
contexts where it was validated previously.

Check is not reintroduced into scan state checking, because follow-up
commits will remove the sok message from scan state's merge nodes.
@georgeee georgeee requested a review from a team as a code owner January 15, 2026 20:17
@georgeee
Copy link
Member Author

!ci-build-me

Deferred.Or_error.return
(Or_error.error_string
"Transaction_snark.verify: Mismatched sok_message" )
Deferred.Or_error.return (Ok ())
Copy link
Member Author

Choose a reason for hiding this comment

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

It's possible that some tests might be failing because I didn't attempt to preserve dummy's behavior

Copy link
Member Author

Choose a reason for hiding this comment

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

And so they failed: https://buildkite.com/o-1-labs-2/mina-o-1-labs/builds/40027/steps/canvas?jid=019bc356-5a4c-42ca-a519-67fb0d56c896

Error: { \"string\": \"proof's sok message digest does not match the sok message\" }"

Base automatically changed from martyall/hash-scan-state-nodes to develop January 20, 2026 12:17
@martyall
Copy link
Member

!ci-build-me

1 similar comment
@martyall
Copy link
Member

!ci-build-me

@martyall martyall force-pushed the georgeee/check-sok-message-digest-outside-verifier branch from d25f8f3 to d5ce79c Compare January 21, 2026 16:34
@martyall
Copy link
Member

!ci-build-me

(Ledger_proof.Cached.read_proof_from_disk p, msg) ) )
) )
in
let check_sok_digests () =
Copy link
Member

Choose a reason for hiding this comment

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

nit: why take () here

Copy link
Member Author

Choose a reason for hiding this comment

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

I just followed the semantics used below with check (). I agree both check () and check_sok_digests () can be computed eagerly, with no () argument.

Feel free to make a follow-up PR after it's merged to develop @martyall !

@georgeee
Copy link
Member Author

!ci-bypass-changelog

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.

3 participants