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

Circuit dynamic configure #2

Closed

Conversation

freeranged3v
Copy link

@freeranged3v freeranged3v commented Jul 19, 2023

@@ -470,14 +470,34 @@ pub trait Circuit<F: Field> {
/// `Circuit` trait because its behaviour is circuit-critical.
type FloorPlanner: FloorPlanner;

/// Runtime parameters to configure the circuit.
#[cfg(feature = "circuit-params")]
type Params: Default = ();
Copy link
Author

Choose a reason for hiding this comment

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

Associated type default: rust-lang/rust#29661

Copy link
Author

Choose a reason for hiding this comment

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

@parazyd Would turning on this unstable feature - associated type default - be a good idea?

I think tradeoff is:

the pro:

  • won't break any circuits implementing the Circuit trait from zcash/halo2, which seems nice, one can use zcash/halo2 Circuit implementing circuits with this fork directly

the cons:

  • potential corner cases (though the usage is simple here)
  • need to migrate if and when Rust team introduces a breaking change (but the alternative is breaking the circuits now)

other misc points:

  • Using an unstable feature requires depending on nightly which we already do in CI, so I think it isn't an issue.


impl<F: Field> Circuit<F> for MyCircuit {
type Config = ();
impl Circuit<pallas::Base> for MyCircuit {
Copy link
Author

Choose a reason for hiding this comment

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

Test case that should be helpful to see the flow.

@@ -54,7 +54,7 @@ blake2b_simd = "1"
maybe-rayon = {version = "0.1.0", default-features = false}

# Developer tooling dependencies
plotters = { version = "0.3.0", default-features = false, optional = true }
plotters = { version = "0.3.0", optional = true }
Copy link
Author

Choose a reason for hiding this comment

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

I turned on the default features to generate a test circuit layout, the PSE fork has the defaults on too.

@parazyd
Copy link
Owner

parazyd commented Jul 20, 2023

Thanks a lot. I'll merge this manually and add a few tweaks.

@parazyd parazyd closed this Jul 20, 2023
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.

2 participants