feat: add liquidity management Loop In and Loop Out - #1643
Draft
quake wants to merge 247 commits into
Draft
Conversation
quake
marked this pull request as draft
September 1, 2026 11:48
Security ReviewResult: 2 confirmed finding(s) Validation:
Notes:
|
Add the liquidity Bruno suites to the E2E workflow as independent jobs:
- e2e-testing matrix gains liquidity/{ckb-loop-out,ckb-loop-in,udt-loop-out,
udt-loop-in,udt-loop-in-rejection,provider-mode} entries. Each matrix job
is a fresh VM, so the dev chain is always provisioned clean (fresh-VM run
stands in for REMOVE_OLD_STATE=y; on a fresh VM the nilpotent
init-dev-chain.sh performs the identical one-time provisioning).
- The rejection matrix entry needs the liquidity-lock-mutator sidecar: the
job prebuilds it (cargo build --locked --manifest-path
tests/liquidity-lock-mutator/Cargo.toml, target dir added to the build
cache paths) and delegates to the suite's own run.sh, which starts the
sidecar with its own PID, exports CKB_MUTATOR_URL, runs Bruno, and stops
the sidecar on exit (no pkill).
- Dedicated e2e-liquidity-refund job: REMOVE_OLD_STATE=y provisioning via
tests/nodes/start.sh, then the refund suite runner (mutator sidecar
lifecycle owned by the runner; chain+nodes assumed running like the
matrix suites).
- Dedicated e2e-liquidity-restart-recovery job: invokes
restart-recovery/run-restart-test.sh directly; the supervisor provisions
the clean dev chain, builds fnn, runs both phases with the provider
restart in between.
- Dedicated e2e-liquidity-existing-state-rerun job: twice-run plan
interpreted pragmatically - instead of running every suite twice, run
ckb-loop-out once from a clean chain (REMOVE_OLD_STATE=y) and once more
against the exact state the first run left behind (same chain and nodes,
no reset), proving suite independence from prior state.
- On failure each job uploads tests/nodes/*.log plus the suite-written
diagnostics (node/CKB snapshots, swap JSON, chain tx JSON) under
tests/artifacts/liquidity/.
Follow-up to the liquidity E2E workflow jobs: actually write the failure diagnostics the artifact upload steps expect under tests/artifacts/liquidity/<suite>/, instead of only uploading tests/nodes logs. - New tests/bruno/scripts/collect-liquidity-failure-diagnostics.sh: best-effort collector that snapshots the CKB tip header plus, per node (client node1 / provider node2, RPC URL conventions 127.0.0.1:21714/21715, env-overridable), the list_swaps response (limit 0x64) and list_liquidity_chain_transactions for at most MAX_CHAIN_TX_SWAPS (default 8) swap ids harvested from that list. The JSON is piped through write-liquidity-diagnostics.sh so sensitive fields are redacted, and lands in tests/artifacts/liquidity/<suite>/failure-<stamp>.json. RPC and parse errors degrade to null sections; the script exits 0 on partial failures and never masks the Bruno exit code. - udt-loop-in-rejection/run.sh and refund/run.sh: on non-zero Bruno exit, invoke the collector (suite-scoped) while preserving the Bruno exit code via set +e capture and an explicit exit. - e2e.yml: new if:failure() 'Collect liquidity failure diagnostics' step for the liquidity matrix entries (suite dir from matrix.workflow basename), so the happy-path and provider-mode entries write diagnostics even though Bruno itself cannot; rerun job wraps each Bruno run with set +e capture, collects diagnostics on failure, and exits with the stored code. - Fix a latent path bug in both runners: repo_root was computed with four parent jumps, but tests/bruno/e2e/liquidity/<suite> sits five levels below the repo root, so the mutator path and the tests/bruno cd were both wrong (tests/tests/...). Use five jumps like restart-recovery's supervisor. Validated with mock JSON-RPC servers: redaction applied, partial-failure and all-endpoints-down runs exit 0 with files written, chain-tx fetches bounded, and both runners preserve the injected Bruno exit code (7) while writing diagnostics, writing nothing on the success path.
quake
force-pushed
the
liquidity-management-m0
branch
from
September 4, 2026 12:20
fe736a8 to
a7eed47
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
Test Plan
tests/deploy/udt-inittests: 3 passedcargo clippy --all-targets --all-features -p fnn -p fiber-bin -- -D warningscargo fmt --all -- --checkmake check-migratemake check-dirty-rpc-docckbbinaryFollow-ups
RefundPendingactor transition remains an M0 limitation and is documented in the refund suite README.Closes #1541