mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
36e4f49af0
* defensive nil check * separate ExecutionPayload/Header from codegen * tell bazel about this new file * Merge: support terminal difficulty override (#9769) * Fix finding terminal block hash calculation * Update mainnet_config.go * Update beacon_block.pb.go * Various fixes to pass all spec tests for Merge (#9777) * Proper upgrade altair to merge state * Use uint64 for ttd * Correctly upgrade to merge state + object mapping fixes * Use proper receive block path for initial syncing * Disable contract lookback * Disable deposit contract lookback * Go fmt * Merge: switch from go bindings to raw rpc calls (#9803) * Disable genesis ETH1.0 chain header logging * Update htrutils.go * all gossip tests passing * Remove gas validations * Update penalty params for Merge * Fix gossip and tx size limits for the merge part 1 * Remove extraneous p2p condition * Add and use * Add and use TBH_ACTIVATION_EPOCH * Update WORKSPACE * Update Kintsugi engine API (#9865) * Kintsugi ssz (#9867) * All spec tests pass * Update spec test shas * Update Kintsugi consensus implementations (#9872) * Remove secp256k1 * Remove unused merge genesis state gen tool * Manually override nil transaction field. M2 works * Fix bad hex conversion * Change Gossip message size and Chunk SIze from 1 MB t0 10MB (#9860) * change gossip size and chunk size after merge * change ssz to accomodate both changes * gofmt config file * add testcase for merge MsgId * Update beacon-chain/p2p/message_id.go Change MB to Mib in comment Co-authored-by: terence tsao <terence@prysmaticlabs.com> * change function name from altairMsgID to postAltairMsgID Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Sync with develop * Merge branch 'develop' of github.com:prysmaticlabs/prysm into kintsugi * Update state_trie.go * Clean up conflicts * Fix build * Update config to devnet1 * Fix state merge * Handle merge test case for update balance * Fix build * State pkg cleanup * Fix a bug with loading mainnet state * Fix transactions root * Add v2 endpoint for merge blocks (#9802) * Add V2 blocks endpoint for merge blocks * Update beacon-chain/rpc/apimiddleware/structs.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * go mod * fix transactions * Terence's comments * add missing file Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Sync * Go mod tidy * change EP field names * latest kintusgi execution api * fix conflicts * converting base fee to big endian format (#10018) * ReverseByteOrder function does not mess the input * sync with develop * use merge gossip sizes * correct gossip sizes this time * visibility * clean ups * Sync with develop, fix payload nil check bug * Speed up syncing, hide cosmetic errors * Sync with develop * Clean up after sync * Update generate_keys.go * sync with develop * Update mainnet_config.go * Clean ups * Sync optimistically candidate blocks (#10193) * Revert "Sync optimistically candidate blocks (#10193)" This reverts commit f99a0419ef1efc4bda0be77f22165b8fe4377c0d. * Sync optimistically candidate blocks (#10193) * allow optimistic sync * Fix merge transition block validation * Update proposer.go * Sync with develop * delete deprecated client, update testnet flag * Change optimistic logic (#10194) * Logs and err handling * Fix build * Clean ups * Add back get payload * c * Done * Rm uncommented * Optimistic sync: prysm validator rpcs (#10200) * Logs to reproduce * Use pointers * Use pointers * Use pointers * Update json_marshal_unmarshal.go * Fix marshal * Update json_marshal_unmarshal.go * Log * string total diff * str * marshal un * set string * json * gaz * Comment out optimistic status * remove kiln flag here (#10269) * Sync with devleop * Sync with develop * clean ups * refactor engine calls * Update process_block.go * Fix deadlock, uncomment duty opt sync * Update proposer_execution_payload.go * Sync with develop * Rm post state check * Bypass eth1 data checks * Update proposer_execution_payload.go * Return early if ttd is not reached * Sync with devleop * Update process_block.go * Update receive_block.go * Update bzl * Revert "Update receive_block.go" This reverts commit 5b4a87c512325d9f26de4db7f941dcd7303cd0d8. * Fix run time * add in all the fixes * fix evaluator bugs * latest fixes * sum * fix to be configurable * Update go.mod * Fix AltairCompatible to account for future state version * Update proposer_execution_payload.go * fix broken conditional checks * fix all issues * Handle pre state Altair with valid payload * Handle pre state Altair with valid payload * Log bellatrix fields * Update log.go * Revert "fix broken conditional checks" This reverts commit e118db6c20172783a3bb573d2f78670f0207ec1e. * LH multiclient working * Friendly fee recipient log * Remove extra SetOptimisticToValid * fix race * fix test * Fix base fee per gas * Fix notifypayload headroot * tx fuzzer * clean up with develop branch * save progress * 200tx/block * add LH flags * Sync with devleop * cleanup * cleanup * hash * fix build * fix test * fix go check * fmt * gosec * Blocked stream (cherry picked from commit f362af9862db680b6352692217ad5c08d44a1e86) # Conflicts: # proto/prysm/v1alpha1/validator.pb.go * remove duplicate param * test * revert some test changes * Initial version of EE tx count * evaluate all txs in epoch * remove logs * uncomment tests * remove unwanted change * parameterize ExpectedExecEngineTxsThreshold Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: Zahoor Mohamed <zahoor@zahoor.in> Co-authored-by: kasey <489222+kasey@users.noreply.github.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com> Co-authored-by: Zahoor Mohamed <zahoor@prysmaticlabs.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
308 lines
10 KiB
Go
308 lines
10 KiB
Go
// Package params defines all custom parameter configurations
|
|
// for running end to end tests.
|
|
package params
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strconv"
|
|
|
|
"github.com/bazelbuild/rules_go/go/tools/bazel"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
)
|
|
|
|
// params struct defines the parameters needed for running E2E tests to properly handle test sharding.
|
|
type params struct {
|
|
TestPath string
|
|
LogPath string
|
|
TestShardIndex int
|
|
BeaconNodeCount int
|
|
LighthouseBeaconNodeCount int
|
|
ContractAddress common.Address
|
|
Ports *ports
|
|
}
|
|
|
|
type ports struct {
|
|
BootNodePort int
|
|
BootNodeMetricsPort int
|
|
Eth1Port int
|
|
Eth1RPCPort int
|
|
Eth1AuthRPCPort int
|
|
Eth1WSPort int
|
|
PrysmBeaconNodeRPCPort int
|
|
PrysmBeaconNodeUDPPort int
|
|
PrysmBeaconNodeTCPPort int
|
|
PrysmBeaconNodeGatewayPort int
|
|
PrysmBeaconNodeMetricsPort int
|
|
PrysmBeaconNodePprofPort int
|
|
LighthouseBeaconNodeP2PPort int
|
|
LighthouseBeaconNodeHTTPPort int
|
|
LighthouseBeaconNodeMetricsPort int
|
|
ValidatorMetricsPort int
|
|
ValidatorGatewayPort int
|
|
JaegerTracingPort int
|
|
}
|
|
|
|
// TestParams is the globally accessible var for getting config elements.
|
|
var TestParams *params
|
|
|
|
// BootNodeLogFileName is the file name used for the beacon chain node logs.
|
|
var BootNodeLogFileName = "bootnode.log"
|
|
|
|
// TracingRequestSinkFileName is the file name for writing raw trace requests.
|
|
var TracingRequestSinkFileName = "tracing-http-requests.log.gz"
|
|
|
|
// BeaconNodeLogFileName is the file name used for the beacon chain node logs.
|
|
var BeaconNodeLogFileName = "beacon-%d.log"
|
|
|
|
// ValidatorLogFileName is the file name used for the validator client logs.
|
|
var ValidatorLogFileName = "vals-%d.log"
|
|
|
|
// StandardBeaconCount is a global constant for the count of beacon nodes of standard E2E tests.
|
|
var StandardBeaconCount = 2
|
|
|
|
// StandardLighthouseNodeCount is a global constant for the count of lighthouse beacon nodes of standard E2E tests.
|
|
var StandardLighthouseNodeCount = 2
|
|
|
|
// DepositCount is the amount of deposits E2E makes on a separate validator client.
|
|
var DepositCount = uint64(64)
|
|
|
|
// NumOfExecEngineTxs is the number of transaction sent to the execution engine.
|
|
var NumOfExecEngineTxs = uint64(200)
|
|
|
|
// ExpectedExecEngineTxsThreshold is the portion of execution engine transactions we expect to find in blocks.
|
|
var ExpectedExecEngineTxsThreshold = 0.7
|
|
|
|
// Base port values.
|
|
const (
|
|
portSpan = 50
|
|
|
|
BootNodePort = 2150
|
|
BootNodeMetricsPort = BootNodePort + portSpan
|
|
|
|
Eth1Port = 3150
|
|
Eth1RPCPort = Eth1Port + portSpan
|
|
Eth1WSPort = Eth1Port + 2*portSpan
|
|
Eth1AuthRPCPort = Eth1Port + 3*portSpan
|
|
|
|
PrysmBeaconNodeRPCPort = 4150
|
|
PrysmBeaconNodeUDPPort = PrysmBeaconNodeRPCPort + portSpan
|
|
PrysmBeaconNodeTCPPort = PrysmBeaconNodeRPCPort + 2*portSpan
|
|
PrysmBeaconNodeGatewayPort = PrysmBeaconNodeRPCPort + 3*portSpan
|
|
PrysmBeaconNodeMetricsPort = PrysmBeaconNodeRPCPort + 4*portSpan
|
|
PrysmBeaconNodePprofPort = PrysmBeaconNodeRPCPort + 5*portSpan
|
|
|
|
LighthouseBeaconNodeP2PPort = 5150
|
|
LighthouseBeaconNodeHTTPPort = LighthouseBeaconNodeP2PPort + portSpan
|
|
LighthouseBeaconNodeMetricsPort = LighthouseBeaconNodeP2PPort + 2*portSpan
|
|
|
|
ValidatorGatewayPort = 6150
|
|
ValidatorMetricsPort = ValidatorGatewayPort + portSpan
|
|
|
|
JaegerTracingPort = 9150
|
|
)
|
|
|
|
// Init initializes the E2E config, properly handling test sharding.
|
|
func Init(beaconNodeCount int) error {
|
|
testPath := bazel.TestTmpDir()
|
|
logPath, ok := os.LookupEnv("TEST_UNDECLARED_OUTPUTS_DIR")
|
|
if !ok {
|
|
return errors.New("expected TEST_UNDECLARED_OUTPUTS_DIR to be defined")
|
|
}
|
|
testTotalShardsStr, ok := os.LookupEnv("TEST_TOTAL_SHARDS")
|
|
if !ok {
|
|
testTotalShardsStr = "1"
|
|
}
|
|
testTotalShards, err := strconv.Atoi(testTotalShardsStr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
testShardIndexStr, ok := os.LookupEnv("TEST_SHARD_INDEX")
|
|
if !ok {
|
|
testShardIndexStr = "0"
|
|
}
|
|
testShardIndex, err := strconv.Atoi(testShardIndexStr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
var existingRegistrations []int
|
|
testPorts := &ports{}
|
|
err = initializeStandardPorts(testTotalShards, testShardIndex, testPorts, &existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
TestParams = ¶ms{
|
|
TestPath: filepath.Join(testPath, fmt.Sprintf("shard-%d", testShardIndex)),
|
|
LogPath: logPath,
|
|
TestShardIndex: testShardIndex,
|
|
BeaconNodeCount: beaconNodeCount,
|
|
Ports: testPorts,
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// InitMultiClient initializes the multiclient E2E config, properly handling test sharding.
|
|
func InitMultiClient(beaconNodeCount int, lighthouseNodeCount int) error {
|
|
testPath := bazel.TestTmpDir()
|
|
logPath, ok := os.LookupEnv("TEST_UNDECLARED_OUTPUTS_DIR")
|
|
if !ok {
|
|
return errors.New("expected TEST_UNDECLARED_OUTPUTS_DIR to be defined")
|
|
}
|
|
testTotalShardsStr, ok := os.LookupEnv("TEST_TOTAL_SHARDS")
|
|
if !ok {
|
|
testTotalShardsStr = "1"
|
|
}
|
|
testTotalShards, err := strconv.Atoi(testTotalShardsStr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
testShardIndexStr, ok := os.LookupEnv("TEST_SHARD_INDEX")
|
|
if !ok {
|
|
testShardIndexStr = "0"
|
|
}
|
|
testShardIndex, err := strconv.Atoi(testShardIndexStr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
var existingRegistrations []int
|
|
testPorts := &ports{}
|
|
err = initializeStandardPorts(testTotalShards, testShardIndex, testPorts, &existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = initializeMulticlientPorts(testTotalShards, testShardIndex, testPorts, &existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
TestParams = ¶ms{
|
|
TestPath: filepath.Join(testPath, fmt.Sprintf("shard-%d", testShardIndex)),
|
|
LogPath: logPath,
|
|
TestShardIndex: testShardIndex,
|
|
BeaconNodeCount: beaconNodeCount,
|
|
LighthouseBeaconNodeCount: lighthouseNodeCount,
|
|
Ports: testPorts,
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// port returns a safe port number based on the seed and shard data.
|
|
func port(seed, shardCount, shardIndex int, existingRegistrations *[]int) (int, error) {
|
|
portToRegister := seed + portSpan/shardCount*shardIndex
|
|
for _, p := range *existingRegistrations {
|
|
if portToRegister >= p && portToRegister <= p+(portSpan/shardCount)-1 {
|
|
return 0, fmt.Errorf("port %d overlaps with already registered port %d", seed, p)
|
|
}
|
|
}
|
|
*existingRegistrations = append(*existingRegistrations, portToRegister)
|
|
|
|
// Calculation example: 3 shards, seed 2000, port span 50.
|
|
// Shard 0: 2000 + (50 / 3 * 0) = 2000 (we can safely use ports 2000-2015)
|
|
// Shard 1: 2000 + (50 / 3 * 1) = 2016 (we can safely use ports 2016-2031)
|
|
// Shard 2: 2000 + (50 / 3 * 2) = 2032 (we can safely use ports 2032-2047, and in reality 2032-2049)
|
|
return portToRegister, nil
|
|
}
|
|
|
|
func initializeStandardPorts(shardCount, shardIndex int, ports *ports, existingRegistrations *[]int) error {
|
|
bootnodePort, err := port(BootNodePort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
bootnodeMetricsPort, err := port(BootNodeMetricsPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
eth1Port, err := port(Eth1Port, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
eth1RPCPort, err := port(Eth1RPCPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
eth1WSPort, err := port(Eth1WSPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
eth1AuthPort, err := port(Eth1AuthRPCPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
beaconNodeRPCPort, err := port(PrysmBeaconNodeRPCPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
beaconNodeUDPPort, err := port(PrysmBeaconNodeUDPPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
beaconNodeTCPPort, err := port(PrysmBeaconNodeTCPPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
beaconNodeGatewayPort, err := port(PrysmBeaconNodeGatewayPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
beaconNodeMetricsPort, err := port(PrysmBeaconNodeMetricsPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
beaconNodePprofPort, err := port(PrysmBeaconNodePprofPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
validatorGatewayPort, err := port(ValidatorGatewayPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
validatorMetricsPort, err := port(ValidatorMetricsPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
jaegerTracingPort, err := port(JaegerTracingPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
ports.BootNodePort = bootnodePort
|
|
ports.BootNodeMetricsPort = bootnodeMetricsPort
|
|
ports.Eth1Port = eth1Port
|
|
ports.Eth1RPCPort = eth1RPCPort
|
|
ports.Eth1AuthRPCPort = eth1AuthPort
|
|
ports.Eth1WSPort = eth1WSPort
|
|
ports.PrysmBeaconNodeRPCPort = beaconNodeRPCPort
|
|
ports.PrysmBeaconNodeUDPPort = beaconNodeUDPPort
|
|
ports.PrysmBeaconNodeTCPPort = beaconNodeTCPPort
|
|
ports.PrysmBeaconNodeGatewayPort = beaconNodeGatewayPort
|
|
ports.PrysmBeaconNodeMetricsPort = beaconNodeMetricsPort
|
|
ports.PrysmBeaconNodePprofPort = beaconNodePprofPort
|
|
ports.ValidatorMetricsPort = validatorMetricsPort
|
|
ports.ValidatorGatewayPort = validatorGatewayPort
|
|
ports.JaegerTracingPort = jaegerTracingPort
|
|
return nil
|
|
}
|
|
|
|
func initializeMulticlientPorts(shardCount, shardIndex int, ports *ports, existingRegistrations *[]int) error {
|
|
lighthouseBeaconNodeP2PPort, err := port(LighthouseBeaconNodeP2PPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
lighthouseBeaconNodeHTTPPort, err := port(LighthouseBeaconNodeHTTPPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
lighthouseBeaconNodeMetricsPort, err := port(LighthouseBeaconNodeMetricsPort, shardCount, shardIndex, existingRegistrations)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
ports.LighthouseBeaconNodeP2PPort = lighthouseBeaconNodeP2PPort
|
|
ports.LighthouseBeaconNodeHTTPPort = lighthouseBeaconNodeHTTPPort
|
|
ports.LighthouseBeaconNodeMetricsPort = lighthouseBeaconNodeMetricsPort
|
|
return nil
|
|
}
|