Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass E2E Tests for v0.11 and Enable Attestation Subnets By Default #5407

Merged
merged 9 commits into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions beacon-chain/p2p/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ var _ = shared.Service(&Service{})
// Check local table every 5 seconds for newly added peers.
var pollingPeriod = 5 * time.Second

// Refresh rate of ENR set at every quarter of an epoch.
var refreshRate = time.Duration((params.BeaconConfig().SecondsPerSlot*
params.BeaconConfig().SlotsPerEpoch)/4) * time.Second
// Refresh rate of ENR set at twice per slot.
var refreshRate = time.Duration(params.BeaconConfig().SecondsPerSlot/2) * time.Second

// search limit for number of peers in discovery v5.
const searchLimit = 100
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/sync/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ go_test(
"//shared/attestationutil:go_default_library",
"//shared/bls:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"//shared/roughtime:go_default_library",
"//shared/testutil:go_default_library",
Expand Down
10 changes: 5 additions & 5 deletions beacon-chain/sync/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
pubsub "github.com/libp2p/go-libp2p-pubsub"
pb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
"go.opencensus.io/trace"
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/prysmaticlabs/prysm/shared/roughtime"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
"go.opencensus.io/trace"
)

const pubsubMessageTimeout = 30 * time.Second
Expand Down Expand Up @@ -96,16 +96,16 @@ func (r *Service) registerSubscribers() {
r.validateAttesterSlashing,
r.attesterSlashingSubscriber,
)
if featureconfig.Get().EnableDynamicCommitteeSubnets {
r.subscribeDynamicWithSubnets(
if featureconfig.Get().DisableDynamicCommitteeSubnets {
r.subscribeDynamic(
"/eth2/%x/committee_index%d_beacon_attestation",
r.committeesCount, /* determineSubsLen */
r.validateCommitteeIndexBeaconAttestation, /* validator */
r.committeeIndexBeaconAttestationSubscriber, /* message handler */
)
} else {
r.subscribeDynamic(
r.subscribeDynamicWithSubnets(
"/eth2/%x/committee_index%d_beacon_attestation",
r.committeesCount, /* determineSubsLen */
r.validateCommitteeIndexBeaconAttestation, /* validator */
r.committeeIndexBeaconAttestationSubscriber, /* message handler */
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations"
p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing"
mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/prysmaticlabs/prysm/shared/testutil"
)

func TestService_committeeIndexBeaconAttestationSubscriber_ValidMessage(t *testing.T) {
p := p2ptest.NewTestP2P(t)
fc := featureconfig.Get()
fc.DisableDynamicCommitteeSubnets = true
featureconfig.Init(fc)

ctx := context.Background()
db := dbtest.SetupDB(t)
Expand Down
1 change: 1 addition & 0 deletions endtoend/components/beacon_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func StartNewBeaconNode(t *testing.T, config *types.E2EConfig, index int, enr st
fmt.Sprintf("--rpc-max-page-size=%d", params.BeaconConfig().MinGenesisActiveValidatorCount),
"--force-clear-db",
fmt.Sprintf("--bootstrap-node=%s", enr),
"--verbosity=debug",
}
args = append(args, featureconfig.E2EBeaconChainFlags...)
args = append(args, config.BeaconFlags...)
Expand Down
8 changes: 4 additions & 4 deletions shared/featureconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Flags struct {
MinimalConfig bool // MinimalConfig as defined in the spec.
WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory.
InitSyncNoVerify bool // InitSyncNoVerify when initial syncing w/o verifying block's contents.
EnableDynamicCommitteeSubnets bool // Enables dynamic attestation committee subnets via p2p.
DisableDynamicCommitteeSubnets bool // Disables dynamic attestation committee subnets via p2p.
SkipBLSVerify bool // Skips BLS verification across the runtime.
EnableBackupWebhook bool // EnableBackupWebhook to allow database backups to trigger from monitoring port /db/backup.
PruneEpochBoundaryStates bool // PruneEpochBoundaryStates prunes the epoch boundary state before last finalized check point.
Expand Down Expand Up @@ -104,9 +104,9 @@ func ConfigureBeaconChain(ctx *cli.Context) {
log.Warn("UNSAFE: Disabled fork choice for updating chain head")
cfg.DisableForkChoice = true
}
if ctx.Bool(enableDynamicCommitteeSubnets.Name) {
log.Warn("Enabled dynamic attestation committee subnets")
cfg.EnableDynamicCommitteeSubnets = true
if ctx.Bool(disableDynamicCommitteeSubnets.Name) {
log.Warn("Disabled dynamic attestation committee subnets")
cfg.DisableDynamicCommitteeSubnets = true
}
cfg.EnableSSZCache = true
if ctx.Bool(disableSSZCache.Name) {
Expand Down
16 changes: 10 additions & 6 deletions shared/featureconfig/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ var (
Name: "interop-write-ssz-state-transitions",
Usage: "Write ssz states to disk after attempted state transition",
}
enableDynamicCommitteeSubnets = &cli.BoolFlag{
Name: "enable-dynamic-committee-subnets",
Usage: "Enable dynamic committee attestation subnets.",
disableDynamicCommitteeSubnets = &cli.BoolFlag{
Name: "disable-dynamic-committee-subnets",
Usage: "Disable dynamic committee attestation subnets.",
}
// disableForkChoiceUnsafeFlag disables using the LMD-GHOST fork choice to update
// the head of the chain based on attestations and instead accepts any valid received block
Expand Down Expand Up @@ -142,6 +142,11 @@ var (
const deprecatedUsage = "DEPRECATED. DO NOT USE."

var (
deprecatedEnableDynamicCommitteeSubnets = &cli.BoolFlag{
Name: "enable-dynamic-committee-subnets",
Usage: deprecatedUsage,
Hidden: true,
}
deprecatedNoCustomConfigFlag = &cli.BoolFlag{
Name: "no-custom-config",
Usage: deprecatedUsage,
Expand Down Expand Up @@ -286,6 +291,7 @@ var (
)

var deprecatedFlags = []cli.Flag{
deprecatedEnableDynamicCommitteeSubnets,
deprecatedNoCustomConfigFlag,
deprecatedEnableInitSyncQueue,
deprecatedEnableFinalizedBlockRootIndexFlag,
Expand Down Expand Up @@ -335,7 +341,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
minimalConfigFlag,
writeSSZStateTransitionsFlag,
disableForkChoiceUnsafeFlag,
enableDynamicCommitteeSubnets,
disableDynamicCommitteeSubnets,
disableSSZCache,
enableEth1DataVoteCacheFlag,
initSyncVerifyEverythingFlag,
Expand Down Expand Up @@ -367,6 +373,4 @@ var E2EBeaconChainFlags = []string{
"--enable-state-gen-sig-verify",
"--check-head-state",
"--enable-state-field-trie",
// TODO(5123): This flag currently fails E2E. Commenting until it's resolved.
//"--enable-dynamic-committee-subnets",
}