Skip to content

Commit

Permalink
Remove WithoutBridge configuration param from e2e framework (#1919)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Sep 25, 2023
1 parent 9c9af49 commit 5f6ba3e
Showing 1 changed file with 27 additions and 36 deletions.
63 changes: 27 additions & 36 deletions e2e-polybft/framework/test-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ type TestClusterConfig struct {
Premine []string // address[:amount]
PremineValidators []string // address[:amount]
StakeAmounts []*big.Int
WithoutBridge bool
BootnodeCount int
NonValidatorCount int
WithLogs bool
Expand Down Expand Up @@ -209,12 +208,6 @@ func WithSecretsCallback(fn func([]types.Address, *TestClusterConfig)) ClusterOp
}
}

func WithoutBridge() ClusterOption {
return func(h *TestClusterConfig) {
h.WithoutBridge = true
}
}

func WithNonValidators(num int) ClusterOption {
return func(h *TestClusterConfig) {
h.NonValidatorCount = num
Expand Down Expand Up @@ -586,47 +579,45 @@ func NewTestCluster(t *testing.T, validatorsCount int, opts ...ClusterOption) *T
require.NoError(t, err)
}

if !cluster.Config.WithoutBridge {
// start bridge
cluster.Bridge, err = NewTestBridge(t, cluster.Config)
require.NoError(t, err)
// start bridge
cluster.Bridge, err = NewTestBridge(t, cluster.Config)
require.NoError(t, err)

// deploy stake manager contract
err := cluster.Bridge.deployStakeManager(genesisPath)
require.NoError(t, err)
// deploy stake manager contract
err = cluster.Bridge.deployStakeManager(genesisPath)
require.NoError(t, err)

// deploy rootchain contracts
err = cluster.Bridge.deployRootchainContracts(genesisPath)
require.NoError(t, err)
// deploy rootchain contracts
err = cluster.Bridge.deployRootchainContracts(genesisPath)
require.NoError(t, err)

polybftConfig, err := polybft.LoadPolyBFTConfig(genesisPath)
require.NoError(t, err)
polybftConfig, err := polybft.LoadPolyBFTConfig(genesisPath)
require.NoError(t, err)

// fund validators on the rootchain
err = cluster.Bridge.fundRootchainValidators(polybftConfig)
require.NoError(t, err)
// fund validators on the rootchain
err = cluster.Bridge.fundRootchainValidators(polybftConfig)
require.NoError(t, err)

// whitelist genesis validators on the rootchain
err = cluster.Bridge.whitelistValidators(addresses, polybftConfig)
require.NoError(t, err)
// whitelist genesis validators on the rootchain
err = cluster.Bridge.whitelistValidators(addresses, polybftConfig)
require.NoError(t, err)

// register genesis validators on the rootchain
err = cluster.Bridge.registerGenesisValidators(polybftConfig)
require.NoError(t, err)
// register genesis validators on the rootchain
err = cluster.Bridge.registerGenesisValidators(polybftConfig)
require.NoError(t, err)

// do initial staking for genesis validators on the rootchain
err = cluster.Bridge.initialStakingOfGenesisValidators(polybftConfig)
require.NoError(t, err)
// do initial staking for genesis validators on the rootchain
err = cluster.Bridge.initialStakingOfGenesisValidators(polybftConfig)
require.NoError(t, err)

// finalize genesis validators on the rootchain
err = cluster.Bridge.finalizeGenesis(genesisPath, polybftConfig)
require.NoError(t, err)
}
// finalize genesis validators on the rootchain
err = cluster.Bridge.finalizeGenesis(genesisPath, polybftConfig)
require.NoError(t, err)

for i := 1; i <= int(cluster.Config.ValidatorSetSize); i++ {
dir := cluster.Config.ValidatorPrefix + strconv.Itoa(i)
cluster.InitTestServer(t, dir, cluster.Bridge.JSONRPCAddr(),
true, !cluster.Config.WithoutBridge && i == 1 /* relayer */)
true, i == 1 /* relayer */)
}

for i := 1; i <= cluster.Config.NonValidatorCount; i++ {
Expand Down

0 comments on commit 5f6ba3e

Please sign in to comment.