docs(fee): document effective base-fee floor vs minBaseFee - #372
docs(fee): document effective base-fee floor vs minBaseFee#372kutluhaneth46 wants to merge 3 commits into
Conversation
Pin the empty-block truncation floor (kRate=1250 → 7 wei) with a unit test and record the max(minBaseFee, 10000/kRate) interaction in ADR-0004. Leaves ProtocolConfig requires alone so historical testnet genesis still regenerates. Addresses circlefin#367.
Tighten ADR-0004 wording and the unit test per review on circlefin#367: the truncation threshold is 10000/kRate, but the fee rests one wei below it. Pin the early-testnet (8→7, 7→7) boundary vectors explicitly.
|
Thanks @osr21 for the formula correction on #367 — you're right that `10000/kRate` is the truncation threshold, not the resting value. Updated ADR-0004 to `ceil(10000/kRate) - 1` (1250 → 7, 200 → 49) and reshaped the unit test to assert the `8 → 7` / `7 → 7` boundary property with the early-testnet parameter triple pinned, rather than only a long empty-block run. |
Fix cargo fmt --check failure on the assert_eq! line length.
|
Reviewed #372 since that's where the correction landed. The formula and the test are right — I replayed them rather than eyeballing. One inconsistency in the ADR prose is worth fixing before merge, because it will read as a contradiction to anyone who checks the committed config. VerifiedI re-derived All four assertions hold, and the 2,000-iteration budget has ~13x headroom over the 145 steps actually needed. The ADR formula block is correct, including the threshold-vs-resting distinction and The ADR example contradicts the committed config
The
A reader who follows the ADR to the committed file will compute 399, get a mismatch, and conclude the paragraph is wrong. Naming the value fixes it — something like "early testnet ran Why 1250 is a principled choice for the testWorth saying in the test comment, because it currently reads as an arbitrary constant: One boundary worth adding
The domain caveat you wrote ("at production-scale gas limits") is doing real work, incidentally — the closed form loses a wei at degenerate gas targets, e.g. NitThe ADR hunk adds a stray blank line inside the pseudocode block, just above Agreed on leaving the Disclosure: I'm an external community contributor, not affiliated with Circle, with no write access to this repository. Advisory review only, not an approval — the numbers above come from a standalone replay validated against the crate's own test vectors, and should be confirmed with a real |
Summary
max(minBaseFee, 10000/kRate)in ADR-0004 (decrease-path integer truncation).assets/testnet/config.jsonfee params are historical vs live testnet.kRate=1250resting at 7 wei.Deliberately does not add a
ProtocolConfigrequire(minBaseFee * kRate >= 10000)— that would break regenerating historical testnet genesis (kRate: 25,minBaseFee: 1). Happy to follow up if maintainers want that guard only onupdateFeeParams.Addresses #367.
Test plan
arc_calc_next_block_base_feematches issue Fee curve: effective base-fee floor is max(minBaseFee, 10000/kRate); testnet ran 6M blocks at 7 wei against a declared floor of 1 #367 table (block 1/2/5/10/100/1000 → 7)cargo test -p arc-execution-config empty_blocks_rest_at_truncation_floor