-
Notifications
You must be signed in to change notification settings - Fork 39
/
simulation_full_network_test.go
39 lines (30 loc) · 1.37 KB
/
simulation_full_network_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package simulation
import (
"testing"
"time"
"github.com/ten-protocol/go-ten/integration"
"github.com/ten-protocol/go-ten/integration/simulation/params"
"github.com/ten-protocol/go-ten/integration/simulation/network"
)
// This test creates a network of L2 nodes, then injects transactions, and finally checks the resulting output blockchain.
// The L2 nodes communicate with each other via sockets, and with their enclave servers via RPC.
// All nodes and enclaves live in the same process. The L1 network is a private PoS geth network.
func TestFullNetworkMonteCarloSimulation(t *testing.T) {
setupSimTestLog("full-network")
numberOfNodes := 5
numberOfSimWallets := 5
wallets := params.NewSimWallets(numberOfSimWallets, numberOfNodes, integration.EthereumChainID, integration.TenChainID)
simParams := ¶ms.SimParams{
NumberOfNodes: numberOfNodes,
AvgBlockDuration: 1 * time.Second,
SimulationTime: 120 * time.Second,
L1EfficiencyThreshold: 0.2,
Wallets: wallets,
StartPort: integration.StartPortSimulationFullNetwork,
ReceiptTimeout: 20 * time.Second,
StoppingDelay: 15 * time.Second,
NodeWithInboundP2PDisabled: 2,
}
simParams.AvgNetworkLatency = simParams.AvgBlockDuration / 15
testSimulation(t, network.NewNetworkOfSocketNodes(wallets), simParams)
}