Daily notes –2908

TODO

understand the expander code in detail, list what is not complete yet.

how gnark write circuit

implement gkr prover in powdr

Powdr gkr

Enum backendtype to specify the proofs system we have

backend factory is the trait that each backendtype need to implement, has create and generate_setup

The backend factory return backend type.,

backend is a trait that each backend needs to implement, it has prove, verify method.

Expander

reach until verifier eval_sparse_circuit_connect_poly

Gnark

Notes:

Box and dyn in Rust:

  • Box is a smart pointer that allocates data on the heap, used for dynamic dispatch or large data.
  • dyn keyword is used to create trait objects for dynamic dispatch, allowing polymorphism at runtime.

Dynamic Dispatch in Rust:

  • Dynamic dispatch allows method calls to be resolved at runtime rather than compile time.
  • Achieved using dyn Trait with trait objects, which involves a vtable lookup for method calls.

Adding GitHub Repo as Dependency in Rust:

  • To use a GitHub repo as a dependency in Rust and always use the latest version:toml
[dependencies]
crate_name = { git = "https://github.com/username/repo_name.git" }

The correct crate name is found in the repo’s Cargo.toml under [package].

Implementing Methods and Traits for Structs in Rust:

Use impl StructName to define methods directly for a struct.

Use impl TraitName for StructName to implement a specific trait for a struct.

Checking Rust Toolchain Version:

Use rustup show or rustc --version to verify if you are using the nightly toolchain.

Committing to a Git Branch and Open Source Contribution Workflow:

Ensure you are on the correct branch with git branch or git checkout branch_name.

Stage changes with git add . and commit with git commit -m "message".

In open source, work on a fork, create a new branch, commit changes, push to your fork, and create a Pull Request (PR) against the original repo.

Importing Submodules in Rust:

Use the underscore (_) version of the crate name when importing modules in Rust code due to Rust’s identifier rules.

Import submodules like use crate_name::module::submodule.

Arc (Atomically Reference-Counted) in Rust:

Arc<T> is a thread-safe smart pointer for shared ownership of data across threads.

Used when multiple threads need read-only access to the same data.

Creating Skeleton Functions in Rust:

  • Use todo!(), unimplemented!(), or panic!() for functions that are not yet implemented.
  • These macros will panic when called, providing a clear message that the function needs implementation.

Leave a Reply

Your email address will not be published. Required fields are marked *