-
Notifications
You must be signed in to change notification settings - Fork 180
fix: aadhaar verifier abi go-sdk #1113
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
Conversation
WalkthroughAdds 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
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. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
sdk/sdk-go/verifier.go (1)
405-408: Consider extracting common proof formatting logic.The
aFormattedandcFormattedarrays 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
📒 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
verifyProoffunction 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 == Aadhaarcorrectly 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
VerifyProofmethod with the correct signature expecting 19 public signals for Aadhaar verification. The generated code follows standard go-ethereum binding patterns.
Nesopie
left a comment
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.
lgtm
go fixes similar to this PR #1096
Summary by CodeRabbit