Skip to content

Commit

Permalink
Changed DurationLimit to a single value that specifies zone target time
Browse files Browse the repository at this point in the history
  • Loading branch information
gameofpointers committed Apr 11, 2023
1 parent ceea6da commit 1efa0a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion consensus/blake3pow/blake3pow.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
type Config struct {
PowMode Mode

DurationLimit []*big.Int
DurationLimit *big.Int

// When set, notifications sent by the remote sealer will
// be block header JSON objects instead of work package arrays.
Expand Down
2 changes: 1 addition & 1 deletion consensus/blake3pow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func (blake3pow *Blake3pow) CalcDifficulty(chain consensus.ChainHeaderReader, pa

// (2 if len(parent_uncles) else 1) - (block_timestamp - parent_timestamp) // duration_limit
x.Sub(bigTime, bigParentTime)
x.Div(x, blake3pow.config.DurationLimit[nodeCtx])
x.Div(x, blake3pow.config.DurationLimit)
if parent.UncleHash() == types.EmptyUncleHash {
x.Sub(big1, x)
} else {
Expand Down
16 changes: 8 additions & 8 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ const (
)

var (
DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations.
ZoneMinDifficulty = big.NewInt(131072) // The minimum difficulty in a zone. Prime & regions should be multiples of this value
MinimumDifficulty = ZoneMinDifficulty // The minimum that the difficulty may ever be.
GenesisDifficulty = ZoneMinDifficulty // Difficulty of the Genesis block.
DurationLimit = []*big.Int{big.NewInt(1000), big.NewInt(100), big.NewInt(10)} // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
GardenDurationLimit = []*big.Int{big.NewInt(150), big.NewInt(30), big.NewInt(3)} // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
OrchardDurationLimit = []*big.Int{big.NewInt(150), big.NewInt(30), big.NewInt(3)} // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
LocalDurationLimit = []*big.Int{big.NewInt(24), big.NewInt(7), big.NewInt(2)} // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations.
ZoneMinDifficulty = big.NewInt(131072) // The minimum difficulty in a zone. Prime & regions should be multiples of this value
MinimumDifficulty = ZoneMinDifficulty // The minimum that the difficulty may ever be.
GenesisDifficulty = ZoneMinDifficulty // Difficulty of the Genesis block.
DurationLimit = big.NewInt(10) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
GardenDurationLimit = big.NewInt(3) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
OrchardDurationLimit = big.NewInt(3) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
LocalDurationLimit = big.NewInt(2) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
TimeFactor = big.NewInt(7)
)

0 comments on commit 1efa0a4

Please sign in to comment.