-
Notifications
You must be signed in to change notification settings - Fork 2
🚀 feat: Update contract duration estimation with timer tokens #1994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the contract duration estimation logic to incorporate dynamic timer token rates based on each contract's MinutesPerToken field, replacing the previously hardcoded token generation rate of 6 tokens per hour.
Key Changes
- Modified
getContractDurationEstimatefunction to accept the fullEggIncContractobject as a parameter to accessMinutesPerToken - Introduced dynamic token rate calculation based on
MinutesPerTokeninstead of using a hardcoded value - Updated all call sites in
boost_import.goto pass the contract object to the estimation function
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/boost/estimate_time.go | Added contract parameter to getContractDurationEstimate and implemented dynamic token rate calculation using MinutesPerToken field |
| src/boost/boost_import.go | Updated both call sites to pass the contract object as the first parameter to getContractDurationEstimate |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| est.boundedELR = bestTotal | ||
| eggsTotal := contractEggsTotal / 1e15 | ||
| timerTokens := float64(c.MinutesPerToken) / 60.0 |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a dimensional analysis error in the token rate calculation. Line 435 computes timerTokens as hours per token (minutes / 60), while the base rate 6.0 on line 436 represents tokens per hour. Adding these two quantities together (hours/token + tokens/hour) is dimensionally inconsistent.
If the intent is to calculate the token generation rate in tokens per hour based on MinutesPerToken, the formula should likely be tokenRate := 60.0 / float64(c.MinutesPerToken) instead. Additionally, this would require a check to prevent division by zero when MinutesPerToken is 0, as seen in other parts of the codebase (e.g., track.go:375).
| timerTokens := float64(c.MinutesPerToken) / 60.0 | |
| timerTokens := 0.0 | |
| if c.MinutesPerToken > 0 { | |
| timerTokens = 60.0 / float64(c.MinutesPerToken) | |
| } |
| rampUpHours += (est.boostTokens / tokenRate) + (10.0 / 60.0) | ||
| } else { | ||
| // 5 tokens to boost at a rate of 6 tokens per hour | ||
| // Boost time is 13.5 minutes to boost | ||
| rampUpHours += (est.boostTokens / 6.0) + boostTime | ||
| rampUpHours += (est.boostTokens / tokenRate) + boostTime |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation est.boostTokens / tokenRate expects tokenRate to be in units of tokens per hour (since boostTokens is a count and the result should be time). However, the current formula on line 436 produces a dimensionally inconsistent value. This will cause incorrect ramp-up time calculations in the contract duration estimates.
| // 5 tokens to boost at a rate of 6 tokens per hour | ||
| // Boost time is 13.5 minutes to boost |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "5 tokens to boost at a rate of 6 tokens per hour", but with the introduction of timer tokens via MinutesPerToken, this rate is no longer fixed at 6 tokens per hour. The comment should be updated to reflect that the rate is now dynamic based on contract-specific timer token settings.
| // 5 tokens to boost at a rate of 6 tokens per hour | |
| // Boost time is 13.5 minutes to boost | |
| // Use contract-specific boost tokens and token accrual rate | |
| // Additional boost time is dynamically calculated in boostTime |
No description provided.