✨ server: new infra and refund automation - #1220
Conversation
🦋 Changeset detectedLatest commit: 94f69e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
|
Important Review skippedToo many files! This PR contains 136 files, which is 36 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (136)
You can disable this status message by setting the 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 |
|
@codex review |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1220 +/- ##
==========================================
+ Coverage 65.31% 74.64% +9.33%
==========================================
Files 252 270 +18
Lines 10338 14345 +4007
Branches 3490 5170 +1680
==========================================
+ Hits 6752 10708 +3956
+ Misses 3321 3278 -43
- Partials 265 359 +94
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cbf0d8ef2
ℹ️ 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".
| ).catch((error: unknown) => captureException(error, { level: "error" })); | ||
| } | ||
| try { | ||
| await refund.enqueue(payload.id); |
There was a problem hiding this comment.
Queue Panda withdrawals after refund success
Because this runs before wallet.exaSend, any refund attempt that later fails or is treated as a Replay still has a withdrawal job scheduled. For redelivered refund webhooks, the on-chain refund can be skipped as a replay while the worker still withdraws the same amount from Panda again, so the withdrawal should be enqueued only after a successful refund receipt.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5fbca97c0a
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9f268bb69
ℹ️ 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".
| activityKey: env.ALCHEMY_ACTIVITY_KEY, | ||
| executor: keeper, | ||
| onesignalKey: env.ONESIGNAL_API_KEY, | ||
| postgresUrl: parse(pipe(string(), nonEmpty()), env.POSTGRES_URL), |
There was a problem hiding this comment.
Share the database pool in the monolith
In the Docker dist/index.cjs path this process still mounts the API plus all hook apps together, but each factory that receives postgresUrl now creates and closes its own drizzle(postgresUrl, ...) client internally. This is the first of several separate pools created in the same server instance (activity, bridge, manteca, panda, persona, plus the default maturity database), whereas the previous monolith shared one database singleton; with multiple replicas this can exhaust managed Postgres connection limits before any traffic increase. Please share the database handle for the monolith path or avoid instantiating all split factories in one process.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca35b71f65
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79ec6e98ff
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62f19c909d
ℹ️ 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".
co-authored-by: danilo neves cruz <cruzdanilo@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94f69e1025
ℹ️ 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".
| await (receipt && | ||
| settle.enqueue( | ||
| { blockNumber: Number(receipt.blockNumber), hash: parse(Hash, receipt.transactionHash) }, | ||
| webhookId, | ||
| )); |
There was a problem hiding this comment.
Preserve settlement publishing across replay retries
If settle.enqueue fails after the atomic refund transaction has mined, BullMQ retries the refund job, but the retry hits Replay() and exaSend returns no receipt, so this conditional skips the settlement queue and marks the job complete. The on-chain refund then permanently lacks its database transaction update, notification, and risk/analytics feedback. Fresh evidence in this revision is the new atomic Replay() ignore path, which returns no receipt on the retry; settlement publication therefore needs to be recoverable independently of the original receipt.
Useful? React with 👍 / 👎.
| new kms.CryptoKey( | ||
| `${stack.name}-${key}`, | ||
| { | ||
| keyRing: keyRing.id, | ||
| name: `${stack.name}-${key}`, |
There was a problem hiding this comment.
Grant the HSM refunder its keeper role
For every newly created ${stack}-refunder HSM key, its derived address differs from the fixed acct("keeper") address granted KEEPER_ROLE when Refunder is deployed in contracts/script/Refunder.s.sol, and a repo-wide search finds no subsequent grantRole provisioning for this signer. Even after the separate gas-funding problem is addressed, every worker batch therefore reaches Refunder.refund with the HSM address as msg.sender and reverts Unauthorized; provision the derived address on the contract before enabling the worker.
Useful? React with 👍 / 👎.
closes #799