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

Use Poseidon for DKIM hash #115

Merged
merged 12 commits into from
Oct 6, 2023
Merged

Use Poseidon for DKIM hash #115

merged 12 commits into from
Oct 6, 2023

Conversation

saleel
Copy link
Member

@saleel saleel commented Oct 4, 2023

  • Use Poseidon for DKIM public key hash
  • Update popular hash in Registry contract
  • Generate new zkeys and use that in app
  • Deploy new twitter verifier contract
  Deployed Verifier at address: 0x875F326eFD04e039E9dB88fC46691E1B2F6360d1
  Deployed DKIMRegistry at address: 0x2a0745998d11FDaEe023593CaBD57C560D8FceF9
  Deployed VerifiedTwitterEmail at address: 0xa127bf93568195163F8696Af2DD98a20B92682f7

ZkRepl to generate DKIM hash for other domains - https://zkrepl.dev/?gist=43ce7dce2466c63812f6efec5b13aa73

@socket-security
Copy link

socket-security bot commented Oct 4, 2023

No top level dependency changes detected. Learn more about Socket for GitHub ↗︎

@saleel saleel force-pushed the poseidon-dkim-hash branch 2 times, most recently from 6390845 to 8764f31 Compare October 4, 2023 19:31
@saleel saleel marked this pull request as draft October 4, 2023 20:03
@saleel saleel marked this pull request as ready for review October 5, 2023 06:46

Run
```bash
./7_gen_solidity_verifier.sh
Copy link
Member

Choose a reason for hiding this comment

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

finally haha -- thanks for this

dkimPublicKeyHashes["hotmail.com"] = bytes32(uint256(2431254542644577945126644490189743659677343436440304264654087065353925216026));
dkimPublicKeyHashes["twitter.com"] = bytes32(uint256(5857406240302475676709141738935898448223932090884766940073913110146444539372));
dkimPublicKeyHashes["ethereum.org"] = bytes32(uint256(1064717399289379939765004128465682276424933518837235377976999291216925329691));
dkimPublicKeyHashes["skiff.com"] = bytes32(uint256(7901875575997183258695482461141301358756276811120772965768802311294654527542));
Copy link
Member

Choose a reason for hiding this comment

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

For people to verify, I wonder if we should make this more legible in solidity. So i.e. if we have comments with the original raw key and a link to a 3 line repl.it that gets from dns and hashes it.

Copy link
Member Author

Choose a reason for hiding this comment

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

True. We can add something.
But the raw key is also just is a large number array. Users would still need the selector and some method to convert to dns dkim value to 17*121 chunk

Copy link
Member

Choose a reason for hiding this comment

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

Right -- so the 3 line repl could just show this decomposition. Like these numbers are just completely illegible for the public to verify

"scripts": {
"test": "NODE_OPTIONS=--max_old_space_size=16384 jest"
},
"dependencies": {
"@zk-email/circuits": "workspace:^",
"@zk-email/helpers": "workspace:^",
"big-integer": "^1.6.51",
"snarkjs": "https://github.com/sampritipanda/snarkjs.git#fef81fc51d17a734637555c6edbd585ecda02d9e"
"snarkjs": "git+https://github.com/vb7401/snarkjs.git#24981febe8826b6ab76ae4d76cf7f9142919d2b8"
Copy link
Member

Choose a reason for hiding this comment

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

Wait this doesn't work well with the frontend; sampritipanda's fork was needed for that. Are you sure this works?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is only twitter-circuits package.json where we use snarkjs for zkey generation and all. We are using vb fork anyway in the sh file when generating chunked zkeys. Just made that as the default in package.json for this package. Its same either way as the scripts override to use this when needed.
Can revert if it dont make sense. FE works fine.

Copy link
Member

Choose a reason for hiding this comment

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

Huh weird. I don't remember why we use vb7401 to generate chunked zkeys instead of sampritipanda. Should be fine then I guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍
Hmm, next time we need to change circuit, I will compare the commits.

@Divide-By-0 Divide-By-0 merged commit 2d9c28c into main Oct 6, 2023
2 checks passed
@saleel saleel deleted the poseidon-dkim-hash branch April 19, 2024 04:28
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