feat(functional-tests): add OL mock deposit+withdrawal test (STR-2020)#1377
feat(functional-tests): add OL mock deposit+withdrawal test (STR-2020)#1377
Conversation
0e9d30d to
3384e39
Compare
|
Commit: ce401ff SP1 Execution Results
|
bewakes
left a comment
There was a problem hiding this comment.
Awesome work on tests and utils!
A small concern on the requirement of new ol_isolated environment.
| strata.wait_for_additional_blocks(2, rpc, timeout_per_block=15) | ||
|
|
||
| # Step 8: Verify final balance | ||
| final_balance = get_account_balance(rpc, account_id_hex) |
There was a problem hiding this comment.
I think this test should be failing.
Ref:
#1383 (comment)
There was a problem hiding this comment.
the test passes because the mock intentionally bypasses bridge-v1 because of Debug subprotocol but i agree the type ID mismatch between DepositLog and DepositIntentLogData needs to be resolved. and I think that's a separate issue from the test itself.
If OL should match on DEPOSIT_LOG_TYPE_ID and process DepositLog, then we can rewrite this test to match the canonical type we end up choosing.
There was a problem hiding this comment.
oh no! yeah we should resolve this, maybe in this PR? both sides should use the same basic type instead of having two separate defs of it
27da6c9 to
bee19e7
Compare
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1377 +/- ##
===========================================
- Coverage 75.24% 64.97% -10.27%
===========================================
Files 800 802 +2
Lines 74882 75055 +173
===========================================
- Hits 56342 48769 -7573
- Misses 18540 26286 +7746
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 240 files with indirect coverage changes 🚀 New features to boost your workflow:
|
delbonis
left a comment
There was a problem hiding this comment.
Tests look pretty good, happy to see this coming together. Eventually I'd like to see us be able to remove Reth from our test setup here. Just one main note.
| strata.wait_for_additional_blocks(2, rpc, timeout_per_block=15) | ||
|
|
||
| # Step 8: Verify final balance | ||
| final_balance = get_account_balance(rpc, account_id_hex) |
There was a problem hiding this comment.
oh no! yeah we should resolve this, maybe in this PR? both sides should use the same basic type instead of having two separate defs of it
b496762 to
111eb91
Compare
Add a `debug-asm` feature that conditionally switches the ASM worker from `StrataAsmSpec` to `DebugAsmSpec`, enabling the debug subprotocol (ID 255) which can inject arbitrary ASM logs via Bitcoin transactions. - Add `DebugAsmSpec::from_params()` constructor mirroring StrataAsmSpec - Add conditional compilation in asm-worker state.rs via cfg(feature) - Propagate feature from bin/strata through strata-asm-worker This is needed for functional tests that inject deposits via the MockAsmLog mechanism without a real EE.
…awal Add two new commands for testing the OL without a real EE: create-mock-deposit: Builds a Bitcoin tx that injects a DepositIntentLogData (type 100) into the ASM via the debug subprotocol's MockAsmLog mechanism. Broadcasts via bitcoind RPC. build-snark-withdrawal: Constructs a complete RpcOLTransaction JSON blob containing an SSZ-encoded SnarkAccountUpdate with a withdrawal OutputMessage. Pure computation, no network calls. These replace the previous Python encoding utilities (SSZ, strata-codec, msg-fmt) with authoritative Rust implementations, eliminating encoding parity bugs.
…a-test-cli Add end-to-end test that deposits funds into a snark account via the debug subprotocol and withdraws them, all without a real EE. Test flow: inject deposit via Bitcoin tx (MockAsmLog), wait for terminal block to process L1 manifest, verify balance, submit withdrawal via RPC, verify balance deduction. - Add common/test_cli.py wrapper for strata-test-cli subprocess calls - Add EpochSealingConfig (slots_per_epoch=5 for fast terminal blocks) - Fetch real GenesisL1View from bitcoind (target, timestamps) - Pre-fund BDK wallet in ol_isolated env setup - Query balance via getChainStatus + getBlocksSummaries - Use account serial 128 (first user serial; 0-127 are system-reserved)
- Add subprocess timeout (60s) to strata-test-cli wrapper to prevent test hangs if the CLI binary stalls - Improve subprocess error handling in OLIsolatedEnvConfig with descriptive error messages for BDK address retrieval failures - Mine 8 blocks instead of 6 for deposit maturation to provide safety margin above l1_follow_distance=6 - Remove unused OL_ISOLATED_DEFAULT instance
…onfig Address review feedback: - Remove separate OLIsolatedEnvConfig; add genesis_accounts, epoch_sealing, and fund_test_cli_wallet params to StrataEnvConfig - Derive block wait count from slots_per_epoch instead of hardcoding 10 - Store slots_per_epoch in strata service props for test access
Run cargo fmt and minimal workspace lockfile update (not full regeneration) to avoid pulling incompatible dependency versions.
The OL STF was matching on DepositIntentLogData (TY=100), a placeholder type that bridge-v1 never emits. Bridge-v1 emits DepositLog (TY=1), meaning real deposits would be silently ignored by the new OL STF. Unify on DepositLog (TY=1) as the canonical deposit log type: - OL STF now decodes DepositDescriptor from DepositLog payloads - Mock deposit tooling (strata-test-cli) emits DepositLog - Remove DepositIntentLogData and DEPOSIT_INTENT_ASM_LOG_TYPE_ID
- Remove unused strata-asm-manifest-types dep from ol-stf Cargo.toml - Add selected_operator param to WithdrawalMsgData::new call
…-switched Move the ASM spec selection out of the worker crate into the caller. AsmWorkerServiceState, AsmWorkerService, and AsmWorkerBuilder are now generic over S: AsmSpec, and the caller constructs and passes in the concrete spec. The debug-asm feature flag moves from strata-asm-worker to strata-consensus-logic, where the spec is constructed. The worker crate no longer depends on either spec implementation crate.
- Add GenesisAccountData and OLParams dataclasses to params.py - Export them from common.config.__init__ - Wire OLParams into strata factory: write custom ol-params.json when provided instead of always generating via datatool - Fix type mismatch: pass genesis_l1.blk.height (int) to factory instead of GenesisL1View object - Refactor let-chains syntax in deposit_withdrawal.rs (requires Rust edition 2024, not available in project toolchain) - Run cargo fmt on deposit.rs, service.rs, deposit_withdrawal.rs - Run ruff format on params.py, test_mock_withdrawal.py
1cef449 to
ac13022
Compare
- Add `from err` to re-raise in except block (ruff B904) - Remove unused `asdict` import (ruff F401) - Update dbtool tests: epoch_slots=4 -> epoch_sealing=EpochSealingConfig.new_fixed_slot(4) to match StrataEnvConfig API change
ac13022 to
1f6423d
Compare
bewakes
left a comment
There was a problem hiding this comment.
The func tests are failing. The rest LGTM.
Description
Add an end-to-end functional test that verifies deposit and withdrawal flows through the OL without a real EE, using the debug subprotocol to inject mock deposits via Bitcoin transactions.
What this PR does
Rust changes:
debug-asmfeature flag that conditionally switches ASM worker fromStrataAsmSpectoDebugAsmSpec, enabling the debug subprotocol (ID 255)create-mock-depositCLI command tostrata-test-cli— builds a Bitcoin tx with SPS-50 tagged OP_RETURN that injectsDepositIntentLogDatavia the debug subprotocol's MockAsmLog mechanismbuild-snark-withdrawalCLI command — constructsRpcOLTransactionJSON with SSZ-encodedSnarkAccountUpdatecontaining a withdrawalOutputMessagePython test framework changes:
OLIsolatedEnvConfig— starts Bitcoin + Strata (OL only, no EE) with configurable genesis snark accountscommon/test_cli.py— subprocess wrapper forstrata-test-clicommandsEpochSealingConfigsupport (slots_per_epoch=5 for fast terminal blocks in tests)GenesisL1Viewfrom bitcoind (target, timestamps) instead of hardcoded valuesTest flow (
test_mock_withdrawal):create-mock-deposit(debug subprotocol)build-snark-withdrawal+strata_submitTransactionType of Change
Notes to Reviewers
The
debug-asmfeature is only enabled during functional tests (run_tests.shpasses-F debug-asm). Production builds are unaffected.The two new
strata-test-clicommands replace previous Python encoding utilities (SSZ, strata-codec) with authoritative Rust implementations, eliminating encoding parity bugs.Is this PR addressing any specification, design doc or external reference document?
STR-2020
Checklist
AI Assistance Notice
AI was used to assist with code review, test hardening fixes, and writing this PR description.
Related Issues
STR-2020