Conversation
|
Are there any security implications to this? If I send someone a POD Request containing this magic value as a RawValue, will it get replaced with the POD ID? Or does this only apply when copying statements from an existing POD - so the statement starts out referring to SELF, but then refers to the POD ID it was copied from when it was copied? That feels pretty spooky to me. I think this means that clients, including the solver, would need to become aware of the effect of this constant. As it stands, I think this breaks the use-case of "run the request through the solver again, but with the response as the sole input", because now the request might stipulate a different value to the one returned in the response. I'm still pretty skeptical of the use-case that motivates this, and of adding magic. In isolation each bit of magic seems reasonable, until there's enough magic that it becomes hard to reason about what's going on. |
|
I don't think of #342 as being tied to a specific use case of self-referential pods. A custom statement could take a pod ID, and be agnostic as to whether that ID is SELF. Currently, the system will produce an incorrect statement if the ID happens to be SELF. |
|
I don't think it's really incorrect - if I make a POD Request which says |
|
Having thought a bit more about it: would it be possible to go back to the earlier solution of having SELF as a special-case wildcard, rather than a special-case literal? Representing placeholder values as wildcards just seems much cleaner, and "wildcards in requests become literal values in responses" is an existing pattern, whereas "literal values can change to become other literal values" isn't. |
src/middleware/basetypes.rs
Outdated
| use plonky2::{ | ||
| field::types::{Field, PrimeField64}, | ||
| field::{ | ||
| goldilocks_field::GoldilocksField, |
There was a problem hiding this comment.
We rename this type as F here
pod2/src/backends/plonky2/basetypes.rs
Line 14 in 143a8c9
And then re-export it in the middleware here
pod2/src/middleware/basetypes.rs
Line 49 in 143a8c9
To be consistent could you remove this import and rewrite the SELF_ID_HASH as [F(0x5), F(0xe), ...?
| let is_self = builder.is_equal_flattenable(&self_value, &first); | ||
| let normalize = builder.and(is_ak, is_self); | ||
| let first_normalized = builder.select_flattenable(params, normalize, self_id, &first); | ||
| let first_normalized = builder.select_flattenable(params, is_self, self_id, &first); |
There was a problem hiding this comment.
You should also update the documentation and implementation of the native version of this function at
Lines 769 to 783 in 143a8c9
If someone sends a POD Request that contains a statement with a literal RawValue with this new magic value, you'll create a pod that exposes a public statement where that magic value will be replaced by the pod_id. At the same time, when you use that pod as input to another pod, the circuit will apply this replacement before operating on those statements.
Could you elaborate on that? One way to think about this is that the
I don't disagree about this being a little bit of magic. I just hope we discuss and figure out if this breaks anything that can't be solved nicely! To me this PR is fixing a bug described in #342 The bug is the following. Imagine the following custom predicates The intention of those is that if I can create a But in the current implementation I'm able to generate the statements After writing this example I realize it conveys the idea, but it's weird. But I believe that once we have the |
I think that implies some kind of type checking in-circuit. You mean that a value used as pod_id to be placed as a wildcard for the pod_id of an anchored key is different than a value to be placed as a wildcard in a value slot right? Currently the argument to the statement doesn't distinguish those cases. We'd need to add some typing information to do that (that's the solution 1 in #342 (comment)). Basically in the StatementArg we'd have Is this what you mean? The current implementation is simple because we don't distinguish |
If I write We already have a system for dealing with prover-supplied values, which is wildcards.
This seems wrong to me. We already have a system for signing things - SignedPod! If you want to make a signature over some data, you can create a SignedPod to do it! If you want to sign a message saying something like "I endorse the contents of this MainPod", then you can make a SignedPod with an entry whose value is the hash of the MainPod. This also has the advantage of being much cheaper than making a new MainPod if you just want to prove that you control the keypair of a public key mentioned in the MainPod whilst also, say, signing a nonce to prevent credential reuse.
I'm just thinking of the special SELF wildcard, which is what we had before the literals-in-statements change. That wildcard can become the real POD ID during proving. |
|
I think I'd need to have a deeper in-person conversation to fully understand the issue under discussion here, so take my thoughts as only loosely-held opinions. But I've been following along and have some knee-jerk reactions.
PublicKeyOf is one way to get there. Rob and I talked through some ways to get there using the RSAPOD or a known secret entry some other POD. I think the construction right now requires a custom predicate in order to ensure the known value stays private, while confirming it came from the same MainPOD rather than being copied from another one. A part of me wants this concept of "prover identity" to be more of a first-class notion in the language. |
I see, I understand that now. This may be a bit of stretch but currently if you do Technically you could simulate the environment of the prover (where you still have
I don't see the
I understand what you say. I also wonder what use-cases
Ah, you mean when an anchored key in a statement template argument was something like |
Closes #342 .