Repository navigation
fix(usdfc): keep MockUSDFC distribution within the 1M supply - #241
Closed
OzzyHelper wants to merge 1 commit into
Closed
OzzyHelper wants to merge 1 commit into
OzzyHelper wants to merge 1 commit into
Conversation
Startup funding granted 100k tokens to each of the three users and 200k to every active PDP SP. With four or more SPs the schedule asked the deployer to transfer up to 1.3M tokens from a 1M supply, so the last transfers failed with an insufficient balance. Derive the per-SP grant from the remaining supply instead: three users keep their 100k each, SPs share what is left up to the nominal 200k. The default two-SP topology is unchanged; four SPs get 175k and the maximum five get 140k, so the plan always fits. Also: - plan balance checks, transfers, and verification from one function so they cannot drift apart - drop the duplicated supply constant from usdfc_deploy_step and pass INITIAL_SUPPLY explicitly to the forge script from the shared constant - reject configurations in Config::validate that cannot fund the allocations
Collaborator
|
Not important enough for this. |
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.
What
Keep the MockUSDFC startup distribution within the token's 1,000,000-token initial supply.
Why
Funding granted 100k tokens to each of 3 users and 200k to every active PDP SP. With 4 or 5 active SPs (MAX_PDP_SP_COUNT is 5) the schedule tried to move up to 1.3M tokens from a 1M balance, so the final transfers failed with an insufficient balance. The default two-SP topology happened to fit (700k), which hid the bug.
How
distribution_plan()drives balance checks, transfers, and post-transfer verification, so the three previously-duplicated schedules cannot drift apart.usdfc_deploy_step; deployments now passINITIAL_SUPPLYexplicitly to the forge script fromconstants::MOCK_USDFC_INITIAL_SUPPLY, so the Rust allocation budget and the deployed token agree by construction.Config::validate()now rejects topologies that cannot fund users/SPs from the supply.Testing
cargo test --all-targets --all-features -- --skip test_print_running_status --skip test_print_uptime: 63 passed.dockeris not installed; verified they fail identically on unmodifiedmain.cargo clippy --all-targets --all-features -- -D warningsand./scripts/lint.sh(FIX=0) pass.Quality Report
Changes: 6 files changed, 272 insertions(+), 60 deletions(-)
Code scan: clean
Tests: skipped
Branch hygiene: 1 issue(s)