feat: process pending signatures queue and accept automatic deposits#176
Draft
lpahlavi wants to merge 3 commits intolpahlavi/unify-accepted-deposit-eventfrom
Draft
feat: process pending signatures queue and accept automatic deposits#176lpahlavi wants to merge 3 commits intolpahlavi/unify-accepted-deposit-eventfrom
lpahlavi wants to merge 3 commits intolpahlavi/unify-accepted-deposit-eventfrom
Conversation
4 tasks
7476c0a to
18d4ecf
Compare
- Change `monitored_accounts` from `BTreeSet` to `InsertionOrderedMap` to preserve insertion order for fair round-robin polling in a future PR - Add module-level `PENDING_SIGNATURES` thread-local to buffer discovered transaction signatures per account - Fill in `poll_account`'s signature arm: filter out failed transactions and push successful signatures into the queue - Expose `pending_signatures_for` / `reset_pending_signatures` test helpers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Squashed from lpahlavi/defi-2780-extract-deposit-validation: - Add `fetch_and_validate_deposit` shared helper to `deposit/mod.rs` - Extract `GET_TRANSACTION_CYCLES` constant (50 B cycles) - Remove `cycles_to_attach` parameter from `get_transaction` — it now uses the constant internally - Refactor `try_accept_deposit` to delegate to `fetch_and_validate_deposit` - Fix `Burn(#[n(0)])` → `Burn(#[n(1)])` in `Memo` cbor annotation Note: the `meta.err` / `TransactionFailed` removal from #174 was NOT cherry-picked; that is a bug in #174 that should be fixed separately. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22337fd to
c03a2cc
Compare
For each monitored account, pops signatures from the pending queue, calls
getTransaction, and emits AcceptedDeposit { source: Automatic } for valid
deposits. Invalid or already-processed signatures are silently discarded.
Reschedules immediately if more signatures remain after a round.
Adds an integration test verifying the end-to-end flow from update_balance
through poll and signature processing to AcceptedDeposit event emission.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c03a2cc to
691066e
Compare
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
process_pending_signaturestimer function: iterates thePENDING_SIGNATURESqueue in round-robin order, pops one signature per account per round, validates each viafetch_and_validate_deposit, emitsAcceptedDeposit { source: Automatic }on success, silently discards invalid signatures, and reschedules itself atDuration::ZEROif more remainTaskType::ProcessPendingSignaturesto the task setdeposit_statusis alreadySome(_)to avoid double-processingPROCESS_PENDING_SIGNATURES_DELAYtimer inmain.rsupdate_balance→ poll → signature processing →AcceptedDepositevent flowStack
This PR stacks on top of:
AcceptedDepositevent #179 — add source field toAcceptedDepositevent (rebased on)Test plan
cargo test -p cksol_minter --lib— all tests pass🤖 Generated with Claude Code