Skip to content

feat(minter): scan the watched deposit addresses on a timer and queue the detected deposits - #283

Draft
gregorydemay wants to merge 11 commits into
DEFI-2780-07-get-multiple-accountsfrom
DEFI-2780-08-scan-timer
Draft

gregorydemay wants to merge 11 commits into
DEFI-2780-07-get-multiple-accountsfrom
DEFI-2780-08-scan-timer

Conversation

@gregorydemay

@gregorydemay gregorydemay commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Adds the scan timer of the automatic deposit flow of #272: every minute, the due watched addresses are read in batches, a balance reaching the minimum deposit amount is queued exactly as deposit_sol would queue it, with the fee in force, and a failed read counts as a scan so that the cost of a registration stays within its schedule. Covered by unit tests of the scan and a PocketIC test of a deposit detected and queued by the timer.

🤖 Generated with Claude Code

@gregorydemay
gregorydemay added this pull request to stack #288 October 14, 2026 08:50
@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from a51206a to 0f2515d Compare October 14, 2026 09:04
Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A concurrent manual deposit can race with the scan and trigger the duplicate in-flight deposit assertion.

1 open finding
What changed in this PR

Adds timer-driven scanning of watched Solana deposit addresses and queues eligible deposits automatically.

Changes:

  • Adds batched balance scanning with scheduling and concurrency guards.
  • Adds scan metrics and unit/integration coverage.
  • Updates automatic-deposit design documentation.
File Description
minter/​src/​storage/​mod.rs Stores scan outcome counters.
minter/​src/​state/​mod.rs Adds scan task and deposit-call lookup.
minter/​src/​rpc/​mod.rs Enables the balance batching helper.
minter/​src/​metrics.rs Exposes scan outcome metrics.
minter/​src/​main.rs Registers the scan timer.
minter/​src/​deposit/​automatic/​scan/​tests.rs Tests scan behavior and scheduling.
minter/​src/​deposit/​automatic/​scan/​mod.rs Implements watched-address scanning.
minter/​src/​deposit/​automatic/​mod.rs Exports scan functionality.
minter/​src/​constants.rs Defines the scan interval.
integration_tests/​tests/​tests.rs Tests timer-based deposit detection.
integration_tests/​src/​fixtures.rs Adds batched-account RPC mocks.
docs/​src/​development/​design.md Updates scan behavior and cost bounds.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread minter/src/deposit/automatic/scan/mod.rs
Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:18
@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from 0f2515d to 3dd1c23 Compare October 14, 2026 09:18
@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from 3dd1c23 to bea3e02 Compare October 14, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A scan racing with deposit_sol can queue the same account twice and trigger a state assertion.

1 open finding

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An overlapping manual deposit request and scan callback can attempt to queue the same account and trap.

1 open finding

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:35
@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from bea3e02 to 762ac1e Compare October 14, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The scan callback can race with an in-progress manual deposit and cause a trap or stale duplicate queue.

1 open finding

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:56
@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from 762ac1e to 1759edf Compare October 14, 2026 09:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A concurrent manual deposit can race with the scan and trap after the scan queues the same account.

1 open finding

🧠 Review effort: Balanced

@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from 1759edf to ff97862 Compare October 14, 2026 11:19
Copilot AI balanced review requested due to automatic review settings October 14, 2026 11:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A scan can race with an already-pending manual deposit call and trigger a duplicate-queue panic.

1 open finding

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The reported race between automatic scanning and manual deposit queuing remains unresolved.

2 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 15, 2026 09:54
@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from 3c7acd9 to 30ab415 Compare October 15, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Overlapping automatic scans and manual deposits can cause the manual callback to queue a duplicate deposit and trap.

2 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 15, 2026 11:28
@gregorydemay
gregorydemay force-pushed the DEFI-2780-08-scan-timer branch from 30ab415 to 5aac9f7 Compare October 15, 2026 11:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The reported race between scanning and overlapping manual deposits remains unresolved and can cause a manual deposit callback to trap.

2 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 15, 2026 12:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The reported scan/manual-deposit race remains unresolved and can trap a pending manual request.

2 open findings

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The previously reported scan/manual-deposit race remains supported by the code and can cause duplicate queuing.

3 open findings

🧠 Review effort: Balanced

Comment thread docs/src/development/design.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Overlapping manual and automatic deposit detection can still trigger a duplicate-deposit assertion.

3 open findings

🧠 Review effort: Balanced

gregorydemay and others added 7 commits October 15, 2026 13:50
… the detected deposits

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ort the first scan as due at the read

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…queues a deposit

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…name

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…counts parameters

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The scan can race with a pending manual deposit call and cause a duplicate-queue assertion.

3 open findings

🧠 Review effort: Balanced

gregorydemay and others added 4 commits October 15, 2026 14:06
…ing its balance read

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e alone

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ee under the new name

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…endpoint

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Mainnet deposit queueing and asynchronous interactions with manual deposits warrant final human validation.

3 open findings
1 resolved since last review

🧠 Review effort: Balanced


#[tokio::test]
async fn should_return_the_deposit_a_scan_queued_during_a_rejected_balance_read_and_charge_the_read_only()
{

This branch has not been deployed

No deployments
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