Conversation
🦋 Changeset detectedLatest commit: 85464d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds GCP KMS integration and runtime envs, replaces default keeper with a named Changes
Sequence DiagramsequenceDiagram
participant Client
participant PersonaHook as Persona Hook
participant RiskSvc as Risk Assessment
participant Allower as Firewall/Allower
participant GCP as GCP KMS
participant Chain as Chain / keeper
Client->>PersonaHook: POST inquiry
PersonaHook->>RiskSvc: perform risk assessment
RiskSvc-->>PersonaHook: pass/fail
alt pass
PersonaHook->>PersonaHook: derive account
PersonaHook->>Allower: getAllower()
Allower->>GCP: init credentials / request KMS-backed account
GCP-->>Allower: LocalAccount / credentials
Allower-->>PersonaHook: allower client ready
PersonaHook->>Allower: allow(account)
Allower-->>PersonaHook: allow result
PersonaHook->>Chain: keeper.poke(account, { ignore: [...] })
Chain-->>PersonaHook: tx hash / result
PersonaHook-->>Client: 200 success
else fail
PersonaHook-->>Client: rejection
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary of ChangesHello @aguxez, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the server's account management and security by integrating Google Cloud KMS for a new Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
✅ All tests passed. |
| try { | ||
| captureRequests(parse(Requests, await request.clone().json())); | ||
| } catch (error: unknown) { | ||
| captureMessage("failed to parse or capture rpc requests", { | ||
| level: "error", | ||
| extra: { error }, | ||
| }); | ||
| } |
There was a problem hiding this comment.
request.clone() called without checking if request body was already consumed
| try { | |
| captureRequests(parse(Requests, await request.clone().json())); | |
| } catch (error: unknown) { | |
| captureMessage("failed to parse or capture rpc requests", { | |
| level: "error", | |
| extra: { error }, | |
| }); | |
| } | |
| async onFetchRequest(request) { | |
| try { | |
| const cloned = request.clone(); | |
| captureRequests(parse(Requests, await cloned.json())); | |
| } catch (error: unknown) { | |
| captureMessage("failed to parse or capture rpc requests", { | |
| level: "error", | |
| extra: { error }, | |
| }); | |
| } | |
| }, |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85464d766d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const hasETH = settled.some((r) => r.asset === ETH && r.balance > 0n); | ||
| for (const { asset, market, balance } of settled) { | ||
| if (hasETH && asset === WETH) continue; | ||
| if (balance > 0n) assetsToPoke.push({ asset, market }); |
There was a problem hiding this comment.
🚩 WETH skip logic is consistent with old code but operates on full balances
At server/utils/accounts.ts:128-131, when ETH balance is positive, WETH is skipped from poking. This mirrors the old activity.ts logic (if (assets.has(ETH)) assets.delete(WETH)), relying on the assumption that pokeETH wraps ETH to WETH and deposits the full WETH balance (including any pre-existing WETH). The difference is that the old code operated on the set of assets from a specific transfer, while the new code checks all account balances. If an account has both ETH and WETH balances, the pre-existing WETH is handled by pokeETH wrapping + depositing the combined total. This assumption should be verified against the pokeETH contract implementation.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores
Greptile Summary
this pr integrates gcp kms for a hardware-secured "allower" account and adds a firewall allow flow after kyc completion. the main changes:
keepermodule toaccountsand extractedpokemethod for simplified asset activationallower()function creates gcp kms-backed wallet client for firewall allow operationskeeper.poke()methodissues found:
getAllower()has race condition during failuresrequest.clone()optimization opportunity in allower's rpc interceptorConfidence Score: 3/5
server/hooks/persona.tsfor the firewall/panda ordering issue andserver/utils/gcp.tsfor credential validationImportant Files Changed
pokemethod that simplifies asset poking/tmpwith secure permissions, but lacks json validation before file writepokemethod, removes retry logic and inline asset poking in favor of centralized implementationSequence Diagram
sequenceDiagram participant Persona as Persona Webhook participant Hook as persona.ts Hook participant Allower as GCP KMS Allower participant Firewall as Firewall Contract participant Keeper as Keeper Account participant Account as Smart Account participant Panda as Panda API Persona->>Hook: KYC completed event Hook->>Hook: validate risk (sardine) alt risk level very_high Hook->>Persona: 200 (reject) else risk acceptable Hook->>Allower: getAllower() + allow(account) Allower->>Firewall: allow(account, true) Firewall-->>Allower: success/AlreadyAllowed Allower-->>Hook: allowed Hook->>Keeper: poke(account) [fire-and-forget] Keeper->>Account: pokeETH/poke(market) Account-->>Keeper: assets activated Keeper->>Account: send push notification Hook->>Panda: createUser() Panda-->>Hook: pandaId Hook->>Persona: 200 (success) end Note over Hook,Panda: ISSUE: firewall allow happens before panda user creationLast reviewed commit: 85464d7