Skip to content

build fix#71

Merged
Scratch-net merged 17 commits intomainfrom
combined-s2-oprf
Apr 6, 2026
Merged

build fix#71
Scratch-net merged 17 commits intomainfrom
combined-s2-oprf

Conversation

@Scratch-net
Copy link
Copy Markdown
Contributor

@Scratch-net Scratch-net commented Apr 6, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for "oprf-raw" redaction mode for server-side OPRF computation.
    • Added STWO ZK proof engine as an alternative to existing proof systems.
    • Exposed browser module for bundled attestor resources.
  • Improvements

    • Upgraded to ethers v6 for enhanced blockchain compatibility.
    • Improved error handling and null-safety across utilities.
  • Chores

    • Updated ESLint configuration and dependencies.
    • Bumped version to 5.0.1.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR introduces server-side OPRF ("oprf-raw") redaction support, upgrades to Ethers v6 with updated contract typings, adds Stwo ZK engine support, migrates to ESLint flat config, and updates TypeScript/build configurations to support new build scripts and output targets.

Changes

Cohort / File(s) Summary
ESLint Configuration Migration
.eslintignore, .eslintrc.yaml, eslint.config.js
Removed legacy ignore and YAML config files; introduced new flat eslint.config.js with global patterns, TypeScript parser config, and comprehensive rule sets (stylistic, TypeScript, imports, relative paths).
Ethers v6 Contract Updates
src/avs/contracts/ReclaimServiceManager.ts, src/avs/contracts/common.ts, src/avs/contracts/factories/ReclaimServiceManager__factory.ts
Replaced legacy ethers types (BigNumber, Signer, CallOverrides, TypedEvent*) with v6 abstractions (AddressLike, ContractRunner, bigint, TypedContractMethod, TypedContractEvent); updated method signatures and event typings.
Ethers v6 Utility Migration
src/avs/utils/contracts.ts, src/avs/utils/register.ts, src/avs/utils/tasks.ts, src/avs/client/create-claim-on-avs.ts, src/server/handlers/...*, src/utils/auth.ts, src/utils/b64-json.ts, src/utils/claims.ts, src/utils/signatures/eth.ts
Replaced ethers.utils.* namespace calls with direct named imports (hexlify, getBytes, randomBytes, encodeBase64, keccak256, verifyMessage); updated provider/wallet instantiation and method calls (JsonRpcProvider, EventLog filtering, hash instead of transactionHash).
Proto & Type Definitions for Stwo + oprf-raw
proto/api.proto, src/proto/api.ts, provider-schemas/http/parameters.yaml, src/types/general.ts, src/types/providers.gen.ts, src/types/zk.ts
Added ZK_ENGINE_STWO enum value; extended MessageRevealZk with oprfRawMarkers and overshotOprfRawLength; added oprf-raw to redaction hash enums; introduced OPRFRawMarker/OPRFRawReplacement types.
Server-side OPRF Computation
src/server/utils/oprf-raw.ts, src/server/utils/assert-valid-claim-request.ts
New module oprf-raw.ts computes nullifiers for plaintext segments; extended assertion validation to handle cross-block OPRF markers and apply replacements to parameters.
Stwo ZK Engine Browser & CLI Support
browser/index.html, src/scripts/fallbacks/stwo.ts, src/scripts/build-browser.ts, src/scripts/build-jsc.ts, src/utils/zk.ts
Added window import for s2circuits WASM; implemented browser fallback with witness generation and proof verification; aliased stwo package in esbuild; registered operator in engine mappings.
Redaction & Reveal Processing
src/utils/redactions.ts, src/utils/prepare-packets.ts, src/client/create-claim.ts
Added handling for oprf-raw slices: skip redaction, record markers on blocks, track cross-block overshoots; extended reveal payloads with marker/overshoot fields; updated engine proto selection.
TypeScript & Build Configuration
tsconfig.json, tsconfig.build.json, src/scripts/build-lib.ts, src/scripts/build-browser.sh, package.json
Enabled module: nodenext, added path mappings to src/*, created build-lib.ts esbuild script; updated build process to use new script and generate both lib and browser outputs; bumped dependencies including ethers@^6.16.0 and typescript@^5.9.3.
Dockerfile & Browser Build
attestor.dockerfile, browser/index.html
Added temporary build-lib.ts file creation in Dockerfile; updated HTML to import s2circuits before attestor-core init.
Test Updates
src/tests/*.ts, src/avs/tests/test.operator.ts, src/tests/zk.test.ts
Reordered imports consistently; added oprf-raw test coverage including nullifier consistency and cross-block marker validation; extended ZK engine matrix to include 'stwo'.
Code Cleanup & Utilities
src/client/utils/client-socket.ts, src/external-rpc/benchmark.ts, src/external-rpc/handle-incoming-msg.ts, src/external-rpc/types.ts, src/providers/http/*.ts, src/scripts/generate-receipt.ts, src/scripts/generate-toprf-keys.ts, src/scripts/jsc-cli-rpc.ts, src/scripts/start-server.ts, src/server/utils/nitro-attestation.ts
Replaced ethers utils with named imports; updated base64 helpers; removed/reordered ESLint suppressions; simplified catch clauses; minor import reordering for consistency.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Provider as HTTP Provider
    participant Server
    participant AVS as AVS Contract
    
    Client->>Client: Apply oprf-raw redaction<br/>(skip actual redaction,<br/>record markers)
    
    Client->>Server: Send claim with<br/>oprfRawMarkers
    
    Server->>Server: decryptTranscript()<br/>process oprf-raw markers<br/>handle cross-block overshoots
    
    Server->>Server: computeOPRFRaw()<br/>for each marker:<br/>derive nullifiers
    
    Server->>Server: assertValidProviderTranscript()<br/>apply replacements<br/>originalText → nullifierText
    
    Server->>AVS: createNewClaimRequest()<br/>(with redacted params)
    
    AVS->>Server: emit NewTaskCreated
    
    Server->>Client: Return task with<br/>redacted transcript
Loading
sequenceDiagram
    participant Client
    participant BrowserRuntime as Browser Runtime
    participant Stwo as Stwo WASM
    
    BrowserRuntime->>BrowserRuntime: Import s2circuits from<br/>window.s2circuits
    
    Client->>BrowserRuntime: generateWitness()<br/>(ZKProofInput)
    
    BrowserRuntime->>BrowserRuntime: Serialize witness to JSON<br/>with base64 fields
    
    Client->>BrowserRuntime: groth16Prove()<br/>(witness, algorithm)
    
    BrowserRuntime->>Stwo: Ensure WASM initialized<br/>fetch s2circuits_bg.wasm
    
    Stwo->>BrowserRuntime: Return proof JSON
    
    BrowserRuntime->>Client: Return proof
    
    Client->>BrowserRuntime: groth16Verify()<br/>(proof, publicSignals)
    
    BrowserRuntime->>Stwo: Call verify_*_proof
    
    Stwo->>BrowserRuntime: Return valid: bool
    
    BrowserRuntime->>Client: Return boolean result
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • adiwajshing
  • Ari4ka
  • Sajjad21990

Poem

🐰 A rabbit hops through ethers' v6 domain,
Where types now shimmer, and bigints reign.
Server-side OPRF marks the verdant trail,
Stwo engines swirl, as builders sail.
From eslint's flat ground to TypeScript heights,
This refactor bounds through cryptographic flights! 🚀

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'build fix' is vague and generic, failing to convey meaningful information about this substantial changeset involving Ethers v6 migration, ZK engine updates, OPRF-raw support, ESLint migration, and browser build enhancements. Provide a more descriptive title that captures the primary change, such as 'Migrate to Ethers v6 and add OPRF-raw support' or 'Update build system and add Stwo ZK engine'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch combined-s2-oprf

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.

@Scratch-net Scratch-net requested a review from Sajjad21990 April 6, 2026 17:28
@Scratch-net Scratch-net merged commit 27ce586 into main Apr 6, 2026
1 of 2 checks passed
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.

2 participants