Compare commits

...

3 Commits

Author SHA1 Message Date
Raul Jordan
f4bd1678b0 Merge branch 'develop' into lateBlocksE2E 2022-07-27 21:08:34 +00:00
nisdas
7b07ad3083 change it up 2022-07-12 20:19:18 +08:00
nisdas
59cccedf33 add new scenario 2022-07-12 20:00:22 +08:00
3 changed files with 33 additions and 2 deletions

View File

@@ -42,6 +42,7 @@ test_suite(
)
common_deps = [
"//crypto/rand:go_default_library",
"//api/client/beacon:go_default_library",
"//beacon-chain/blockchain/testing:go_default_library",
"//beacon-chain/core/transition:go_default_library",

View File

@@ -15,6 +15,7 @@ import (
"time"
"github.com/prysmaticlabs/prysm/api/client/beacon"
"github.com/prysmaticlabs/prysm/crypto/rand"
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/io/file"
enginev1 "github.com/prysmaticlabs/prysm/proto/engine/v1"
@@ -665,6 +666,9 @@ func (r *testRunner) eeOffline(epoch uint64, _ []*grpc.ClientConn) bool {
// After the proxy has been sending `SYNCING` responses to the beacon node, we
// will test this with our optimistic sync evaluator to ensure everything works
// as expected.
// 4) We then start testing late blocks being proposed in the network. This is done via
// our engine proxy, which would sleep for a random amount of time for our get payload
// requests.
func (r *testRunner) multiScenario(epoch uint64, conns []*grpc.ClientConn) bool {
switch epoch {
case 9:
@@ -708,7 +712,33 @@ func (r *testRunner) multiScenario(epoch uint64, conns []*grpc.ClientConn) bool
engineProxy.ReleaseBackedUpRequests("engine_newPayloadV1")
return true
case 11, 12, 16, 17, 21, 22:
case 24:
component, err := r.comHandler.eth1Proxy.ComponentAtIndex(0)
require.NoError(r.t, err)
component.(e2etypes.EngineProxy).AddRequestInterceptor("engine_getPayloadV1", func() interface{} {
return nil
}, func() bool {
// Have a random delay which is triggered here.
gen := rand.NewDeterministicGenerator()
genNum := gen.Int63()
randFactor := ((time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second) * 1) / 12
randomDelay := time.Duration(genNum) % randFactor
fixedDelay := ((time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second) * 11) / 12
timeToSleep := fixedDelay + randomDelay
time.Sleep(timeToSleep)
return false
})
return true
case 26:
// Disable Interceptor
component, err := r.comHandler.eth1Proxy.ComponentAtIndex(0)
require.NoError(r.t, err)
engineProxy, ok := component.(e2etypes.EngineProxy)
require.Equal(r.t, true, ok)
engineProxy.RemoveRequestInterceptor("engine_getPayloadV1")
return true
case 11, 12, 16, 17, 21, 22, 25, 27, 28:
// Allow 2 epochs for the network to finalize again.
return true
}

View File

@@ -7,7 +7,7 @@ import (
)
func TestEndToEnd_MultiScenarioRun(t *testing.T) {
runner := e2eMinimal(t, types.WithEpochs(22))
runner := e2eMinimal(t, types.WithEpochs(29))
runner.config.Evaluators = scenarioEvals()
runner.config.EvalInterceptor = runner.multiScenario