fix(ec): use x-coordinate equality to detect special cases in operate_with_affine #516
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Kimi PR Review | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| review: | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get PR diff | |
| id: diff | |
| run: | | |
| DIFF=$(gh pr diff ${{ github.event.pull_request.number }} --repo ${{ github.repository }}) | |
| # Truncate if too large (100KB limit) | |
| if [ ${#DIFF} -gt 100000 ]; then | |
| DIFF="${DIFF:0:100000}... [truncated]" | |
| fi | |
| # Save to file to handle special characters | |
| echo "$DIFF" > /tmp/pr_diff.txt | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Call Kimi API for review | |
| id: kimi_review | |
| run: | | |
| SYSTEM_PROMPT="You are a code reviewer for lambdaworks, a Rust cryptographic library implementing finite fields, elliptic curves, and zero-knowledge proof systems (STARKs, SNARKs). Review code changes focusing on: 1) Mathematical correctness (field operations, curve arithmetic, polynomial operations), 2) Cryptographic security (timing side-channels, constant-time operations, proper randomness, zeroization), 3) Performance (unnecessary allocations, efficient algorithms), 4) Bugs and errors (panics, memory safety, edge cases), 5) Code simplicity and maintainability. Be concise and only comment on actual issues." | |
| USER_PROMPT="Review this PR diff and provide feedback on any issues found. Be specific about file names and line numbers when possible:" | |
| # Build JSON payload safely using jq | |
| DIFF_CONTENT=$(cat /tmp/pr_diff.txt) | |
| PAYLOAD=$(jq -n \ | |
| --arg model "moonshot-v1-128k" \ | |
| --arg system "$SYSTEM_PROMPT" \ | |
| --arg user "$USER_PROMPT" \ | |
| --arg diff "$DIFF_CONTENT" \ | |
| '{ | |
| model: $model, | |
| messages: [ | |
| { role: "system", content: $system }, | |
| { role: "user", content: ($user + "\n\n" + $diff) } | |
| ], | |
| temperature: 0.3 | |
| }') | |
| RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "https://api.moonshot.ai/v1/chat/completions" \ | |
| -H "Content-Type: application/json" \ | |
| -H "Authorization: Bearer ${{ secrets.KIMI_API_KEY }}" \ | |
| -d "$PAYLOAD") | |
| HTTP_CODE=$(echo "$RESPONSE" | tail -n1) | |
| BODY=$(echo "$RESPONSE" | sed '$d') | |
| if [ "$HTTP_CODE" != "200" ]; then | |
| echo "error=true" >> $GITHUB_OUTPUT | |
| echo "error_message=Kimi API request failed with status $HTTP_CODE" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| REVIEW=$(echo "$BODY" | jq -r '.choices[0].message.content') | |
| # Save review to file to avoid output escaping issues | |
| echo "$REVIEW" > /tmp/review.txt | |
| echo "success=true" >> $GITHUB_OUTPUT | |
| - name: Post review comment | |
| if: steps.kimi_review.outputs.success == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const review = fs.readFileSync('/tmp/review.txt', 'utf8'); | |
| if (review && review.trim() !== '') { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: `## Kimi AI Review\n\n${review}` | |
| }); | |
| } | |
| - name: Post error comment | |
| if: steps.kimi_review.outputs.error == 'true' | |
| uses: actions/github-script@v7 | |
| env: | |
| ERROR_MESSAGE: ${{ steps.kimi_review.outputs.error_message }} | |
| with: | |
| script: | | |
| const errorMessage = process.env.ERROR_MESSAGE || 'Unknown error'; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: `## Kimi AI Review\n\n:warning: Review failed: ${errorMessage}` | |
| }); |