chore: charge the taxonomy write fee per child stream - #1411
Merged
Conversation
Time Submission Status
Submit or update total time with: Add time on top of previous submission with: See available commands to help comply with our Guidelines. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
Author
|
@holdex pr submit-time 4h |
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.
resolves: https://github.com/truflation/website/issues/3972
What changes
insert_taxonomy(004) now charges 10 TRUF per child stream instead of a flat 1 TRUF per transaction. Per-transaction pricing let one caller attach an arbitrary number of children for the price of one, so the cost of a taxonomy no longer tracks what it actually adds — each child is a permanenttaxonomiesrow that every composed read walks.This restores the multiplier shape that
create_streams(001) already uses for its per-stream fee, at the 10 TRUF figure agreed on the issue. The literal is quoted because 10^19 exceeds int64 — the same reason001quotes its 10^20.The insufficient-balance message changes from
Required: 1 TRUFtoRequired: 10 TRUF per child stream, matching001'sRequired: 100 TRUF per stream.The dev
*.sqlsource was edited and the mainnet override regenerated withscripts/generate_prod_migrations.py(hoodi_tt→eth_truf); the other 13 generator targets regenerate byte-identically, so only004-composed-taxonomy.prod.sqlchanges. Both files passkwil-cli utils parse.No cap on
$num_childrenis added. Pricing bounds the abuse on its own —max_req_sizealready caps a transaction near 40,000 children, which is 400,000 TRUF at this rate — and picking a cap value would reject legitimate large taxonomies with no migration path.Tests
feefund.TaxonomyFeePerChildWeiis the single source of the fee for the test tree, and every expectation derives from it, so the migration and the tests cannot drift apart.taxonomy_fee_test.go: all five existing cases re-costed;testTaxonomyMultipleChildrenChargesFlatFeebecomes...ChargesPerChildFeeand now funds exactly100 + 300 + 30so a regression back to a flat fee leaves 29 TRUF and fails.testTaxonomyPartialBalanceRejectsExtraChild: a wallet holding exactly one child's fee attaches two children. This is the rejection path with a non-zero balance, which the existing insufficient-balance case (which drains to zero) does not exercise, and it asserts the rejected call left the balance untouched.transaction_events_ledger_test.go: thesetTaxonomiesledger row and its fee distribution now assert 10 TRUF for a 1-child taxonomy.utils/procedure/execute.go:SetTaxonomy— the shared helper ~40 tests fund through — now credits N × per-child instead of a flat 1 TRUF.Suites run and passing:
TestTaxonomyFees, the three transaction-ledger suites, the composed/taxonomy consumers (TestComposed,TestTaxonomyQueryActions,TestMultiLevelComposedStreams,TestGamefiIndex,TestTruflationComposedFrozen,TestComprehensivePathIndependenceWithSharedPrimitive), plus the fullaggregationandauthpackages.Rollout notes (consensus-critical)
004-composed-taxonomy.prod.sqlviakwil-cli exec-sql(aftererc20-bridge/000-extension.prod.sql, soeth_trufexists). It is aCREATE OR REPLACE ACTIONon that one action — no fleet upgrade, no restart.setTaxonomiesevents in total, 3 of them fee-bearing, and the largest taxonomy group is 30 children — so the worst single call becomes 300 TRUF. No refill-bot threshold needs changing.insert_taxonomyhas no internal on-chain callers and no SDK hardcodes the fee, so only external data providers setting taxonomies are affected.Summary by CodeRabbit