noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
902 stars 203 forks source link

Warn on error when entrypoint argument has private members #6582

Open asterite opened 1 day ago

asterite commented 1 day ago

Problem

Consider this code:

mod foo {
    pub struct Foo {
        inner: Field,
    }
}

use foo::Foo;

struct Bar {
    foo: Foo,
}

fn main(bar: Bar) {}

Happy Case

The above code should probably warn or error. See this comment:

Idea being that we're breaking encapsulation of that private member because a user needs to input it when ABI encoding. If I add a new field then that's now a breaking change.

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response