-
Notifications
You must be signed in to change notification settings - Fork 996
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
EIP4844: Suggestion to remove ssz from the Fiat-Shamir function #3026
Comments
Hello, You are effectively saying that you don't trust that I think that's a reasonable defense in-depth argument given what's at stake. I also think your pseudocode for I guess the counter argument for this is that the crypto library does not know that Fiat-Shamir is used above it. It only exposes a All in all, I think a patch for this would be a reasonable improvement. |
Why does it need to be bijective? An injective function would be enough, right? I think it is fairly easy to prove that SSZ is injective |
Right, but this dependency on ssz is not necessary and doesn't seem to provide any advantages, since the cryptography library is able to handle the Fiat-Shamir protocol internally. Should something ever change with the way clients implement the necessary methods on a user defined struct for ssz, the cryptography will not need to be re-analysed, for example. I don't know how likely that example is, but if we can avoid the dependency, I see no reason not to? |
Good point, I find testing and modularising the Fiat-Shamir protocol hardens the code and makes it easier to reason about security. An example of what I was referring to can be seen here: So the Fiat-Shamir protocol is encapsulated in this Transcript struct which allows you to add polynomials and points. I tend to do it this way because the Fiat-Shamir protocol usually has its own set of recommended practices such as domain separators, so this isolates it even further. Not relevant to this issue, but domain separator usage can be seen here for example: https://github.com/zcash/halo2/blob/main/halo2_proofs/src/transcript.rs#L140 If the Fiat-Shamir protocol ever needs changing, the code for kzg can stay exactly the same and we just modify the transcript file. |
Right, but I guess SSZ (which is a strict dependency of Ethereum) would also be fundamentally broken if SSZ were not injective. So from my point of view this does not introduce any new assumptions. |
Yep, though it would still be an unnecessary abstraction leak into the cryptography module. I think it's advantageous to not have the cryptography rely on any extraneous assumptions. I linked some code above to show how one can encapsulate the Fiat-Shamir protocol if this extra assumption is removed. In terms of conventions, I think using ssz or some other objective function for Fiat-Shamir is more out of the norm than using the serialisation format that comes with points and field elements, see the halo2 impl I linked above |
The method to create Fiat-Shamir challenges looks like:
For security, the Fiat-Shamir protocol requires a bijection from an object to bytes. This is the case if the serialise methods on an ssz struct is setup correctly since ssz was intended to be bijective.
This however indirectly ties the security of the commitment scheme to the ssz serialisation strategy, ie its not possible to test the Fiat-Shamir component entirely in the cryptography library without first assuming that the serialisation strategy that caller is using is bijective (The cryptography would only receive bytes). This seems to be an abstraction leak.
To keep the cryptography completely modularised, one could implement this function as:
The cryptography already knows how to de/serialise field and group elements, so the
hash_to_bls_field
can live in the cryptography code and tested in isolation.Changes implied
Instead of:
It would be called as:
@hwwhww and @asn-d6 The ssz addition seems to have been introduced by you folks, If this change seems reasonable, I can push a PR. Eager to hear your thoughts.
The text was updated successfully, but these errors were encountered: