Skip to content

Commit

Permalink
Merge 8fb62d6 into cc9bb89
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianpascalau authored Jul 4, 2023
2 parents cc9bb89 + 8fb62d6 commit bd33f4b
Show file tree
Hide file tree
Showing 22 changed files with 465 additions and 849 deletions.
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
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
17 changes: 17 additions & 0 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,14 @@ func TestP2pConfig(t *testing.T) {
Port = "` + port + `"
ThresholdMinConnectedPeers = 0
[Node.Transports]
QUICAddress = "/ip4/0.0.0.0/udp/%d/quic-v1"
WebSocketAddress = "/ip4/0.0.0.0/tcp/%d/ws"
WebTransportAddress = "/ip4/0.0.0.0/udp/%d/quic-v1/webtransport"
[Node.Transports.TCP]
ListenAddress = "/ip4/0.0.0.0/tcp/%d"
PreventPortReuse = true
[KadDhtPeerDiscovery]
Enabled = false
Type = ""
Expand Down Expand Up @@ -476,6 +484,15 @@ func TestP2pConfig(t *testing.T) {
expectedCfg := p2pConfig.P2PConfig{
Node: p2pConfig.NodeConfig{
Port: port,
Transports: p2pConfig.P2PTransportConfig{
TCP: p2pConfig.P2PTCPTransport{
ListenAddress: "/ip4/0.0.0.0/tcp/%d",
PreventPortReuse: true,
},
QUICAddress: "/ip4/0.0.0.0/udp/%d/quic-v1",
WebSocketAddress: "/ip4/0.0.0.0/tcp/%d/ws",
WebTransportAddress: "/ip4/0.0.0.0/udp/%d/quic-v1/webtransport",
},
},
KadDhtPeerDiscovery: p2pConfig.KadDhtPeerDiscoveryConfig{
ProtocolID: protocolID,
Expand Down
4 changes: 2 additions & 2 deletions dataRetriever/factory/dataPoolFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ func TestNewDataPoolFromConfig_BadConfigShouldErr(t *testing.T) {
require.Nil(t, holder)
fmt.Println(err)
require.NotNil(t, err)
require.True(t, strings.Contains(err.Error(), "Must provide a positive size while creating the cache for the miniblocks"))
require.True(t, strings.Contains(err.Error(), "must provide a positive size while creating the cache for the miniblocks"))

args = getGoodArgs()
args.Config.PeerBlockBodyDataPool.Capacity = 0
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
fmt.Println(err)
require.NotNil(t, err)
require.True(t, strings.Contains(err.Error(), "Must provide a positive size while creating the cache for the peer mini block body"))
require.True(t, strings.Contains(err.Error(), "must provide a positive size while creating the cache for the peer mini block body"))

args = getGoodArgs()
args.Config.TrieSyncStorage.Capacity = 0
Expand Down
6 changes: 0 additions & 6 deletions factory/network/export_test.go

This file was deleted.

3 changes: 0 additions & 3 deletions factory/network/networkComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type networkComponentsFactory struct {
mainConfig config.Config
ratingsConfig config.RatingsConfig
statusHandler core.AppStatusHandler
listenAddress string
marshalizer marshal.Marshalizer
syncer p2p.SyncTimer
preferredPeersSlices []string
Expand Down Expand Up @@ -96,7 +95,6 @@ func NewNetworkComponentsFactory(
marshalizer: args.Marshalizer,
mainConfig: args.MainConfig,
statusHandler: args.StatusHandler,
listenAddress: p2p.ListenAddrWithIp4AndTcp,
syncer: args.Syncer,
bootstrapWaitTime: args.BootstrapWaitTime,
preferredPeersSlices: args.PreferredPeersSlices,
Expand Down Expand Up @@ -132,7 +130,6 @@ func (ncf *networkComponentsFactory) Create() (*networkComponents, error) {

arg := p2pFactory.ArgsNetworkMessenger{
Marshalizer: ncf.marshalizer,
ListenAddress: ncf.listenAddress,
P2pConfig: ncf.p2pConfig,
SyncTimer: ncf.syncer,
PreferredPeersHolder: ph,
Expand Down
7 changes: 3 additions & 4 deletions factory/network/networkComponents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/multiversx/mx-chain-go/config"
errErd "github.com/multiversx/mx-chain-go/errors"
networkComp "github.com/multiversx/mx-chain-go/factory/network"
"github.com/multiversx/mx-chain-go/p2p"
p2pConfig "github.com/multiversx/mx-chain-go/p2p/config"
componentsMock "github.com/multiversx/mx-chain-go/testscommon/components"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -61,7 +60,6 @@ func TestNetworkComponentsFactory_CreateShouldWork(t *testing.T) {

args := componentsMock.GetNetworkFactoryArgs()
ncf, _ := networkComp.NewNetworkComponentsFactory(args)
ncf.SetListenAddress(p2p.ListenLocalhostAddrWithIp4AndTcp)

nc, err := ncf.Create()
require.NoError(t, err)
Expand All @@ -75,8 +73,9 @@ func TestNetworkComponents_CloseShouldWork(t *testing.T) {
args := componentsMock.GetNetworkFactoryArgs()
ncf, _ := networkComp.NewNetworkComponentsFactory(args)

nc, _ := ncf.Create()
nc, err := ncf.Create()
require.Nil(t, err)

err := nc.Close()
err = nc.Close()
require.NoError(t, err)
}
Loading

0 comments on commit bd33f4b

Please sign in to comment.