Skip to main content
This guide covers common issues you may encounter when integrating with or developing on zkp2p-v2-contracts, along with their solutions.

Deployment Issues

Contract Deployment Fails

Symptoms: Deployment script fails with error or timeout Common Causes:
  1. Missing Environment Variables
  2. Insufficient Gas
    • Solution: Increase gas limit in hardhat.config.ts
    • Check current network gas prices
  3. Network Connection Issues
    • Verify RPC endpoint is accessible
    • Try alternative RPC provider (Alchemy, Infura)
  4. Nonce Mismatch

Deployment Scripts Skip Unexpectedly

Symptoms: Some deployment scripts don’t execute Solution: Check the func.skip condition in deployment files. Many scripts are frozen in production:
For production deployments, payment methods are now managed by 15_configure_v2_payment_methods.ts.

Contract Verification Fails

Symptoms: Etherscan/Basescan verification returns error Solutions:
  1. Check API Key:
  2. Wait for Block Confirmations:
  3. Manual Verification:
    • Use Basescan GUI with flattened contract
    • Ensure compiler version matches hardhat.config.ts

Payment Verification Issues

Payment Proof Verification Fails

Symptoms: fulfillIntent() reverts with verification error Common Errors:

“UPV: Invalid payment method”

Cause: Payment method not registered with UnifiedPaymentVerifier Solution:
See contracts/unifiedVerifier/UnifiedPaymentVerifier.sol:142

”UPV: Invalid attestation”

Cause: EIP-712 signature verification failed Solutions:
  1. Check Witness Signer:
  2. Verify Domain Separator:
  3. Check Data Hash Integrity:
See contracts/unifiedVerifier/UnifiedPaymentVerifier.sol:183-214

”UPV: Snapshot hash mismatch”

Cause: Intent snapshot doesn’t match on-chain intent Solution: Ensure all intent fields match:
See contracts/unifiedVerifier/UnifiedPaymentVerifier.sol:220-234

”UPV: Snapshot timestamp buffer exceeds maximum”

Cause: Timestamp buffer exceeds 48-hour maximum Solution:
See contracts/unifiedVerifier/UnifiedPaymentVerifier.sol:31

”UPV: Data hash mismatch”

Cause: Signed data hash doesn’t match actual data Solution:
See contracts/unifiedVerifier/UnifiedPaymentVerifier.sol:202-205

Nullifier Already Used

Symptoms: Transaction reverts with nullifier error Cause: Payment ID has already been used (double-spend prevention) Explanation: Nullifiers are created as: keccak256(abi.encodePacked(paymentMethod, paymentId)) Each payment can only be used once across the entire protocol. Solution:
  • If legitimate retry: Use a different payment (new payment ID)
  • If testing: Deploy fresh contracts or use different payment IDs
  • In production: This is expected behavior - find the original intent that used this payment
See contracts/unifiedVerifier/UnifiedPaymentVerifier.sol:242-245

Payment Method Not Found in Registry

Symptoms: signalIntent() reverts with payment method error Cause: Payment method not registered in PaymentVerifierRegistry Solution:

Intent Lifecycle Issues

Cannot Signal Intent

Symptoms: signalIntent() reverts Common Causes:

Insufficient Deposit Liquidity

Amount Below Minimum

Deposit Expired

Invalid Gating Signature

Cannot Fulfill Intent

Symptoms: fulfillIntent() reverts Common Causes:

Intent Expired

Wrong Intent State

Payment Verification Failed

See Payment Verification Issues section above.

Cannot Cancel Intent

Symptoms: cancelIntent() reverts Cause: Intent not yet expired or already fulfilled Solution:

Testing Issues

Tests Fail with Timeout

Symptoms: Tests hang or timeout Solutions:
  1. Increase Timeout:
  2. Use Fast Tests:
  3. Run Specific Suite:

Mock Contract Issues

Symptoms: Mock contracts behave unexpectedly Solution: Check mock configuration in test setup

Foundry Tests Fail

Symptoms: yarn test:forge fails Solutions:
  1. Update Foundry:
  2. Clean Cache:
  3. Check Remappings:

Integration Issues

TypeScript Type Errors

Symptoms: TypeScript compilation errors with contract types Solution: Regenerate Typechain bindings
Types are in typechain/ directory.

Contract Address Not Found

Symptoms: Cannot find deployed contract address Solution: Check deployment artifacts
Deployment artifacts are in deployments/{network}/.

Event Parsing Fails

Symptoms: Cannot parse contract events Solution: Use correct event filter and parsing

Gas Estimation Fails

Symptoms: Transaction reverts during gas estimation Solutions:
  1. Simulate Transaction:
  2. Manual Gas Limit:

Registry Permission Issues

”Caller is not owner”

Symptoms: Registry modification reverts with ownership error Cause: Only owner can modify registries Solution:

“Caller does not have write permission”

Symptoms: Cannot write to NullifierRegistry Cause: UnifiedPaymentVerifier needs write permission Solution:
See deployment script 01_deploy_unified_verifier.ts for setup example.

Network-Specific Issues

Base Network Issues

High Gas Prices

Solution: Wait for lower gas prices or increase gas budget

RPC Rate Limiting

Solution: Use dedicated RPC provider or implement retry logic

Base Sepolia (Testnet) Issues

Insufficient Test ETH

Solution: Get test ETH from Base Sepolia faucet

Test USDC Not Available

Solution: Deploy mock USDC for testing

Build & Compilation Issues

Compilation Fails

Symptoms: yarn compile fails with Solidity errors Solutions:
  1. Clean Build:
  2. Check Solidity Version:
    • Contracts require Solidity ^0.8.18
    • Verify hardhat.config.ts compiler version
  3. Missing Dependencies:

Module Not Found

Symptoms: Import errors in TypeScript files Solution: Check module aliases in tsconfig.json

Performance Issues

Slow RPC Responses

Solutions:
  1. Use Protocol Viewer: Batch queries instead of individual calls
  2. Cache Results: Store frequently accessed data locally
  3. Use Multicall: Batch multiple read operations

High Transaction Costs

Solutions:
  1. Optimize Data: Minimize data in transactions
  2. Use Relayers: For gasless transactions (configure RelayerRegistry)
  3. Batch Operations: Combine multiple actions when possible

Getting More Help

If you’re still experiencing issues:
  1. Check Test Files: See test/ for working examples
  2. Review Deployment Scripts: See deploy/ for configuration examples
  3. Read Contract Comments: Contracts have extensive NatSpec documentation
  4. Check GitHub Issues: zkp2p-v2-contracts issues
  5. Ask the Community: Visit zkp2p.xyz for community links

Useful References