Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix linter
  • Loading branch information
ceyonur committed Sep 18, 2025
commit f1609fa313fde82b2216fee71e889b1c41aace9e
6 changes: 3 additions & 3 deletions utils/math/exponential.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests for this new code?

Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func CalculateExponential(

maxOutput uint256.Int
)
num.SetUint64(uint64(numerator)) // range is [0, MaxUint64]
denom.SetUint64(uint64(denominator)) // range is [0, MaxUint64]
num.SetUint64(numerator) // range is [0, MaxUint64]
denom.SetUint64(denominator) // range is [0, MaxUint64]

i.SetOne()
numeratorAccum.SetUint64(uint64(factor)) // range is [0, MaxUint64]
numeratorAccum.SetUint64(factor) // range is [0, MaxUint64]
numeratorAccum.Mul(&numeratorAccum, &denom) // range is [0, MaxUint128]

maxOutput.Mul(&denom, max256Uint64) // range is [0, MaxUint128]
Expand Down
4 changes: 1 addition & 3 deletions vms/evm/upgrades/acp226/acp226.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
// https://github.com/avalanche-foundation/ACPs/blob/main/ACPs/226-dynamic-minimum-block-times/README.md
package acp226

import (
"github.com/ava-labs/avalanchego/vms/evm/upgrades/common"
)
import "github.com/ava-labs/avalanchego/vms/evm/upgrades/common"

const (
// MinDelayMilliseconds (M) is the minimum block delay in milliseconds
Expand Down
4 changes: 2 additions & 2 deletions vms/evm/upgrades/common/target_excess.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ func (p TargetExcessParams) DesiredTargetExcess(desiredTarget uint64) uint64 {
// CalculateTarget calculates the target value using exponential formula:
// Target = MinTarget * e^(Excess / TargetConversion)
func (p TargetExcessParams) CalculateTarget(excess uint64) uint64 {
return uint64(safemath.CalculateExponential(
return safemath.CalculateExponential(
p.MinTarget,
excess,
p.TargetConversion,
))
)
}

// MulWithUpperBound multiplies two numbers and returns the result. If the
Expand Down