Repository navigation
feat: integrate real GMX wallet trade data via Arbitrum RPC - #60
Merged
Merged
Conversation
- Add pipeline types and derivePipelineSteps() to lib/bot-data.ts - Create ProofPipeline component with bot selector, vertical timeline, verify button, and tx result card - Wrap AgentDashboard in shadcn Tabs (Agent Dashboard / Proof Pipeline) - Fix ConnectWallet hydration mismatch via dynamic import with ssr:false
Pipeline fixes: - Add errorAtStep tracking so failed step shows red in timeline - Fix proving phase flicker when progress is null (default to step 2) - derivePipelineSteps now accepts errorAtStep param for persistent error display Shared fixes (same as #57): - Add WASM build artifacts (prover/pkg/) and build script - Fix WASM init with promise caching to prevent race condition - Remove dead code: gas-context, chart.tsx, GasProvider, recharts, unused gas-utils fns
Add full pipeline for fetching real GMX v2 PositionDecrease events from Arbitrum mainnet, computing return_bps, and generating STARK proofs from live wallet data. Rust prover: - New gmx_fetcher module with alloy-sol-types ABI decoding for GMX v2 EventEmitter EventLogData (7 nested key-value structs) - CLI --wallet flag for real wallet proof generation via RPC - alloy-sol-types, reqwest, tokio, serde deps under cli feature Frontend: - GMX trade fetcher using thirdweb eth_getLogs RPC - generateSharpeProofFromReturns WASM wrapper - WalletProver component with trade fetching, summary, 6-step pipeline - Live Wallet tab in AgentDashboard - Arbitrum One chain definition
hoddukzoa12
requested changes
Feb 21, 2026
hoddukzoa12
left a comment
Contributor
There was a problem hiding this comment.
Review: Live Wallet 증명 구조에 데이터 출처 검증 누락
현재 Live Wallet 플로우는 bot 데모와 동일한 증명 구조를 사용하고 있습니다.
eth_getLogs로 이벤트를 가져온 뒤 return_bps를 추출하여 Sharpe STARK prover에 그대로 전달하는 방식입니다.
문제점
데이터 출처(data provenance)가 증명되지 않습니다.
현재 구조:
eth_getLogs → ABI decode → return_bps → Sharpe STARK proof
누군가 가짜 return_bps를 넣어도 유효한 proof가 생성됩니다. 즉, "계산이 맞다"는 증명하지만 "이 데이터가 실제 온체인에 존재했다"는 증명하지 않습니다.
필요한 구조
RPC → stateRoot + MPT proof (eth_getProof)
↓
STARK circuit 내에서 Keccak 기반 MPT 경로 재계산
↓
데이터가 해당 stateRoot에 속함을 binding
↓
Sharpe ratio 계산 정확성 증명 (기존)
구체적으로 추가해야 할 것
eth_getProofRPC 호출 — account/storage proof + stateRoot 가져오기- STARK circuit 내 Keccak MPT 검증 로직 — RLP 디코딩 + 트라이 경로 순회
- Boundary constraint에서 MPT root → stateRoot 바인딩
- Public input에 block hash 또는 stateRoot 포함
영향 범위
prover/src/gmx_fetcher.rs—eth_getProof호출 추가prover/src/— MPT 검증 circuit 모듈 신규prover/src/lib.rs— proving pipeline에 MPT 검증 통합lib/gmx-fetcher.ts— 프론트엔드에서도 proof 데이터 fetchcontracts/stylus/src/— verifier에 MPT 검증 constraint 추가
Live Wallet이 해커톤에서 차별화 포인트가 되려면, **"온체인 데이터의 출처까지 영지식으로 증명한다"**는 구조가 필수입니다.
12 tasks
- Add wallet address input flow (replaces TX hash input) - Fetch GMX V2 PositionDecrease events via eth_getLogs from EventEmitter - Parse basePnlUsd/sizeDeltaUsd from ABI-encoded event data to compute return_bps - Correct GMX V2 EventLog1 topic structure: [sig, keccak256(eventName), account] - Activate TC4 constraint for dataset_commitment immutability in STARK circuit - Add receipt proof module (MPT verification + dataset_commitment computation) - Add on-chain MPT verification module for Stylus verifier - Extend WASM prover with generateSharpeProofWithCommitment() - Fix WASM loading: serve from public/ instead of broken @/ alias URL - Limit trades to last 200 for browser WASM proof performance - All tests pass: prover 42/42, verifier 72/72, frontend build OK
Contributor
Receipt Proof + Wallet-Based GMX Trade Verification 구현 완료
주요 변경사항1. Wallet-Based GMX Trade Fetching (
2. Receipt Proof Data Provenance (
3. WASM Prover 확장 (
4. WalletProver UI (
테스트 결과
아키텍처남은 작업
|
Combines receipt proof pipeline (7-step wallet flow, dataset commitment binding, TC4 constraint activation) with real GMX trade fetching (ABI decoding via alloy-sol-types, wallet-based flow). Resolved conflicts: - WalletProver.tsx: use wallet-based + receipt proof pipeline - bot-data.ts: 7-step pipeline with fetching-receipt-proof phase - wasm-prover.ts: keep both generateSharpeProofFromReturns and WithCommitment - gmx_fetcher.rs: combine GMX ABI fetcher + receipt proof fetcher - main.rs: real trade fetching + optional receipt proof binding - Cargo.toml: keep alloy-sol-types + serde deps for CLI
eprintln! is unavailable in no_std environment. Remove debug prints from keccak hash test to fix cargo test compilation.
Contributor
Author
Receipt Proof 통합 완료@hoddukzoa12 구현해주신 receipt proof + wallet verification 코드를 머지했습니다. 통합 내용
추가 수정
테스트 결과
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #53
gmx_fetchermodule fetches GMX v2 PositionDecrease events from Arbitrum mainnet viaeth_getLogsJSON-RPC. Usesalloy-sol-types 0.8for ABI decoding of the complex nested EventLogData struct. CLI gets--wallet,--rpc-url,--from-block,--to-blockflags.lib/gmx-fetcher.tsfetches trades via thirdweb's RPC client.lib/wasm-prover.tsgetsgenerateSharpeProofFromReturns()wrapper. NewWalletProvercomponent with wallet input, trade summary, and 6-step proof pipeline visualization.AgentDashboardfor end-to-end flow: enter wallet → fetch GMX trades → generate STARK proof → verify on-chain.Files Changed
prover/src/gmx_fetcher.rsprover/Cargo.tomlprover/src/lib.rsgmx_fetchermodule declarationprover/src/main.rs--walletmode with async mainlib/gmx-fetcher.tslib/wasm-prover.tsgenerateSharpeProofFromReturns()lib/chains.tslib/bot-data.tsfetching-tradesphase, wallet pipeline steps, string botIdcomponents/WalletProver.tsxcomponents/AgentDashboard.tsxTest plan
cargo test --features cli— 39 tests pass (7 new gmx_fetcher tests)pnpm build— production build succeedspnpm lint— no new errorscargo run --features cli --release -- --wallet 0x<known-gmx-trader> --num-queries 4pnpm dev→ Live Wallet tab → enter wallet → Fetch → Prove → Verify