Skip to content

feat: withdrawal batcher#392

Draft
vertex451 wants to merge 5 commits into
mainfrom
artem/batching
Draft

feat: withdrawal batcher#392
vertex451 wants to merge 5 commits into
mainfrom
artem/batching

Conversation

@vertex451
Copy link
Copy Markdown
Contributor

@vertex451 vertex451 commented Apr 22, 2026

Must be merged after akash-network/chain-sdk#292

Changes

  • Added withdrawal batcher that collects withdraw messages in case of pending tx in one batch.
  • Added WithPriority option to MsgCreateBid and MsgCloseBid

Other callers to batch

MsgCreateBid is not suitable for batching, because failure for one bid will cancel other bids.  Same for MsgCloseBid.
No other Msgs in the provider found.

Testing

I run a provider with:

    --lease-funds-monitor-interval=1m \
    --withdrawal-period=1m \
    --withdrawal-batch-max-msgs=5

And created a 10 leases.

After that I stopped a provider for one minute and run it again. Observations:

  1. Pending queue goes 0→1→...→9→4→0 as expected. Zero at beginning, then first tx goes in and fires immediately, while in flight, other leases are scheduled to withdrawal, which bumps pending to 9. When tx is finished, next batch is collected, pending tx are reduced by withdrawal-batch-max-msgs (5).
  2. Meanwhile, I run a script that created a new deployment every block, and from the logs I can confirm that priority queue is flushed before the default queue. The only case when priority queue is waiting - when the default queue tx is in progress.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c9964711-7d04-432e-ad5d-79d0309618a0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch artem/batching

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread balance_checker.go
return resp
}

func (bc *balanceChecker) startWithdraw(ctx context.Context, lid mtypes.LeaseID) error {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was moved to the withdrawal_batcher.go

Comment thread withdraw_batcher_test.go Outdated
Comment thread withdraw_batcher.go Outdated
Comment thread withdraw_batcher.go Outdated
Comment thread withdraw_batcher.go Outdated
Comment thread withdraw_batcher.go Outdated
Comment thread cmd/provider-services/cmd/run.go Outdated
Comment thread cmd/provider-services/cmd/run.go
Comment thread withdraw_batcher.go Outdated
@vertex451 vertex451 requested a review from cloud-j-luna April 24, 2026 14:03
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