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

feat/go v1.20.5 integration #5406

Merged
merged 52 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1360735
- test p2p version
iulianpascalau Jun 6, 2023
52cf537
- test p2p version
iulianpascalau Jun 6, 2023
0087976
- test p2p version
iulianpascalau Jun 6, 2023
e2be0e3
- logs
iulianpascalau Jun 6, 2023
e862203
- test p2p version
iulianpascalau Jun 6, 2023
62ba8d9
- try
iulianpascalau Jun 6, 2023
385fcf3
- try go 1.20.3
iulianpascalau Jun 7, 2023
445f19e
- try new version
iulianpascalau Jun 7, 2023
bb42a48
- test p2p version
iulianpascalau Jun 7, 2023
c37847a
- new p2p versions + adjustments
iulianpascalau Jun 8, 2023
903b251
- trying to fix linter
iulianpascalau Jun 8, 2023
9511125
- new reference
iulianpascalau Jun 12, 2023
8d45f99
- added integration test
iulianpascalau Jun 14, 2023
5136c6b
- integration test changes
iulianpascalau Jun 19, 2023
c5b9487
- new p2p version
iulianpascalau Jun 19, 2023
ddf5b9d
Merge branch 'master' into test-p2p-options
iulianpascalau Jun 19, 2023
f46fc9f
- new libp2p lib
iulianpascalau Jun 20, 2023
9778fda
Merge branch 'master' into test-p2p-options
iulianpascalau Jun 21, 2023
16d1702
- trying fix 2
iulianpascalau Jun 22, 2023
1dfc68e
- reverted fix 2
iulianpascalau Jun 22, 2023
b3658a2
- probable fix number 3
iulianpascalau Jun 22, 2023
61cfd12
- more logs
iulianpascalau Jun 23, 2023
acd4f58
- new p2p version
iulianpascalau Jun 23, 2023
a469aac
- try new fix
iulianpascalau Jun 26, 2023
8eb28e0
- trying fix
iulianpascalau Jun 26, 2023
1cd8836
- trying fix
iulianpascalau Jun 26, 2023
6bbc117
- trying new public libs
iulianpascalau Jun 28, 2023
9f670d0
- new p2p version
iulianpascalau Jun 30, 2023
7fa43f6
Merge branch 'master' into test-p2p-options
iulianpascalau Jun 30, 2023
0b7deba
- fixes after merge
iulianpascalau Jun 30, 2023
d78f818
- latest p2p version
iulianpascalau Jun 30, 2023
71713c4
- proper release, integration with new tag
iulianpascalau Jul 4, 2023
3121d2b
Merge branch 'master' into test-p2p-options
iulianpascalau Jul 4, 2023
8fb62d6
- fixed workflow
iulianpascalau Jul 4, 2023
2b73fbb
- sort backwards compatibility fix
iulianpascalau Jul 6, 2023
bc1299f
Merge branch 'feat/go-v1.20.5-integration' into test-p2p-options
iulianpascalau Jul 7, 2023
cf385e3
Merge pull request #5327 from multiversx/test-p2p-options
iulianpascalau Jul 7, 2023
4200e99
Merge branch 'feat/go-v1.20.5-integration' into fix-backwards-compati…
iulianpascalau Jul 7, 2023
611a6f8
Merge branch 'master' into merge-master-feat-go-1205-2023.07.07
iulianpascalau Jul 7, 2023
bb5b6b1
Merge pull request #5407 from multiversx/merge-master-feat-go-1205-20…
iulianpascalau Jul 7, 2023
8a05637
Merge branch 'feat/go-v1.20.5-integration' into deterministic-sort-on…
iulianpascalau Jul 7, 2023
0869839
- added deterministic sort on validators info
iulianpascalau Jul 7, 2023
a023725
- optimized comparison
iulianpascalau Jul 7, 2023
6fa294a
- print the created miniblocks in order
iulianpascalau Jul 7, 2023
f6cb39b
Merge branch 'feat/go-v1.20.5-integration' into fix-backwards-compati…
iulianpascalau Jul 7, 2023
192ebc3
Merge pull request #5405 from multiversx/fix-backwards-compatibility-…
iulianpascalau Jul 8, 2023
e167e70
Merge branch 'feat/go-v1.20.5-integration' into deterministic-sort-on…
iulianpascalau Jul 8, 2023
a5e5cfb
- comment fix
iulianpascalau Jul 8, 2023
056a257
- fixed comment
iulianpascalau Jul 10, 2023
aee68cc
Merge pull request #5409 from multiversx/deterministic-sort-on-valida…
iulianpascalau Jul 11, 2023
988af56
Merge branch 'master' into merge-master-go-1.20.5-2023.07.20
iulianpascalau Jul 20, 2023
f73e0b1
Merge pull request #5443 from multiversx/merge-master-go-1.20.5-2023.…
iulianpascalau Jul 20, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ${{ matrix.runs-on }}
name: Build
steps:
- name: Set up Go 1.17.6
- name: Set up Go 1.20.5
uses: actions/setup-go@v3
with:
go-version: 1.17.6
go-version: 1.20.5
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-cli-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ${{ matrix.runs-on }}
name: Check CLI.md
steps:
- name: Set up Go 1.17.6
- name: Set up Go 1.20.5
uses: actions/setup-go@v3
with:
go-version: 1.17.6
go-version: 1.20.5
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
runs-on: ${{ matrix.runs-on }}
name: Build
steps:
- name: Set up Go 1.17.6
- name: Set up Go 1.20.5
uses: actions/setup-go@v3
with:
go-version: 1.17.6
go-version: 1.20.5
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
runs-on: ${{ matrix.runs-on }}
name: Build
steps:
- name: Set up Go 1.17.6
- name: Set up Go 1.20.5
uses: actions/setup-go@v3
with:
go-version: 1.17.6
go-version: 1.20.5
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.17.6
go-version: 1.20.5
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.45.2
version: v1.53.2

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@
# SetGuardianEnableEpoch represents the epoch when the guard account feature is enabled in the protocol
SetGuardianEnableEpoch = 1

