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

[experiment] Remove PROGRAM_SIZE from type #587

Closed
wants to merge 7 commits into from

Conversation

mcalancea
Copy link
Collaborator

@mcalancea mcalancea commented Nov 13, 2024

naure:

@@ -152,10 +152,10 @@ impl<E: ExtensionField> ZKVMConstraintSystem<E> {
config
}

pub fn register_table_circuit<TC: TableCircuit<E>>(&mut self) -> TC::TableConfig {
pub fn register_table_circuit<TC: TableCircuit<E>>(&mut self, tc: TC) -> TC::TableConfig {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There could be a convenience method (original name) that uses Default (if implemented) and a new one with the parameter.

impl<TC> …
where TC::TableConfig: Default {
    pub fn register_table_circuit() {
        let tc = Default::default();}

impl<TC>{
    pub fn register_table_circuit_param(, tc: TC) {}

Copy link
Collaborator

Choose a reason for hiding this comment

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

This way there is no need to change every call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 agreed, got a bit carried away there

@naure naure requested a review from hero78119 November 15, 2024 11:30
@matthiasgoergens
Copy link
Collaborator

I agree that we probably went a bit overboard with trying to using usize in types everywhere, even when it's not useful.

@mcalancea mcalancea marked this pull request as ready for review November 18, 2024 12:07
@mcalancea mcalancea requested a review from naure November 18, 2024 12:18
@naure naure mentioned this pull request Nov 18, 2024
@@ -104,11 +104,22 @@ pub struct ProgramTableConfig {
mlt: WitIn,
}

pub struct ProgramTableCircuit<E, const PROGRAM_SIZE: usize>(PhantomData<E>);
#[derive(Clone, Default)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Default here is 0 size which is probably not what you want. Just leave it without default to force the use of the …_param function?

pub trait TableCircuit<E: ExtensionField> {
pub trait TableCircuit<E: ExtensionField>
where
Self: Default,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This Default requirement could move as far out as possible towards the function that actually needs it.

&zkvm_cs,
&prog_config,
vm.program(),
ptc_with_size,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I applied the same change to this new file.

@naure
Copy link
Collaborator

naure commented Nov 20, 2024

Before merging, let’s compare this with the approach of cb.platform in #608

@naure
Copy link
Collaborator

naure commented Nov 20, 2024

Preferring #608.

@naure naure closed this Nov 20, 2024
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.

3 participants