Skip to content

feat: accept slipstream txs on the block template server - #642

Draft
rsantacroce wants to merge 1 commit into
masterfrom
feat/slipstream
Draft

rsantacroce wants to merge 1 commit into
masterfrom
feat/slipstream

Conversation

@rsantacroce

Copy link
Copy Markdown
Contributor

What

Adds --enable-slipstream, which requires --enable-block-template-server. It turns on slipstream from LayerTwo-Labs/cusf-enforcer-mempool#130.

With it on, submitslipstreamtx on --serve-rpc-addr adds a tx straight to the template mempool. The tx is never relayed and never handed to the node's mempool. It then competes for inclusion in served templates by fee rate. The companion RPCs are getslipstreamtx, listslipstreamtxs and removeslipstreamtx. See #130 for how the mempool keeps these txs valid through conflicts, evictions and reorgs.

Why

A pool running the enforcer can then mine BIP300/301 txs the network will not relay (deposits, withdrawal bundles, BMM requests), or any other consensus-valid tx, without the enforcer's wallet broadcasting them. The first user is simplepool's slipstream service.

Rules still apply

Before accepting a tx, the node checks it for consensus validity with a block proposal. The enforcer's own accept_tx then runs as usual, so a deposit that skips the sidechain's CTIP is refused (rejected-by-enforcer) even though the node would accept it.

Changes

  • lib/cli.rs: adds --enable-slipstream. Its help text warns that the template server has no authentication.
  • app/main.rs: GbtSlot implements RpcServer itself, so it delegates the four new methods. Until the mempool is synced they return the same -10 error as getblocktemplate. build_block_template_server calls Server::with_slipstream when the flag is set.
  • Cargo.toml: the cusf-enforcer-mempool dependency points at the dev: add signet mining deps to docker image #130 branch on a fork. It must go back to LayerTwo-Labs/cusf-enforcer-mempool once dev: add signet mining deps to docker image #130 merges, which is why this is a draft.
    • The bump also brings in the mempool commits since 185e439: proposal mode, block-connect/disconnect rejection fixes, and the ZMQ sequence fix. No other code changes were needed for them.

Testing

  • New integration test slipstream_deposit (regtest, GetBlockTemplate mode, --enable-slipstream):
    • A hand-built first deposit is submitted with submitslipstreamtx. It reaches the block template, never enters the node's mempool, is mined, and becomes the sidechain's CTIP. getslipstreamtx reports it as mined.
    • A second deposit that does not spend the CTIP is refused as rejected-by-enforcer.
    • The same deposit, spending the CTIP, is accepted, mined, and becomes the new CTIP holding both deposits.
  • The full integration suite passes locally on macOS arm64 with bitcoin-patched-latest: 41 passed, 0 failed.
  • cargo +nightly fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings are clean. Unit tests pass.

`--enable-slipstream` (requires `--enable-block-template-server`) turns on
cusf-enforcer-mempool's slipstream: `submitslipstreamtx` adds a tx straight
to the template mempool, without relaying it or handing it to the node's
mempool. The node checks it for consensus validity first, and the
enforcer's own `accept_tx` still applies, so a BIP300 deposit that skips
the sidechain's CTIP is refused even though the node would take it.

This is what lets a pool mine BIP300/301 txs the network will not relay,
without the enforcer's wallet broadcasting them.

`GbtSlot` implements `RpcServer` itself, so it delegates the four new
methods, and answers them like `getblocktemplate` until the mempool is
synced.

The mempool dependency points at the slipstream branch until
LayerTwo-Labs/cusf-enforcer-mempool#130 is merged.
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