Skip to content

store: bound what a reject flood can write, and never drop a found block - #107

Open
asilgulsar1 wants to merge 1 commit into
LayerTwo-Labs:mainfrom
asilgulsar1:reject-flood
Open

asilgulsar1 wants to merge 1 commit into
LayerTwo-Labs:mainfrom
asilgulsar1:reject-flood

Conversation

@asilgulsar1

Copy link
Copy Markdown

We run simplepool in solo mode for eCash.com (ECX, BIP300/301) behind the CUSF enforcer. These came out of a review of the solo path before we rely on it.

A reject costs the sender no work: authorize with any valid address, then submit bogus job ids at up to max_submits_per_sec per connection. Each one wrote a rejects row, and nothing deletes them. The flood also filled the event ring that block events share, so store_record_block could fail and a found block's blocks_found row was lost.

  • rejects_max_per_sec (default 0 = no limit) caps reject rows written per second, pool-wide.
  • Rejects stop at three quarters of the ring, leaving room for shares and blocks.
  • store_record_block waits up to 30 s for room instead of dropping the block's row.

Test: test_rejects_rate_limited.

Tested: make test passes on this branch alone, and the new test fails on main without the fix. This PR is independent of the five others opened alongside it, and all six merge together cleanly. Happy to add a CHANGELOG entry if you'd like one.

🤖 Generated with Claude Code

A reject costs the sender no work: authorize with any valid address, then
submit bogus job ids at up to max_submits_per_sec per connection. Each wrote a
rejects row (nothing deletes them), and the flood filled the event ring that
block events share, so store_record_block could fail and a found block's
blocks_found row was lost.

- rejects_max_per_sec (default 0 = no limit): reject rows written per
  second, pool-wide.
- Rejects stop at three quarters of the ring, leaving room for shares and
  blocks.
- store_record_block waits (up to 30 s) for room instead of dropping the
  block's row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

1 participant