Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone snarkwork process to submit proofs via graphql #16367

Open
wants to merge 2 commits into
base: feature/graphql-add-snark-work
Choose a base branch
from

Conversation

deepthiskumar
Copy link
Member

Explain your changes:

  • standalone snark worker process accepts work spec in json format, accepts fee and prover public key
  • Submits work to a mina node if graphql uri is passed as an argument

Explain how you tested your changes:

  • ran the process with a snark work spec from devnet and sent the generated work to a devnet node

Part of solution described in #16214 (comment)

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? List them
  • Closes #0000

@deepthiskumar deepthiskumar requested a review from a team as a code owner November 19, 2024 20:00
Comment on lines +49 to +64
|> Deferred.Or_error.map ~f:(function
| `One (proof1, _) ->
{ Snark_work_lib.Work.Result_without_metrics.proofs = `One proof1
; statements =
One_or_two.map spec ~f:Snark_work_lib.Work.Single.Spec.statement
; prover = public_key
; fee
}
| `Two ((proof1, _), (proof2, _)) ->
{ Snark_work_lib.Work.Result_without_metrics.proofs =
`Two (proof1, proof2)
; statements =
One_or_two.map spec ~f:Snark_work_lib.Work.Single.Spec.statement
; prover = public_key
; fee
} )
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
|> Deferred.Or_error.map ~f:(function
| `One (proof1, _) ->
{ Snark_work_lib.Work.Result_without_metrics.proofs = `One proof1
; statements =
One_or_two.map spec ~f:Snark_work_lib.Work.Single.Spec.statement
; prover = public_key
; fee
}
| `Two ((proof1, _), (proof2, _)) ->
{ Snark_work_lib.Work.Result_without_metrics.proofs =
`Two (proof1, proof2)
; statements =
One_or_two.map spec ~f:Snark_work_lib.Work.Single.Spec.statement
; prover = public_key
; fee
} )
|> Deferred.Or_error.map ~f:(fun proofs_and_time ->
{ Snark_work_lib.Work.Result_without_metrics.proofs =
One_or_two.map proofs_and_time ~f:fst
; statements =
One_or_two.map spec ~f:Snark_work_lib.Work.Single.Spec.statement
; prover = public_key
; fee
} )

@@ -811,7 +811,7 @@ module Mutations = struct
| Ok
( `Broadcasted
, Network_pool.Snark_pool.Resource_pool.Diff.Add_solved_work _
, _ ) ->
, () ) ->
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
, () ) ->
, _ ) ->

It looks like this change triggers an error when building:

File "src/lib/mina_graphql/mina_graphql.ml", line 814, characters 14-16:
814 |             , () ) ->
                    ^^
Error: This pattern matches values of type unit
       but a pattern was expected which matches values of type
         Network_pool.Snark_pool.Resource_pool.Diff.rejected

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