mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 12:10:05 +00:00
fix tests in //beacon-chain/rpc/beacon (#5559)
* assert new state is not disabled * Merge refs/heads/master into fix-list-indexed-atts-test * add helper method * Merge branch 'fix-list-indexed-atts-test' of github.com:prysmaticlabs/prysm into fix-list-indexed-atts-test * xx * xx * Merge refs/heads/master into fix-list-indexed-atts-test
This commit is contained in:
parent
8cba109350
commit
0f08bd288c
@ -610,6 +610,8 @@ func TestServer_ListIndexedAttestations_NewStateManagnmentDisabled(t *testing.T)
|
||||
func TestServer_ListIndexedAttestations_GenesisEpoch(t *testing.T) {
|
||||
params.OverrideBeaconConfig(params.MainnetConfig())
|
||||
defer params.OverrideBeaconConfig(params.MinimalSpecConfig())
|
||||
cfg := assertNewStateMgmtIsEnabled()
|
||||
defer featureconfig.Init(cfg)
|
||||
db := dbTest.SetupDB(t)
|
||||
defer dbTest.TeardownDB(t, db)
|
||||
helpers.ClearCache()
|
||||
@ -745,6 +747,8 @@ func TestServer_ListIndexedAttestations_GenesisEpoch(t *testing.T) {
|
||||
func TestServer_ListIndexedAttestations_OldEpoch(t *testing.T) {
|
||||
params.OverrideBeaconConfig(params.MainnetConfig())
|
||||
defer params.OverrideBeaconConfig(params.MinimalSpecConfig())
|
||||
cfg := assertNewStateMgmtIsEnabled()
|
||||
defer featureconfig.Init(cfg)
|
||||
db := dbTest.SetupDB(t)
|
||||
defer dbTest.TeardownDB(t, db)
|
||||
helpers.ClearCache()
|
||||
@ -1226,3 +1230,14 @@ func TestServer_StreamAttestations_OnSlotTick(t *testing.T) {
|
||||
}
|
||||
<-exitRoutine
|
||||
}
|
||||
|
||||
// assertNewStateMgmtIsEnabled asserts that state management feature is enabled.
|
||||
func assertNewStateMgmtIsEnabled() *featureconfig.Flags {
|
||||
cfg := featureconfig.Get()
|
||||
if cfg.DisableNewStateMgmt {
|
||||
cfgUpd := cfg.Copy()
|
||||
cfgUpd.DisableNewStateMgmt = false
|
||||
featureconfig.Init(cfgUpd)
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
@ -86,6 +86,45 @@ func Init(c *Flags) {
|
||||
featureConfig = c
|
||||
}
|
||||
|
||||
// Copy returns copy of the config object.
|
||||
func (c *Flags) Copy() *Flags {
|
||||
return &Flags{
|
||||
MinimalConfig: c.MinimalConfig,
|
||||
WriteSSZStateTransitions: c.WriteSSZStateTransitions,
|
||||
InitSyncNoVerify: c.InitSyncNoVerify,
|
||||
DisableDynamicCommitteeSubnets: c.DisableNewStateMgmt,
|
||||
SkipBLSVerify: c.SkipBLSVerify,
|
||||
EnableBackupWebhook: c.EnableStateRefCopy,
|
||||
PruneEpochBoundaryStates: c.PruneEpochBoundaryStates,
|
||||
EnableSnappyDBCompression: c.EnableSnappyDBCompression,
|
||||
ProtectProposer: c.ProtectProposer,
|
||||
ProtectAttester: c.ProtectAttester,
|
||||
DisableStrictAttestationPubsubVerification: c.DisableStrictAttestationPubsubVerification,
|
||||
DisableUpdateHeadPerAttestation: c.DisableUpdateHeadPerAttestation,
|
||||
EnableByteMempool: c.EnableByteMempool,
|
||||
EnableDomainDataCache: c.EnableDomainDataCache,
|
||||
EnableStateGenSigVerify: c.EnableStateGenSigVerify,
|
||||
CheckHeadState: c.CheckHeadState,
|
||||
EnableNoise: c.EnableNoise,
|
||||
DontPruneStateStartUp: c.DontPruneStateStartUp,
|
||||
DisableNewStateMgmt: c.DisableNewStateMgmt,
|
||||
DisableInitSyncQueue: c.DisableInitSyncQueue,
|
||||
EnableFieldTrie: c.EnableFieldTrie,
|
||||
EnableBlockHTR: c.EnableBlockHTR,
|
||||
NoInitSyncBatchSaveBlocks: c.NoInitSyncBatchSaveBlocks,
|
||||
EnableStateRefCopy: c.EnableStateRefCopy,
|
||||
WaitForSynced: c.WaitForSynced,
|
||||
DisableForkChoice: c.DisableForkChoice,
|
||||
BroadcastSlashings: c.BroadcastSlashings,
|
||||
EnableSSZCache: c.EnableSSZCache,
|
||||
EnableEth1DataVoteCache: c.EnableEth1DataVoteCache,
|
||||
EnableSlasherConnection: c.EnableSlasherConnection,
|
||||
EnableBlockTreeCache: c.EnableBlockTreeCache,
|
||||
KafkaBootstrapServers: c.KafkaBootstrapServers,
|
||||
CustomGenesisDelay: c.CustomGenesisDelay,
|
||||
}
|
||||
}
|
||||
|
||||
// ConfigureBeaconChain sets the global config based
|
||||
// on what flags are enabled for the beacon-chain client.
|
||||
func ConfigureBeaconChain(ctx *cli.Context) {
|
||||
|
Loading…
Reference in New Issue
Block a user