Repository navigation
docs(platform): note that fee version numbers must stay contiguous - #5765
Merged
Merged
Conversation
FeeVersion::get and get_optional resolve a number by its position in FEE_VERSIONS, which is correct only while the registry is numbered 1, 2, 3, ... in order. The registry doc now states that rule, when a schedule needs a new number (a change to the storage, processing, hashing or signature costs the fee history serves), and that new storage rates also need refunds priced at the storage epoch's rate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Caution Review failedThe pull request is closed.
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. |
Contributor
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
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.
Basic explanation
What this does: Adds a comment to the list of fee versions (
FEE_VERSIONS) saying its entries must be numbered 1, 2, 3, ... in order, because the code that finds a fee version by its number simply takes the entry at that position. It also says when a fee schedule needs a new number, and what else must change when storage prices change.Value: Reviewers (people and bots) have flagged the position-based lookup as a bug; #4703 rewrote it, and was closed because the lookup is correct as long as the numbering stays contiguous. Writing the rule down next to the list stops it being flagged again and tells whoever adds the next fee version what to keep true.
Risks: None. Only comments change; no code, behaviour or consensus is touched.
Issue being fixed or feature implemented
FeeVersion::getandFeeVersion::get_optionalreturnFEE_VERSIONS[n - 1]for fee version numbern. That is the entry numberednonly while the registry is contiguous from 1, which nothing documented, so the lookup kept being reported as a bug. #4703 replaced it with a lookup by carried number; it was closed because the registry holds onlyFEE_VERSION1, so the rewrite changes nothing.What was done?
packages/rs-platform-version/src/version/fee/mod.rs, comments only:FEE_VERSIONS: entries are numbered contiguously from 1 (indexicarries numberi + 1), andget/get_optionalrely on it, so a new entry is appended with the next number. A new number is needed only when a value the fee history serves changes (storage, processing, hashing or signature costs), because saved state keeps only the number and reloads the registered entry; that is whyFEE_VERSION2toFEE_VERSION4carry 1 and are not listed. Registering different storage rates also needs refunds priced at the rate active when the bytes were stored, whichcalculate_feegeneration 0 does not do; fix(platform): resolve fee versions by registered number and price refunds at the storage epoch rate #4703 has a version of that rule.getandget_optional: one line each pointing at that rule.How Has This Been Tested?
Comment-only change.
cargo fmt --all,cargo clippy -p platform-version --all-targets --all-features -- --no-deps -D warningsandcargo test -p platform-version --all-features fee::pass.cargo doc -p platform-versionresolves the new intra-doc links (its only error is an existing broken link indpp_validation_versions).Breaking Changes
None.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
e8c3e45/skip-botsproceeds without the ones not yet reported/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.