dojo icon indicating copy to clipboard operation
dojo copied to clipboard

Persistent mode for saya using mock of SNOS

Open matzayonc opened this issue 1 year ago • 2 comments
trafficstars

Description

I added a Cairo 1 program simulating SNOS, committing to piltover.

Related issue

Tests

The full development flow is in this script: bin/saya/saya.sh.

  • [x] Yes
  • [ ] No, because they aren't needed
  • [ ] No, because I need help

Added to documentation?

  • [x] README.md
  • [ ] Dojo Book
  • [ ] No documentation needed

Checklist

  • [x] I've formatted my code (scripts/prettier.sh, scripts/rust_fmt.sh, scripts/cairo_fmt.sh)
  • [x] I've linted my code (scripts/clippy.sh, scripts/docs.sh)
  • [x] I've commented my code
  • [x] I've requested a review after addressing the comments

Summary by CodeRabbit

  • New Features

    • Introduced flexible dependency management for improved maintenance and future updates.
    • Enhanced command-line interface with new and modified flags for better clarity and usability.
    • Implemented structured options for operational modes and contract addresses.
    • Added batch processing capabilities and improved transaction handling for StarkNet interactions.
    • Introduced new configuration parameters for block processing and proof generation.
    • Streamlined deployment process with a new setup script for blockchain environments.
    • Added support for new proving programs and enhanced handling of Cairo versions.
    • Introduced a new error handling structure for better reporting and debugging.
    • Added a new method for publishing checkpoints to the data availability layer.
  • Bug Fixes

    • Resolved previous workaround regarding world_address, enhancing deployment instructions.
  • Documentation

    • Updated README with expanded deployment instructions and command-line options.
    • Revised configuration files to reflect new operational parameters and batch processing settings.
  • Chores

    • Cleaned up unused imports and improved code readability across various modules.

matzayonc avatar Aug 02 '24 11:08 matzayonc

Codecov Report

Attention: Patch coverage is 19.20821% with 551 lines in your changes missing coverage. Please review.

Project coverage is 68.54%. Comparing base (e591364) to head (e47f0d1). Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
crates/saya/core/src/lib.rs 0.00% 189 Missing :warning:
crates/saya/core/src/prover/client.rs 0.00% 56 Missing :warning:
crates/saya/core/src/verifier/starknet.rs 0.00% 52 Missing :warning:
crates/saya/core/src/prover/mod.rs 0.00% 41 Missing :warning:
crates/saya/core/src/verifier/utils.rs 0.00% 30 Missing :warning:
bin/saya/src/args/mod.rs 75.47% 26 Missing :warning:
...es/saya/core/src/data_availability/celestia/mod.rs 0.00% 25 Missing :warning:
bin/saya/src/args/settlement.rs 0.00% 24 Missing :warning:
crates/saya/core/src/dojo_os/piltover.rs 0.00% 24 Missing :warning:
crates/saya/core/src/dojo_os/mod.rs 0.00% 22 Missing :warning:
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2253      +/-   ##
==========================================
+ Coverage   67.73%   68.54%   +0.80%     
==========================================
  Files         388      387       -1     
  Lines       50421    49902     -519     
==========================================
+ Hits        34153    34203      +50     
+ Misses      16268    15699     -569     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 29 '24 14:08 codecov[bot]

Walkthrough

Ohayo, sensei! The changes involve updates to dependency specifications in Cargo.toml, modifications to method signatures for enhanced flexibility, and significant enhancements within the Saya framework. Key updates include reintroducing the starknet dependency, updating versions for celestia-rpc, celestia-types, and several other dependencies, along with the addition of new dependencies like cairo1-playground and herodotus_sharp_playground. The SayaArgs structure has been updated to include new fields for block processing and settlement options. Overall, these changes reflect a comprehensive restructuring aimed at improving the framework's maintainability and functionality.

Changes

Files Change Summary
Cargo.toml Reintroduced starknet as a workspace dependency, updated versions for celestia-rpc, celestia-types, and several other dependencies, added new dependencies like cairo1-playground, herodotus_sharp_playground, and reqwest.
bin/saya/README.md Restructured and updated documentation for Saya, emphasizing its role as a CLI service and detailing setup instructions, usage examples, and workflows for deploying contracts and running transactions.
bin/saya/src/args/mod.rs Modified SayaArgs structure to include end_block and settlement fields, updated try_from implementation for SayaConfig to accommodate new fields.
bin/saya/src/args/proof.rs Updated import for Felt type from katana_primitives to starknet::core::types, affecting ProofOptions struct fields.
bin/saya/src/args/settlement.rs Introduced SettlementOptions struct for handling settlement options in CLI, including saya_mode and settlement_contract.
crates/saya/core/src/lib.rs Enhanced SayaConfig and Saya struct to support new fields and refined block processing logic based on operational modes.
crates/saya/core/src/prover/client.rs Updated http_prove function to accept Vec<Felt> and introduced a new sharp_prove function for proof generation using SharpSdk.
crates/saya/core/src/prover/loader.rs Updated input handling by replacing Cairo0ProverInput with CairoProverInput, and modified return types for load_program and prepare_input_cairo functions for improved error handling.
crates/saya/core/src/verifier/starknet.rs Updated starknet_verify function to streamline transaction handling and enhance proof data chunking.
crates/saya/core/src/verifier/utils.rs Introduced wait_for_sent_transaction function for monitoring transaction status until confirmation or timeout.

Possibly related PRs

  • #2433: This PR involves renaming FieldElement to Felt, which is relevant as the main PR updates dependencies that include Felt types, indicating a shift in type usage across the codebase.
  • #2482: This PR focuses on renaming contract interface methods for consistency, which may relate to the overall restructuring and updates in the main PR that enhance the functionality and integration of the saya-core package.

Suggested reviewers

  • glihm

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Sep 02 '24 14:09 coderabbitai[bot]