PBH Transactions
The World Chain Builder introduces the concept of PBH transactions, which are standard OP transactions that target the PBHEntryPoint and includes a PBHPayload encoded in the tx calldata.
PBH 4337 UserOps
The PBHEntryPoint
contract also provides priority inclusion for 4337 UserOps through PBH bundles. A PBH bundle is a standard 4337 bundle where the aggregated signature field is consists of an array of PBHPayload
. A valid PBH bundle should include a n
PBHPayload
s, with each item corresponding to a UserOp
in the bundle.
When creating a PBH UserOp
, users will append the PBHPayload
to the signature field and specify the PBHSignatureAggregator as the sigAuthorizer. The UserOp
can then be sent to a 4337 bundler that supports PBH and maintains an alt-mempool for PBH UserOps
.
The bundler will validate the PBHPayload, strip the payload from the userOp.signature
field and add it to the aggregated signature.
/**
* Aggregate multiple signatures into a single value.
* This method is called off-chain to calculate the signature to pass with handleOps()
* @param userOps - Array of UserOperations to collect the signatures from.
* @return aggregatedSignature - The aggregated signature.
*/
function aggregateSignatures(PackedUserOperation[] calldata userOps)
external
view
returns (bytes memory aggregatedSignature)
{
IPBHEntryPoint.PBHPayload[] memory pbhPayloads = new IPBHEntryPoint.PBHPayload[](userOps.length);
for (uint256 i = 0; i < userOps.length; ++i) {
(, bytes memory proofData) = SafeModuleSignatures.extractProof(
userOps[i].signature, ISafe(payable(userOps[i].sender)).getThreshold()
);
pbhPayloads[i] = abi.decode(proofData, (IPBHEntryPoint.PBHPayload));
}
aggregatedSignature = abi.encode(pbhPayloads);
}
Upon submitting a PBH bundle to the network, the World Chain builder will ensure that all PBH bundles have valid proofs and mark the bundle for priority inclusion.
Visit the validation section of the docs to see how to encode the signalHash
for a PBH UserOps
work, check out the handleAggregatedOps() function and PBH4337Module.