Skip to content

Conversation

Sventimir
Copy link
Contributor

This PR implements a stateless block and snark work verifier. It's been originally written for mainnet, but never merged. Then it was proted to berkeley and than extended to be able to load inputs and save its results to a Cassandra database, as required by the uptime service.

Explain your changes:

  • Add a stateless verification tool capable of verifying blocks and snark work.
  • Create a nix environment to build docker images for deployment.

Explain how you tested your changes:

  • Manually tested against data from the ITN as well as from test network spun up specifically for this purpose.

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

ghost-not-in-the-shell and others added 30 commits November 7, 2023 16:11
Problem: delegation stateless verification tool is not usable for
submissions on cluster with custum constraints constants.

Solution: provide an option to load config file with custom constraints
constants.

Bonus: code prettified and reformated.
The setup depends on ~/.cassandra/cqlshrc configuration to work.
An empty line sneaks in in particular when Casandra finds no results.
In order to allow for outputting results to Cassandra.
@ejMina226
Copy link
Member

!ci-build-me

@ejMina226
Copy link
Member

!ci-build-me

@ejMina226 ejMina226 requested a review from mrmr1993 February 20, 2024 15:42
Copy link
Contributor

@mrmr1993 mrmr1993 left a comment

Choose a reason for hiding this comment

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

LGTM apart from nits. Also, lovely readme :)

conf.keyspace from
(match where with None -> "" | Some w -> " WHERE " ^ w)
in
List.slice data 3 (-2) (* skip header and footer *)
Copy link
Contributor

Choose a reason for hiding this comment

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

:(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While I agree this is not very elegant, I'm not sure what do you suggest here? I prefer this to ignoring lines which don't parse as records. Another idea would be to match against a regular expression to determine which line contains a record and which does not, but then again if we come by erroneous line in the middle of input, we'll ignore it silently, which is not good. In short, I can't really see a better solution which would retain the merit of being very simple and easy to understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a better suggestion, I'm just sad

let filesystem_command =
Command.async ~summary:"Verify submissions and block read from the filesystem"
Command.Let_syntax.(
let%map_open block_dir = block_dir_flag
Copy link
Contributor

Choose a reason for hiding this comment

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

Style-nit: I generally find it easier to reason about these when they're inline

; submitted_at = meta.created_at
}

let submitted_at ({ submitted_at; _ } : submission) = submitted_at
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider [@@deriving fields] on submission

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bringing another dependency to the scope just to generate these 3 lines of code seems an overkill to me. I'd rather keep it simple as it is.

@ejMina226
Copy link
Member

!ci-build-me

@ejMina226
Copy link
Member

!ci-build-me

@ejMina226
Copy link
Member

!ci-build-me

@mrmr1993
Copy link
Contributor

!approved-for-mainnet

@ejMina226 ejMina226 merged commit 80269d9 into berkeley Feb 21, 2024
@ejMina226 ejMina226 deleted the sventimir/stateless-verification-tool branch February 21, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants