slipstream: take txs from anyone, mine them without relaying - #83
Draft
rsantacroce wants to merge 1 commit into
Draft
rsantacroce wants to merge 1 commit into
rsantacroce wants to merge 1 commit into
Conversation
A new service, slipstream/, alongside payout/. It takes a raw tx over HTTP and hands it straight to the enforcer's block template server -- the one the proxy mines from -- which keeps it in its template mempool and never relays it (LayerTwo-Labs/bip300301_enforcer#642). That is how the pool mines BIP300/301 txs the network will not carry, or any other consensus-valid tx. The fee rule is Slipstream's: the higher of a floor (1 sat/vB) and the current mineable rate, read off the template being mined. A tx that pays less is taken back out of the enforcer before the refusal returns. Every submission is kept, refused ones included, and each accepted tx is followed from template to block: pending, in_template, mined, confirmed, or dropped/expired with a reason. The enforcer forgets a tx on restart or reorg; this side remembers, so it resubmits. It keeps its own slipstream.db and only reads shares.db, for pool_meta and blocks_found. info.json is served here: facts from pool_meta, with mode the exact pool_mode, presentation from env. tests/test_slipstream_regtest.sh runs it against a real enforcer built with --enable-slipstream. It is not in CI until an enforcer release ships the flag; the unit tests are.
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.
What
This adds a new service,
slipstream/, alongsidepayout/. Anyone can POST it a raw tx, and it gets that tx into the pool's blocks without relaying it. It is meant for BIP300/301 txs the network will not relay (deposits, withdrawal bundles, BMM requests), but it takes any consensus-valid tx.Each tx goes straight to the enforcer's block template server, which is the same
:8122endpoint the proxy mines from. The enforcer has the node check the tx for consensus validity, applies its own BIP300 rules, and keeps it in its template mempool. The tx never enters the node's mempool.Depends on:
--enable-slipstreamflag.Neither needs a change to the proxy.
How it behaves
SLIPSTREAM_MIN_FEE_RATE) and the current mineable rate. This follows Slipstream's own rule.slipstream_submissionskeeps every POST exactly as it arrived, including refusals and their reasons.pending,in_template,minedandconfirmed.dropped(with a reason such asconflict_minedorparent_removed) orexpired(after 144 blocks by default).mined_by_poolis taken fromblocks_found.slipstream_events.GET /info.json.pool_meta:mode(the exactpool_mode),fee_bps,coinbase_tagand the addresses. They are never configured here.POOL_NAME,POOL_CHAIN(e.g.betanet),POOL_LOGO, the public URLs and so on.slipstream_urlis included.Storage
The service keeps its own
slipstream.db. It never writes toshares.db, and reads it only forpool_metaandblocks_found.Also in this PR
Dockerfile.slipstream, aslipstreamcompose service bound to loopback (publish it through nginx withSLIPSTREAM_TRUST_PROXY=1), and the image in the GHCR build matrix.node-testsjob.scripts/regtest/start.sh: a newREGTEST_ENFORCER_EXTRA_ARGSvariable, empty by default, so every existing test starts the enforcer exactly as before.slipstream/README.md, plus short entries in the README andtests/README.md.Testing
cd slipstream && npm test: 24 unit tests against a fake enforcer and bitcoind. They cover every status transition, the fee rule, submission logging, info.json for every mode, and the HTTP routes, including CORS and the rate limit.tests/test_slipstream_regtest.sh, against patched bitcoind and an enforcer built from #642. Passed locally:testmempoolacceptsays no) is accepted, and never enters the node's mempool.in_template.generateblockmines exactly that template. The service follows the tx tominedin that block, thenconfirmed. Its history readsaccepted, in_template, mined, confirmed.fee-rate-too-lowand is no longer in the enforcer's template./api/feesanswer.This script needs
SLIPSTREAM_ENFORCER_BINuntil an enforcer release ships--enable-slipstream, so it is not in CI yet.Not in this PR
/slipstreampage and the admin withdraw button. That is PR 4.