Skip to content

Conversation

@karankurbur
Copy link
Collaborator

@karankurbur karankurbur commented Aug 25, 2025

  • 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)

@karankurbur karankurbur changed the title Karan pbh 2 PBH logic Aug 25, 2025
@karankurbur karankurbur marked this pull request as ready for review September 3, 2025 20:52
@karankurbur karankurbur changed the title PBH logic feat: enable sending pbh userOperations Sep 3, 2025
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"
Copy link
Contributor

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

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.


/// `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(|| {
Copy link

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;
Copy link

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;
Copy link

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?;
Copy link

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

cursor[bot]

This comment was marked as outdated.

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.

3 participants