-
Notifications
You must be signed in to change notification settings - Fork 10
feat: enable sending pbh userOperations #87
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
base: main
Are you sure you want to change the base?
Conversation
| reqwest = { version = "0.12.19", features = ["json"] } | ||
| ruint = { version = "1.15.0", default-features = false, features = ["serde"] } | ||
| secrecy = { version = "0.10", features = ["serde"] } | ||
| semaphore-rs = "0.3.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me think about this, wanted to keep complete separations between World App and World ID
|
|
||
| /// `PBHSignatureAggregator` - Sepolia | ||
| /// Contract reference: <https://github.com/worldcoin/world-chain/blob/main/contracts/src/PBHSignatureAggregator.sol> | ||
| pub static PBH_SIGNATURE_AGGREGATOR_SEPOLIA: LazyLock<Address> = LazyLock::new(|| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address is copy. This can just be a const. Prefer using address!
|
|
||
| impl From<WorldchainBuilderPBHPayload> for PBHPayload { | ||
| fn from(val: WorldchainBuilderPBHPayload) -> Self { | ||
| let p0 = val.proof.0 .0 .0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer semaphore_rs::protocol::Proof::from_flat
|
|
||
| const STAGING_MAX_NONCE: u16 = u16::MAX; | ||
| // TODO: UPDATE THIS ONCE SET IN PRODUCTION | ||
| const PRODUCTION_MAX_NONCE: u16 = 9000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values should be read from the PBHEntryPoint such that they never fall out of sync.
| ) -> Result<WorldchainBuilderPBHPayload, WorldIdError> { | ||
| let packed_user_op: PackedUserOperation = PackedUserOperation::from(user_op); | ||
| let signal = hash_user_op(&packed_user_op); | ||
| let external_nullifier = find_unused_nullifier_hash(network).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should join the future to fetch the inclusion proof with the future to fetch the nullifier hash
Add world id primitive for setting identity + generating PBH proofs
Will automatically fetch unused PBH nonce + generate the nullifier
Add eth_call function inside RPC for contract calls
Add pbh logic inside 4337 userOperation construction
Add RPCUserOperationv7 struct for clean serialization before sending to RPC as certain fields (paymaster/factory) were not properly removed which cause bundler errors
Set userOperation nonce using magic 5 bytes depending on if its PBH or not
Add E2E test on sepolia with hard coded staging identity (TODO: Move secret into CI)