mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-31 16:18:00 -05:00
Compare commits
3 Commits
e2e-debugg
...
optimistic
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06e0ee1677 | ||
|
|
8a54ae89af | ||
|
|
3248128e6c |
@@ -49,6 +49,7 @@ go_test(
|
|||||||
"//testing/endtoend/helpers:go_default_library",
|
"//testing/endtoend/helpers:go_default_library",
|
||||||
"//testing/endtoend/params:go_default_library",
|
"//testing/endtoend/params:go_default_library",
|
||||||
"//testing/endtoend/types:go_default_library",
|
"//testing/endtoend/types:go_default_library",
|
||||||
|
"//testing/middleware/engine-api-proxy:go_default_library",
|
||||||
"//testing/require:go_default_library",
|
"//testing/require:go_default_library",
|
||||||
"//testing/slasher/simulator:go_default_library",
|
"//testing/slasher/simulator:go_default_library",
|
||||||
"//testing/util:go_default_library",
|
"//testing/util:go_default_library",
|
||||||
|
|||||||
@@ -117,8 +117,12 @@ func (node *BeaconNode) Start(ctx context.Context) error {
|
|||||||
expectedNumOfPeers += 1
|
expectedNumOfPeers += 1
|
||||||
}
|
}
|
||||||
jwtPath := path.Join(e2e.TestParams.TestPath, "eth1data/"+strconv.Itoa(node.index)+"/")
|
jwtPath := path.Join(e2e.TestParams.TestPath, "eth1data/"+strconv.Itoa(node.index)+"/")
|
||||||
|
eth1Port := e2e.TestParams.Ports.Eth1AuthRPCPort
|
||||||
|
// The first beacon node should be connecting to an execution client with authentication
|
||||||
|
// via a proxy middleware we can use to test SYNCING responses in the engine API.
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
jwtPath = path.Join(e2e.TestParams.TestPath, "eth1data/miner/")
|
jwtPath = path.Join(e2e.TestParams.TestPath, "eth1data/miner/")
|
||||||
|
eth1Port = e2e.TestParams.Ports.Eth1ProxyPort
|
||||||
}
|
}
|
||||||
jwtPath = path.Join(jwtPath, "geth/jwtsecret")
|
jwtPath = path.Join(jwtPath, "geth/jwtsecret")
|
||||||
args := []string{
|
args := []string{
|
||||||
@@ -126,7 +130,7 @@ func (node *BeaconNode) Start(ctx context.Context) error {
|
|||||||
fmt.Sprintf("--%s=%s", cmdshared.LogFileName.Name, stdOutFile.Name()),
|
fmt.Sprintf("--%s=%s", cmdshared.LogFileName.Name, stdOutFile.Name()),
|
||||||
fmt.Sprintf("--%s=%s", flags.DepositContractFlag.Name, e2e.TestParams.ContractAddress.Hex()),
|
fmt.Sprintf("--%s=%s", flags.DepositContractFlag.Name, e2e.TestParams.ContractAddress.Hex()),
|
||||||
fmt.Sprintf("--%s=%d", flags.RPCPort.Name, e2e.TestParams.Ports.PrysmBeaconNodeRPCPort+index),
|
fmt.Sprintf("--%s=%d", flags.RPCPort.Name, e2e.TestParams.Ports.PrysmBeaconNodeRPCPort+index),
|
||||||
fmt.Sprintf("--%s=http://127.0.0.1:%d", flags.HTTPWeb3ProviderFlag.Name, e2e.TestParams.Ports.Eth1AuthRPCPort+index),
|
fmt.Sprintf("--%s=http://127.0.0.1:%d", flags.HTTPWeb3ProviderFlag.Name, eth1Port+index),
|
||||||
fmt.Sprintf("--%s=%s", flags.ExecutionJWTSecretFlag.Name, jwtPath),
|
fmt.Sprintf("--%s=%s", flags.ExecutionJWTSecretFlag.Name, jwtPath),
|
||||||
fmt.Sprintf("--%s=%d", flags.MinSyncPeers.Name, 1),
|
fmt.Sprintf("--%s=%d", flags.MinSyncPeers.Name, 1),
|
||||||
fmt.Sprintf("--%s=%d", cmdshared.P2PUDPPort.Name, e2e.TestParams.Ports.PrysmBeaconNodeUDPPort+index),
|
fmt.Sprintf("--%s=%d", cmdshared.P2PUDPPort.Name, e2e.TestParams.Ports.PrysmBeaconNodeUDPPort+index),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -26,6 +27,7 @@ import (
|
|||||||
"github.com/prysmaticlabs/prysm/testing/endtoend/helpers"
|
"github.com/prysmaticlabs/prysm/testing/endtoend/helpers"
|
||||||
e2e "github.com/prysmaticlabs/prysm/testing/endtoend/params"
|
e2e "github.com/prysmaticlabs/prysm/testing/endtoend/params"
|
||||||
e2etypes "github.com/prysmaticlabs/prysm/testing/endtoend/types"
|
e2etypes "github.com/prysmaticlabs/prysm/testing/endtoend/types"
|
||||||
|
proxy "github.com/prysmaticlabs/prysm/testing/middleware/engine-api-proxy"
|
||||||
"github.com/prysmaticlabs/prysm/testing/require"
|
"github.com/prysmaticlabs/prysm/testing/require"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
@@ -80,6 +82,21 @@ func (r *testRunner) run() {
|
|||||||
return tracingSink.Start(ctx)
|
return tracingSink.Start(ctx)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Creates an engine API proxy middleware for mocking certain responses between
|
||||||
|
// the beacon node and the execution client. This helps us simulate scenarios such as
|
||||||
|
// the execution client signaling Prysm that it is SYNCING, and therefore triggering optimistic sync
|
||||||
|
// in our end-to-end test suite.
|
||||||
|
engineProxyMiddleware, err := proxy.New(
|
||||||
|
proxy.WithHost("127.0.0.1"),
|
||||||
|
proxy.WithPort(e2e.TestParams.Ports.Eth1ProxyPort),
|
||||||
|
proxy.WithDestinationAddress("127.0.0.1:"+strconv.Itoa(e2e.TestParams.Ports.Eth1RPCPort)),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
g.Go(func() error {
|
||||||
|
return engineProxyMiddleware.Start(ctx)
|
||||||
|
})
|
||||||
if multiClientActive {
|
if multiClientActive {
|
||||||
keyGen = components.NewKeystoreGenerator()
|
keyGen = components.NewKeystoreGenerator()
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ type ports struct {
|
|||||||
BootNodeMetricsPort int
|
BootNodeMetricsPort int
|
||||||
Eth1Port int
|
Eth1Port int
|
||||||
Eth1RPCPort int
|
Eth1RPCPort int
|
||||||
|
Eth1ProxyPort int
|
||||||
Eth1AuthRPCPort int
|
Eth1AuthRPCPort int
|
||||||
Eth1WSPort int
|
Eth1WSPort int
|
||||||
PrysmBeaconNodeRPCPort int
|
PrysmBeaconNodeRPCPort int
|
||||||
@@ -86,6 +87,7 @@ const (
|
|||||||
Eth1RPCPort = Eth1Port + portSpan
|
Eth1RPCPort = Eth1Port + portSpan
|
||||||
Eth1WSPort = Eth1Port + 2*portSpan
|
Eth1WSPort = Eth1Port + 2*portSpan
|
||||||
Eth1AuthRPCPort = Eth1Port + 3*portSpan
|
Eth1AuthRPCPort = Eth1Port + 3*portSpan
|
||||||
|
Eth1ProxyPort = Eth1Port + 4*portSpan
|
||||||
|
|
||||||
PrysmBeaconNodeRPCPort = 4150
|
PrysmBeaconNodeRPCPort = 4150
|
||||||
PrysmBeaconNodeUDPPort = PrysmBeaconNodeRPCPort + portSpan
|
PrysmBeaconNodeUDPPort = PrysmBeaconNodeRPCPort + portSpan
|
||||||
@@ -233,6 +235,10 @@ func initializeStandardPorts(shardCount, shardIndex int, ports *ports, existingR
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
eth1ProxyPort, err := port(Eth1ProxyPort, shardCount, shardIndex, existingRegistrations)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
beaconNodeRPCPort, err := port(PrysmBeaconNodeRPCPort, shardCount, shardIndex, existingRegistrations)
|
beaconNodeRPCPort, err := port(PrysmBeaconNodeRPCPort, shardCount, shardIndex, existingRegistrations)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -274,6 +280,7 @@ func initializeStandardPorts(shardCount, shardIndex int, ports *ports, existingR
|
|||||||
ports.Eth1Port = eth1Port
|
ports.Eth1Port = eth1Port
|
||||||
ports.Eth1RPCPort = eth1RPCPort
|
ports.Eth1RPCPort = eth1RPCPort
|
||||||
ports.Eth1AuthRPCPort = eth1AuthPort
|
ports.Eth1AuthRPCPort = eth1AuthPort
|
||||||
|
ports.Eth1ProxyPort = eth1ProxyPort
|
||||||
ports.Eth1WSPort = eth1WSPort
|
ports.Eth1WSPort = eth1WSPort
|
||||||
ports.PrysmBeaconNodeRPCPort = beaconNodeRPCPort
|
ports.PrysmBeaconNodeRPCPort = beaconNodeRPCPort
|
||||||
ports.PrysmBeaconNodeUDPPort = beaconNodeUDPPort
|
ports.PrysmBeaconNodeUDPPort = beaconNodeUDPPort
|
||||||
|
|||||||
Reference in New Issue
Block a user