Skip to content

Commit bc64e75

Browse files
authored
upgrade all deps and go version to 1.23 (#1417)
* upgrade all deps and go version to 1.23 * import new go-deadlock * dwongrade dd-trace-go to 1.66.0 for other repo support * bump dd trace again * go mod tidy * replace holiman uint256 w/ deso protocol uint256 for hex marshaling * upgrade deps again and go mod tidy * address DH feedback * add old btcec ciphering to core * upgrade deps and go mod tidy
1 parent 9973977 commit bc64e75

File tree

109 files changed

+1929
-1950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1929
-1950
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install Go
1616
uses: actions/setup-go@v2
1717
with:
18-
go-version: "1.20"
18+
go-version: "1.23"
1919

2020
- name: Checkout branch
2121
uses: actions/checkout@v3
@@ -52,7 +52,7 @@ jobs:
5252
- name: Install Go
5353
uses: actions/setup-go@v2
5454
with:
55-
go-version: "1.20"
55+
go-version: "1.23"
5656

5757
- name: Checkout branch
5858
uses: actions/checkout@v3

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM alpine:latest AS core
33
RUN apk update && apk upgrade
44
RUN apk add --update bash cmake g++ gcc git make vips vips-dev
55

6-
COPY --from=golang:1.20-alpine /usr/local/go/ /usr/local/go/
6+
COPY --from=golang:1.23-alpine /usr/local/go/ /usr/local/go/
77
ENV PATH="/usr/local/go/bin:${PATH}"
88

99
WORKDIR /deso/src/core

cmd/node.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/hex"
55
"flag"
66
"fmt"
7+
"github.com/deso-protocol/go-deadlock"
78
"net"
89
"os"
910
"os/signal"
@@ -17,8 +18,7 @@ import (
1718
"github.com/davecgh/go-spew/spew"
1819
"github.com/deso-protocol/core/lib"
1920
"github.com/deso-protocol/core/migrate"
20-
"github.com/deso-protocol/go-deadlock"
21-
"github.com/dgraph-io/badger/v3"
21+
"github.com/dgraph-io/badger/v4"
2222
"github.com/go-pg/pg/v10"
2323
"github.com/golang/glog"
2424
migrations "github.com/robinjoseph08/go-pg-migrations/v3"
@@ -529,13 +529,13 @@ func addIPsForHost(desoAddrMgr *addrmgr.AddrManager, host string, params *lib.De
529529
glog.V(1).Infof("_addSeedAddrs: Adding seed IPs from seed %s: %v\n", host, ipAddrs)
530530

531531
// Convert addresses to NetAddress'es.
532-
netAddrs, err := lib.SafeMakeSliceWithLength[*wire.NetAddress](uint64(len(ipAddrs)))
532+
netAddrs, err := lib.SafeMakeSliceWithLength[*wire.NetAddressV2](uint64(len(ipAddrs)))
533533
if err != nil {
534534
glog.V(2).Infof("_addSeedAddrs: Problem creating netAddrs slice with length %d", len(ipAddrs))
535535
return
536536
}
537537
for ii, ip := range ipAddrs {
538-
netAddrs[ii] = wire.NewNetAddressTimestamp(
538+
netAddrs[ii] = wire.NetAddressV2FromBytes(
539539
// We initialize addresses with a
540540
// randomly selected "last seen time" between 3
541541
// and 7 days ago similar to what bitcoind does.
@@ -558,7 +558,6 @@ func addIPsForHost(desoAddrMgr *addrmgr.AddrManager, host string, params *lib.De
558558
// [0, 10]
559559
func addSeedAddrsFromPrefixes(desoAddrMgr *addrmgr.AddrManager, params *lib.DeSoParams) {
560560
MaxIterations := 20
561-
562561
go func() {
563562
for dnsNumber := 0; dnsNumber < MaxIterations; dnsNumber++ {
564563
var wg deadlock.WaitGroup

consensus/event_loop.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"fmt"
55
"time"
66

7+
"github.com/deso-protocol/uint256"
78
"github.com/golang/glog"
8-
"github.com/holiman/uint256"
99
"github.com/pkg/errors"
1010

1111
"github.com/deso-protocol/core/bls"
@@ -695,8 +695,8 @@ func (fe *fastHotStuffEventLoop) tryConstructVoteQCInCurrentView() *FastHotStuff
695695
votesByValidator := fe.votesSeenByBlockHash[voteSignaturePayload]
696696

697697
// Compute the total stake and total stake with votes
698-
totalStake := uint256.NewInt()
699-
totalVotingStake := uint256.NewInt()
698+
totalStake := uint256.NewInt(0)
699+
totalVotingStake := uint256.NewInt(0)
700700

701701
// Track the signatures and signers list for the chain tip
702702
signersList := bitset.NewBitset()
@@ -705,7 +705,7 @@ func (fe *fastHotStuffEventLoop) tryConstructVoteQCInCurrentView() *FastHotStuff
705705
// Iterate through the entire validator list and check if each one has voted for the tip block. Track
706706
// all voters and their stakes.
707707
for ii, validator := range validatorList {
708-
totalStake = uint256.NewInt().Add(totalStake, validator.GetStakeAmount())
708+
totalStake = uint256.NewInt(0).Add(totalStake, validator.GetStakeAmount())
709709

710710
// Skip the validator if it hasn't voted for the block
711711
vote, hasVoted := votesByValidator[validator.GetPublicKey().ToString()]
@@ -714,7 +714,7 @@ func (fe *fastHotStuffEventLoop) tryConstructVoteQCInCurrentView() *FastHotStuff
714714
}
715715

716716
// Track the vote's signature, stake, and place in the validator list
717-
totalVotingStake = uint256.NewInt().Add(totalVotingStake, validator.GetStakeAmount())
717+
totalVotingStake = uint256.NewInt(0).Add(totalVotingStake, validator.GetStakeAmount())
718718
signersList.Set(ii, true)
719719
signatures = append(signatures, vote.GetSignature())
720720
}
@@ -819,8 +819,8 @@ func (fe *fastHotStuffEventLoop) tryConstructTimeoutQCInCurrentView() *FastHotSt
819819
}
820820

821821
// Compute the total stake and total stake with timeouts
822-
totalStake := uint256.NewInt()
823-
totalTimedOutStake := uint256.NewInt()
822+
totalStake := uint256.NewInt(0)
823+
totalTimedOutStake := uint256.NewInt(0)
824824

825825
// Track the high QC view for each validator
826826
highQCViews := make([]uint64, len(validatorList))
@@ -835,7 +835,7 @@ func (fe *fastHotStuffEventLoop) tryConstructTimeoutQCInCurrentView() *FastHotSt
835835
// for the signersList bitset. In practice, the validator list is expected to be <= 1000 in size, so
836836
// this loop will be fast.
837837
for ii, validator := range validatorList {
838-
totalStake = uint256.NewInt().Add(totalStake, validator.GetStakeAmount())
838+
totalStake = uint256.NewInt(0).Add(totalStake, validator.GetStakeAmount())
839839

840840
// Skip the validator if it hasn't timed out for the previous view
841841
timeout, hasTimedOut := timeoutsByValidator[validator.GetPublicKey().ToString()]
@@ -844,7 +844,7 @@ func (fe *fastHotStuffEventLoop) tryConstructTimeoutQCInCurrentView() *FastHotSt
844844
}
845845

846846
// Track the signatures, timed out stake, and high QC views for the validator
847-
totalTimedOutStake = uint256.NewInt().Add(totalTimedOutStake, validator.GetStakeAmount())
847+
totalTimedOutStake = uint256.NewInt(0).Add(totalTimedOutStake, validator.GetStakeAmount())
848848
signersList.Set(ii, true)
849849
signatures = append(signatures, timeout.GetSignature())
850850
highQCViews[ii] = timeout.GetHighQC().GetView()

consensus/event_loop_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/deso-protocol/core/bls"
99
"github.com/deso-protocol/core/collections/bitset"
10-
"github.com/holiman/uint256"
10+
"github.com/deso-protocol/uint256"
1111
"github.com/stretchr/testify/require"
1212
)
1313

@@ -878,11 +878,11 @@ func TestVoteQCConstructionSignal(t *testing.T) {
878878
validatorList := []Validator{
879879
&validator{
880880
publicKey: validatorPrivateKey1.PublicKey(),
881-
stakeAmount: uint256.NewInt().SetUint64(70),
881+
stakeAmount: uint256.NewInt(70),
882882
},
883883
&validator{
884884
publicKey: validatorPrivateKey2.PublicKey(),
885-
stakeAmount: uint256.NewInt().SetUint64(30),
885+
stakeAmount: uint256.NewInt(30),
886886
},
887887
}
888888

@@ -1064,11 +1064,11 @@ func TestTimeoutQCConstructionSignal(t *testing.T) {
10641064
validatorList := []Validator{
10651065
&validator{
10661066
publicKey: validatorPrivateKey1.PublicKey(),
1067-
stakeAmount: uint256.NewInt().SetUint64(70),
1067+
stakeAmount: uint256.NewInt(70),
10681068
},
10691069
&validator{
10701070
publicKey: validatorPrivateKey2.PublicKey(),
1071-
stakeAmount: uint256.NewInt().SetUint64(30),
1071+
stakeAmount: uint256.NewInt(30),
10721072
},
10731073
}
10741074

consensus/integration_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66

77
"github.com/deso-protocol/core/collections"
8-
"github.com/holiman/uint256"
8+
"github.com/deso-protocol/uint256"
99
"github.com/stretchr/testify/require"
1010
)
1111

@@ -16,10 +16,10 @@ import (
1616
func TestNetworkWithOfflineValidators(t *testing.T) {
1717
// Create 4 nodes with equal stake. The network has super-majority of stake online
1818
// as long as 3 out of 4 nodes are online.
19-
node1 := newValidatorNode(uint256.NewInt().SetUint64(50), true) // block proposer
20-
node2 := newValidatorNode(uint256.NewInt().SetUint64(50), false) // validator
21-
node3 := newValidatorNode(uint256.NewInt().SetUint64(50), false) // validator
22-
node4 := newValidatorNode(uint256.NewInt().SetUint64(50), false) // validator
19+
node1 := newValidatorNode(uint256.NewInt(50), true) // block proposer
20+
node2 := newValidatorNode(uint256.NewInt(50), false) // validator
21+
node3 := newValidatorNode(uint256.NewInt(50), false) // validator
22+
node4 := newValidatorNode(uint256.NewInt(50), false) // validator
2323

2424
allNodes := []*validatorNode{node1, node2, node3, node4}
2525

@@ -104,10 +104,10 @@ func TestNetworkWithOfflineValidators(t *testing.T) {
104104
func TestNetworkWithOfflineBlockProposer(t *testing.T) {
105105
// Create 4 nodes with equal stake. The network has super-majority of stake online
106106
// as long as 3 out of 4 nodes are online.
107-
node1 := newValidatorNode(uint256.NewInt().SetUint64(50), true) // block proposer
108-
node2 := newValidatorNode(uint256.NewInt().SetUint64(50), false) // validator
109-
node3 := newValidatorNode(uint256.NewInt().SetUint64(50), false) // validator
110-
node4 := newValidatorNode(uint256.NewInt().SetUint64(50), false) // validator
107+
node1 := newValidatorNode(uint256.NewInt(50), true) // block proposer
108+
node2 := newValidatorNode(uint256.NewInt(50), false) // validator
109+
node3 := newValidatorNode(uint256.NewInt(50), false) // validator
110+
node4 := newValidatorNode(uint256.NewInt(50), false) // validator
111111

112112
allNodes := []*validatorNode{node1, node2, node3, node4}
113113

@@ -181,9 +181,9 @@ func TestNetworkWithOfflineBlockProposer(t *testing.T) {
181181
func TestNetworkRecoveryAfterCatastrophicFailure(t *testing.T) {
182182
// Create 3 nodes with equal stake. Node 3 has a super-majority of the the stake
183183
// and needs to stay online for the network to remain live.
184-
node1 := newValidatorNode(uint256.NewInt().SetUint64(10), true) // block proposer
185-
node2 := newValidatorNode(uint256.NewInt().SetUint64(10), false) // validator
186-
node3 := newValidatorNode(uint256.NewInt().SetUint64(80), false) // validator
184+
node1 := newValidatorNode(uint256.NewInt(10), true) // block proposer
185+
node2 := newValidatorNode(uint256.NewInt(10), false) // validator
186+
node3 := newValidatorNode(uint256.NewInt(80), false) // validator
187187

188188
allNodes := []*validatorNode{node1, node2, node3}
189189

consensus/integration_test_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/deso-protocol/core/bls"
99
"github.com/deso-protocol/core/collections"
10-
"github.com/holiman/uint256"
10+
"github.com/deso-protocol/uint256"
1111
)
1212

1313
// validatorNode is a simplified implementation of a Fast-HotStuff node that runs the Fast-HotStuff

consensus/types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/deso-protocol/core/bls"
88
"github.com/deso-protocol/core/collections/bitset"
9-
"github.com/holiman/uint256"
9+
"github.com/deso-protocol/uint256"
1010
)
1111

1212
// FastHotStuffEventType is a way for FastHotStuffEventLoop to send messages back to the Server.

consensus/types_internal.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package consensus
33
import (
44
"github.com/deso-protocol/core/bls"
55
"github.com/deso-protocol/core/collections/bitset"
6-
"github.com/holiman/uint256"
6+
"github.com/deso-protocol/uint256"
77
)
88

99
//////////////////////////////////////////////////////////

consensus/utils.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/deso-protocol/core/bls"
1010
"github.com/deso-protocol/core/collections"
1111
"github.com/deso-protocol/core/collections/bitset"
12-
"github.com/holiman/uint256"
12+
"github.com/deso-protocol/uint256"
1313
"golang.org/x/crypto/sha3"
1414
)
1515

@@ -132,8 +132,8 @@ func IsValidSuperMajorityAggregateQuorumCertificate(aggQC AggregateQuorumCertifi
132132

133133
func isSuperMajorityStakeSignersList(signersList *bitset.Bitset, validators []Validator) (bool, []*bls.PublicKey) {
134134
// Compute the total stake in the QC and the total stake in the network
135-
stakeInQC := uint256.NewInt()
136-
totalStake := uint256.NewInt()
135+
stakeInQC := uint256.NewInt(0)
136+
totalStake := uint256.NewInt(0)
137137

138138
// Fetch the validators in the QC
139139
validatorPublicKeysInQC := []*bls.PublicKey{}
@@ -392,11 +392,11 @@ func isSuperMajorityStake(stake *uint256.Int, totalStake *uint256.Int) bool {
392392
}
393393

394394
// Compute 3Cq
395-
honestStakeComponent := uint256.NewInt().Mul(stake, uint256.NewInt().SetUint64(3))
395+
honestStakeComponent := uint256.NewInt(0).Mul(stake, uint256.NewInt(3))
396396

397397
// Compute 2N + 1
398-
totalStakeComponent := uint256.NewInt().Mul(totalStake, uint256.NewInt().SetUint64(2))
399-
totalStakeComponent = uint256.NewInt().Add(totalStakeComponent, uint256.NewInt().SetUint64(1))
398+
totalStakeComponent := uint256.NewInt(0).Mul(totalStake, uint256.NewInt(2))
399+
totalStakeComponent = uint256.NewInt(0).Add(totalStakeComponent, uint256.NewInt(1))
400400

401401
// Check if 3Cq >= 2N + 1
402402
return honestStakeComponent.Cmp(totalStakeComponent) >= 0
@@ -450,11 +450,11 @@ func createValidatorListForPrivateKeys(pk1 *bls.PrivateKey, pk2 *bls.PrivateKey)
450450
validators := []*validator{
451451
{
452452
publicKey: pk1.PublicKey(),
453-
stakeAmount: uint256.NewInt().SetUint64(100),
453+
stakeAmount: uint256.NewInt(100),
454454
},
455455
{
456456
publicKey: pk2.PublicKey(),
457-
stakeAmount: uint256.NewInt().SetUint64(50),
457+
stakeAmount: uint256.NewInt(50),
458458
},
459459
}
460460
// Cast the slice of concrete structs []*validators to a slice of interfaces []Validator

0 commit comments

Comments
 (0)