Skip to content

Optimize dependency tree for primitives crate #664

@paolodamico

Description

@paolodamico

From the primitives crate chater.

Core foundational types and structures for the World ID Protocol. Importantly, this crate keeps dependencies to a minimum and does not implement any logic beyond serialization and deserialization.

At this point the crate has become too bloated and has too many dependencies to be simply types and structures. Looking into optimizing this will be quite beneficial as there are multiple consumers of this. Beyond the initial step of analyzing which deps are contributing the most and getting creative about removing them, outlining some ideas below.

  1. We're mixing logic in this crate. For example, compressing and uncompressing proofs should probably go in the proof crate, or serializing circuit inputs into Groth16 inputs.
  2. There are many crates dedicated to exposing types for Circom proofs (e.g. groth16-material, circom-types, taceo-groth16-sol, ...). We could look into restructuring these deps so that only basic typed structures are imported. May require upstream dep updates.
  3. Signing logic should probably not be in primitives. Remove most of alloy dependencies and import them in the crates that need the actual signing logic.
  4. We're using sha3 for a sponge construction of arbitrary bytes into the field. Likely using an existing dep is enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions