test: assert storage creation-fee burn through the e2e path#460
Merged
adamkrellenstein merged 1 commit intoJun 3, 2026
Merged
Conversation
The storage tests asserted the creation fee υ_f was *charged* (fee > 0) but not that it was actually *burned from total supply* through the execution path. Added a supply-conservation assertion to filestorage_create_and_get: total supply strictly decreases across create_agreement, by at least the returned fee (the remainder is gas, also burned). filestorage_create_and_get runs in both modes, so this is verified in-process by the _local variant and end-to-end — mined Bitcoin block → indexer → contract → asserted supply change — by the regtest variant in CI. Closes part of the economic-e2e gap: an economic state transition asserted through block processing, not just an in-process property loop. Required adding a token import! to the module to read total_supply.
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.
Stacked on #441 (
feat/storage-economics). Closes part of the economic-e2e gap surfaced by the test-strategy audit: no test asserted an economic state transition through block processing.What
filestorage_create_and_getpreviously asserted the storage creation fee υ_f was charged (fee > 0) but not that it was actually burned from total supply. This adds a supply-conservation assertion aroundcreate_agreement:created.fee(the remainder is gas, also burned).filestorage_create_and_getis part of the dual-modetest_file_storage_regtestbody, so the assertion runs:_localvariant (verified locally), andThat's the missing leg: an economic state transition asserted through real block processing, not just an in-process property loop.
Design decisions
>= fee, not== fee. The supply drop isfee + gas(gas is also burned), so an exact-equality assertion is wrong; the robust invariant is strict decrease plus drop ≥ fee. Confirmed empirically (the exact form failed by exactly the gas amount).filestorage_create_and_getalready uses a real PoR descriptor that passes in both lite and regtest modes, avoiding the trivial-root rejection that a freshmake_descriptorwould hit under regtest.tokenimport!to the module to readtotal_supply(mirrorsstaking_contract.rs).Scope note
The deeper economic-e2e paths — ordering-reward accrual and challenge-failure → slash through block processing — remain blocked on the reactor↔economics wiring (#442) and are out of scope here. This PR covers the user-driven path (creation-fee burn) that is drivable end-to-end today.
Merge order
Touches
native_filestorage_contract.rs, which #456 and #452 also modify. Merge after #441; coordinate with #452 (impl) / #456 (property tests) — additive changes, rebase whichever merges last.🤖 Generated with Claude Code
Note
Low Risk
Test-only changes to contract integration tests; no production logic or auth paths modified.
Overview
Extends
filestorage_create_and_getso storage agreement creation is checked against token total supply, not only thatcreated.fee > 0. The test now snapshots supply before/aftercreate_agreement, asserts supply strictly decreases, and that the drop is at least the creation fee υ_f (allowing additional burn from gas).A
tokenWITimport!is added so the test can calltoken::total_supply. Because this helper runs underrun_regtest/test_file_storage_regtest, the same assertions apply in-process and on the regtest path (mined block → indexer → contract).Reviewed by Cursor Bugbot for commit e99dfcc. Bugbot is set up for automated code reviews on this repo. Configure here.