# DeterministicSortOnValidatorsInfoEnableEpoch represents the epoch when the deterministic sorting on validators info is enabled
DeterministicSortOnValidatorsInfoEnableEpoch = 2

# BLSMultiSignerEnableEpoch represents the activation epoch for different types of BLS multi-signers
BLSMultiSignerEnableEpoch = [
{ EnableEpoch = 0, Type = "no-KOSK"},
Expand Down
10 changes: 10 additions & 0 deletions cmd/node/config/p2p.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
# time which is now set to ~20 seconds (the const defined in the common package named TimeToWaitForP2PBootstrap)
MinNumPeersToWaitForOnBootstrap = 10

# available transports. All defined addresses contains a single '%d' markup that is mandatory and will
# be replaced at runtime with the actual port value
[Node.Transports]
QUICAddress = "" # optional QUIC address. If this transport should be activated, should be in this format: /ip4/0.0.0.0/udp/%d/quic-v1
WebSocketAddress = "" # optional WebSocket address. If this transport should be activated, should be in this format: /ip4/0.0.0.0/tcp/%d/ws
WebTransportAddress = "" # optional WebTransport address. If this transport should be activated, should be in this format: /ip4/0.0.0.0/udp/%d/quic-v1/webtransport
[Node.Transports.TCP]
ListenAddress = "/ip4/0.0.0.0/tcp/%d" # TCP listen address
PreventPortReuse = false

# P2P peer discovery section

#The following sections correspond to the way new peers will be discovered
Expand Down
10 changes: 10 additions & 0 deletions cmd/seednode/config/p2p.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
#not have a sync and consensus mechanism. Default is 0.
ThresholdMinConnectedPeers = 0

# available transports. All defined addresses contains a single '%d' markup that is mandatory and will
# be replaced at runtime with the actual port value
[Node.Transports]
QUICAddress = "" # optional QUIC address. If this transport should be activated, should be in this format: /ip4/0.0.0.0/udp/%d/quic
WebSocketAddress = "" # optional WebSocket address. If this transport should be activated, should be in this format: /ip4/0.0.0.0/tcp/%d/ws
WebTransportAddress = "" # optional WebTransport address. If this transport should be activated, should be in this format: /ip4/0.0.0.0/udp/%d/quic-v1/webtransport
[Node.Transports.TCP]
ListenAddress = "/ip4/0.0.0.0/tcp/%d" # TCP listen address
PreventPortReuse = true # seeder nodes will need to enable this option

# P2P peer discovery section

#The following sections correspond to the way new peers will be discovered
Expand Down
1 change: 0 additions & 1 deletion cmd/seednode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ func createNode(

arg := p2pFactory.ArgsNetworkMessenger{
Marshalizer: marshalizer,
ListenAddress: p2p.ListenAddrWithIp4AndTcp,
P2pConfig: p2pConfig,
SyncTimer: &p2pFactory.LocalSyncTimer{},
PreferredPeersHolder: disabled.NewPreferredPeersHolder(),
Expand Down
11 changes: 11 additions & 0 deletions common/compatibility/export_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package compatibility

import "sort"

// Sort sorts data.
// It makes one call to data.Len to determine n and O(n*log(n)) calls to
// data.Less and data.Swap. The sort is not guaranteed to be stable.
func Sort(data sort.Interface) {
n := data.Len()
quickSort_func(data, 0, n, maxDepth(n))
}
163 changes: 163 additions & 0 deletions common/compatibility/quickSorter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
package compatibility

type lessSwapHandler interface {
Less(i, j int) bool
Swap(i, j int)
}

// from go implementation v1.17.6 /src/sort/zfuncversion.go L10
func insertionSort_func(data lessSwapHandler, a, b int) {
for i := a + 1; i < b; i++ {
for j := i; j > a && data.Less(j, j-1); j-- {
data.Swap(j, j-1)
}
}
}

// from go implementation v1.17.6 /src/sort/zfuncversion.go L19
func siftDown_func(data lessSwapHandler, lo, hi, first int) {
root := lo
for {
child := 2*root + 1
if child >= hi {
break
}
if child+1 < hi && data.Less(first+child, first+child+1) {
child++
}
if !data.Less(first+root, first+child) {
return
}
data.Swap(first+root, first+child)
root = child
}
}

// from go implementation v1.17.6 /src/sort/zfuncversion.go L37
func heapSort_func(data lessSwapHandler, a, b int) {
first := a
lo := 0
hi := b - a
for i := (hi - 1) / 2; i >= 0; i-- {
siftDown_func(data, i, hi, first)
}
for i := hi - 1; i >= 0; i-- {
data.Swap(first, first+i)
siftDown_func(data, lo, i, first)
}
}

// from go implementation v1.17.6 /src/sort/zfuncversion.go L52
func medianOfThree_func(data lessSwapHandler, m1, m0, m2 int) {
if data.Less(m1, m0) {
data.Swap(m1, m0)
}
if data.Less(m2, m1) {
data.Swap(m2, m1)
if data.Less(m1, m0) {
data.Swap(m1, m0)
}
}
}

// from go implementation v1.17.6 /src/sort/zfuncversion.go L72
func doPivot_func(data lessSwapHandler, lo, hi int) (midlo, midhi int) {
m := int(uint(lo+hi) >> 1)
if hi-lo > 40 {
s := (hi - lo) / 8
medianOfThree_func(data, lo, lo+s, lo+2*s)
medianOfThree_func(data, m, m-s, m+s)
medianOfThree_func(data, hi-1, hi-1-s, hi-1-2*s)
}
medianOfThree_func(data, lo, m, hi-1)
pivot := lo
a, c := lo+1, hi-1
for ; a < c && data.Less(a, pivot); a++ {
}
b := a
for {
for ; b < c && !data.Less(pivot, b); b++ {
}
for ; b < c && data.Less(pivot, c-1); c-- {
}
if b >= c {
break
}
data.Swap(b, c-1)
b++
c--
}
protect := hi-c < 5
if !protect && hi-c < (hi-lo)/4 {
dups := 0
if !data.Less(pivot, hi-1) {
data.Swap(c, hi-1)
c++
dups++
}
if !data.Less(b-1, pivot) {
b--
dups++
}
if !data.Less(m, pivot) {
data.Swap(m, b-1)
b--
dups++
}
protect = dups > 1
}
if protect {
for {
for ; a < b && !data.Less(b-1, pivot); b-- {
}
for ; a < b && data.Less(a, pivot); a++ {
}
if a >= b {
break
}
data.Swap(a, b-1)
a++
b--
}
}
data.Swap(pivot, b-1)
return b - 1, c
}

// from go implementation v1.17.6 /src/sort/zfuncversion.go L136
func quickSort_func(data lessSwapHandler, a, b, maxDepth int) {
for b-a > 12 {
if maxDepth == 0 {
heapSort_func(data, a, b)
return
}
maxDepth--
mlo, mhi := doPivot_func(data, a, b)
if mlo-a < b-mhi {
quickSort_func(data, a, mlo, maxDepth)
a = mhi
} else {
quickSort_func(data, mhi, b, maxDepth)
b = mlo
}
}
if b-a > 1 {
for i := a + 6; i < b; i++ {
if data.Less(i, i-6) {
data.Swap(i, i-6)
}
}
insertionSort_func(data, a, b)
}
}

// maxDepth returns a threshold at which quicksort should switch
// to heapsort. It returns 2*ceil(lg(n+1)).
// from go implementation v1.17.6 /src/sort/sort.go L236
func maxDepth(n int) int {
var depth int
for i := n; i > 0; i >>= 1 {
depth++
}
return depth * 2
}
Loading