Skip to content

Conversation

@Vishalkulkarni45
Copy link
Collaborator

@Vishalkulkarni45 Vishalkulkarni45 commented Sep 22, 2025

go fixes similar to this PR #1096

Summary by CodeRabbit

  • New Features
    • Go SDK now supports Aadhaar attestation verification alongside existing attestations.
    • Automatically selects the appropriate verifier based on attestation type.
    • Accepts Aadhaar-specific proof and public signal formats, handling required array sizes seamlessly.
    • Maintains compatibility with existing verification flows for non-Aadhaar attestations.
    • Provides clear error propagation per attestation path to aid debugging.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

Adds a new Aadhaar-specific verifier ABI and generated Go bindings, then updates sdk-go verifier logic to branch by attestation type. The flow prepares proof inputs, selects Aadhaar vs regular verifier contracts, sizes public signals to 19 or 21 accordingly, and calls the respective VerifyProof method.

Changes

Cohort / File(s) Summary
ABI: Aadhaar verifier
sdk/sdk-go/contracts/abi/AadhaarVerifier.abi
Introduces ABI for AadhaarVerifier with verifyProof(a,b,c,pubSignals[19]) view function returning bool.
Go bindings: Aadhaar verifier
sdk/sdk-go/contracts/bindings/AadhaarVerifier.go
Adds generated Go bindings exposing AadhaarVerifier ABI, constructors, sessions, raw access, and VerifyProof method mapping.
SDK verifier logic
sdk/sdk-go/verifier.go
Implements attestation-based branching: binds AadhaarVerifier vs Verifier, formats proof arrays, sets public signal length (19 vs 21), and calls the corresponding VerifyProof.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App
  participant SDK as sdk/sdk-go/verifier.go
  participant Eth as Ethereum Node
  participant AV as AadhaarVerifier (contract)
  participant V as Verifier (contract)

  App->>SDK: Verify(proof, attestationId, verifierAddress)
  SDK->>SDK: Format a[2], b[2][2], c[2]
  alt attestationId == Aadhaar
    SDK->>Eth: Bind AadhaarVerifier(verifierAddress)
    SDK->>SDK: Build pubSignals[19]
    SDK->>AV: verifyProof(a,b,c,pubSignals[19]) (call)
    AV-->>SDK: bool
  else
    SDK->>Eth: Bind Verifier(verifierAddress)
    SDK->>SDK: Build pubSignals[21]
    SDK->>V: verifyProof(a,b,c,pubSignals[21]) (call)
    V-->>SDK: bool
  end
  SDK-->>App: result bool or error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fix: aadhaar verifier abi #1096 — Adds AadhaarVerifier ABI and bindings with attestation-specific selection, matching the new Aadhaar path and VerifyProof signature.
  • Feat/aadhaar sdk #1082 — Implements Aadhaar attestation support and modifies Go verifier codepaths similarly to this branching logic.
  • feat: add new verifiers #1049 — Introduces Aadhaar-specific Solidity verifier exposing verifyProof with 19 pubSignals, aligning with the new ABI and calls here.

Poem

New paths in chains of truth we thread,
Aadhaar’s gate with 19 led,
Arrays aligned, the proofs compile,
Two doors, one call, a different dial.
Bits attest, the booleans sing—
Verified or not—on Ethereum’s ring.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix: aadhaar verifier abi go-sdk" is concise and accurately reflects the main change in the diff (adding/updating the AadhaarVerifier ABI and corresponding Go SDK bindings and verifier logic), so it is relevant and understandable to a teammate scanning history. It avoids noise and is specific enough about the primary change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/aadhaar-verifier-go

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
sdk/sdk-go/verifier.go (1)

405-408: Consider extracting common proof formatting logic.

The aFormatted and cFormatted arrays are computed identically for both Aadhaar and regular paths. Consider extracting this to avoid duplication:

-	// Convert proof format: swaps B coordinates [proof.b[0][1], proof.b[0][0]]
-	aFormatted := [2]*big.Int{a0, a1}
-	cFormatted := [2]*big.Int{c0, c1}
+	// Format proof components (shared between both paths)
+	aFormatted := [2]*big.Int{a0, a1}
+	cFormatted := [2]*big.Int{c0, c1}

Actually, the code is already clean. The comment could be improved to clarify that these are shared between both verification paths.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a70c06d and f3c6bd1.

📒 Files selected for processing (3)
  • sdk/sdk-go/contracts/abi/AadhaarVerifier.abi (1 hunks)
  • sdk/sdk-go/contracts/bindings/AadhaarVerifier.go (1 hunks)
  • sdk/sdk-go/verifier.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
sdk/sdk-go/verifier.go (3)
sdk/sdk-go/contracts/bindings/Verifier.go (2)
  • Verifier (42-46)
  • NewVerifier (101-107)
sdk/sdk-go/contracts/bindings/AadhaarVerifier.go (2)
  • AadhaarVerifier (42-46)
  • NewAadhaarVerifier (101-107)
sdk/sdk-go/utils.go (1)
  • Aadhaar (19-19)
🔇 Additional comments (5)
sdk/sdk-go/contracts/abi/AadhaarVerifier.abi (1)

1-37: LGTM! ABI definition looks correct for Aadhaar verification.

The ABI properly defines the verifyProof function with 19 public signals, which aligns with the Aadhaar-specific verification requirements. The view function signature and parameter types are correctly specified.

sdk/sdk-go/verifier.go (3)

350-363: Good implementation of attestation-specific verifier selection.

The conditional branching based on attestationId == Aadhaar correctly instantiates the appropriate verifier contract. The error messages are distinct and helpful for debugging.


409-432: Public signals array initialization looks correct.

The dynamic sizing based on attestation type (19 for Aadhaar, 21 for others) is properly implemented. The loop correctly handles both hex-prefixed and decimal string formats, and zero-padding for missing signals is appropriate.


434-444: Conversion pattern is safe — no changes required.
publicSignalLength is set to 19/21, publicSignalsArray is allocated to that length, the loop truncates extra inputs and zero‑pads missing entries before the fixed‑array copy.

sdk/sdk-go/contracts/bindings/AadhaarVerifier.go (1)

1-213: Generated binding file looks correct.

This is an auto-generated file from the ABI, and the bindings properly expose the VerifyProof method with the correct signature expecting 19 public signals for Aadhaar verification. The generated code follows standard go-ethereum binding patterns.

Copy link
Collaborator

@Nesopie Nesopie left a comment

Choose a reason for hiding this comment

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

lgtm

@Nesopie Nesopie merged commit ca7292b into dev Sep 22, 2025
14 checks passed
@Nesopie Nesopie deleted the fix/aadhaar-verifier-go branch September 22, 2025 07:24
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