Skip to content
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

build(deps): bump golang.org/x/crypto from 0.22.0 to 0.23.0 #156

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
36 changes: 18 additions & 18 deletions consensus/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ func adjustTarget(s State, blockTimestamp time.Time, targetTimestamp time.Time)
shift *= 10
shift /= 10000 * 10000
targetBlockTime := blockInterval + shift
if min := blockInterval / 3; targetBlockTime < min {
targetBlockTime = min
} else if max := blockInterval * 3; targetBlockTime > max {
targetBlockTime = max
if minTime := blockInterval / 3; targetBlockTime < minTime {
targetBlockTime = minTime
} else if maxTime := blockInterval * 3; targetBlockTime > maxTime {
targetBlockTime = maxTime
}
if oakTotalTime <= 0 {
oakTotalTime = 1
Expand All @@ -249,12 +249,12 @@ func adjustTarget(s State, blockTimestamp time.Time, targetTimestamp time.Time)
if s.childHeight() == s.Network.HardforkASIC.Height {
return newTarget
}
min := mulTargetFrac(s.ChildTarget, 1004, 1000)
max := mulTargetFrac(s.ChildTarget, 1000, 1004)
if newTarget.CmpWork(min) < 0 {
newTarget = min
} else if newTarget.CmpWork(max) > 0 {
newTarget = max
minTarget := mulTargetFrac(s.ChildTarget, 1004, 1000)
maxTarget := mulTargetFrac(s.ChildTarget, 1000, 1004)
if newTarget.CmpWork(minTarget) < 0 {
newTarget = minTarget
} else if newTarget.CmpWork(maxTarget) > 0 {
newTarget = maxTarget
}
return newTarget
}
Expand All @@ -280,10 +280,10 @@ func adjustDifficulty(s State, blockTimestamp time.Time, targetTimestamp time.Ti

// calculate the new target block time, clamped to a factor of 3
targetBlockTime := s.BlockInterval() + shift
if min := s.BlockInterval() / 3; targetBlockTime < min {
targetBlockTime = min
} else if max := s.BlockInterval() * 3; targetBlockTime > max {
targetBlockTime = max
if minTime := s.BlockInterval() / 3; targetBlockTime < minTime {
targetBlockTime = minTime
} else if maxTime := s.BlockInterval() * 3; targetBlockTime > maxTime {
targetBlockTime = maxTime
}

// estimate current hashrate
Expand All @@ -301,10 +301,10 @@ func adjustDifficulty(s State, blockTimestamp time.Time, targetTimestamp time.Ti

// clamp the adjustment to 0.4%
maxAdjust := s.Difficulty.div64(250)
if min := s.Difficulty.sub(maxAdjust); newDifficulty.Cmp(min) < 0 {
newDifficulty = min
} else if max := s.Difficulty.add(maxAdjust); newDifficulty.Cmp(max) > 0 {
newDifficulty = max
if minDifficulty := s.Difficulty.sub(maxAdjust); newDifficulty.Cmp(minDifficulty) < 0 {
newDifficulty = minDifficulty
} else if maxDifficulty := s.Difficulty.add(maxAdjust); newDifficulty.Cmp(maxDifficulty) > 0 {
newDifficulty = maxDifficulty
}
return newDifficulty, invTarget(newDifficulty.n)
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.20

require (
go.sia.tech/mux v1.2.0
golang.org/x/crypto v0.22.0
golang.org/x/sys v0.19.0
golang.org/x/crypto v0.23.0
golang.org/x/sys v0.20.0
lukechampine.com/frand v1.4.2
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da h1:KjTM2ks9d14ZYCvmH
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da/go.mod h1:eHEWzANqSiWQsof+nXEI9bUVUyV6F53Fp89EuCh2EAA=
go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU=
go.sia.tech/mux v1.2.0/go.mod h1:Yyo6wZelOYTyvrHmJZ6aQfRoer3o4xyKQ4NmQLJrBSo=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
lukechampine.com/frand v1.4.2 h1:RzFIpOvkMXuPMBb9maa4ND4wjBn71E1Jpf8BzJHMaVw=
lukechampine.com/frand v1.4.2/go.mod h1:4S/TM2ZgrKejMcKMbeLjISpJMO+/eZ1zu3vYX9dtj3s=
6 changes: 3 additions & 3 deletions rhp/v2/merkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ func RangeProofSize(n, start, end uint64) uint64 {
// not overlap end.
func nextSubtreeSize(start, end uint64) uint64 {
ideal := bits.TrailingZeros64(start)
max := bits.Len64(end-start) - 1
if ideal > max {
return 1 << max
maxSize := bits.Len64(end-start) - 1
if ideal > maxSize {
return 1 << maxSize
}
return 1 << ideal
}
Expand Down
Loading