Skip to content
Closed
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: 5 additions & 0 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
# SyncProcessTimeSupernovaInMillis is the value in milliseconds used when processing blocks while synchronizing blocks after Supernova
SyncProcessTimeSupernovaInMillis = 6000

# MaxNumOfRequestsForHeaderProof represents how many times the sync process will request the proof
# for a header already cached in the pool before evicting that header. Eviction allows the next
# sync iteration to fetch a fresh header+proof pair by nonce
MaxNumOfRequestsForHeaderProof = 10

# SetGuardianEpochsDelay represents the delay in epochs between the execution time of the SetGuardian transaction and
# the activation of the configured guardian.
# Make sure that this is greater than the unbonding period!
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ type GeneralSettingsConfig struct {
GenesisMaxNumberOfShards uint32
SyncProcessTimeInMillis uint32
SyncProcessTimeSupernovaInMillis uint32
MaxNumOfRequestsForHeaderProof uint32
SetGuardianEpochsDelay uint32
MaxProposalNonceGap uint64
ChainParametersByEpoch []ChainParametersByEpochConfig
Expand Down
130 changes: 66 additions & 64 deletions factory/consensus/consensusComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,38 +498,39 @@ func (ccf *consensusComponentsFactory) createShardBootstrapper() (process.Bootst
}

argsBaseBootstrapper := sync.ArgBaseBootstrapper{
PoolsHolder: ccf.dataComponents.Datapool(),
Store: ccf.dataComponents.StorageService(),
ChainHandler: ccf.dataComponents.Blockchain(),
RoundHandler: ccf.processComponents.RoundHandler(),
BlockProcessor: ccf.processComponents.BlockProcessor(),
Hasher: ccf.coreComponents.Hasher(),
Marshalizer: ccf.coreComponents.InternalMarshalizer(),
ForkDetector: ccf.processComponents.ForkDetector(),
RequestHandler: ccf.processComponents.RequestHandler(),
ShardCoordinator: ccf.processComponents.ShardCoordinator(),
Accounts: ccf.stateComponents.AccountsAdapter(),
BlackListHandler: ccf.processComponents.BlackListHandler(),
NetworkWatcher: ccf.networkComponents.NetworkMessenger(),
BootStorer: ccf.processComponents.BootStorer(),
StorageBootstrapper: shardStorageBootstrapper,
EpochHandler: ccf.processComponents.EpochStartTrigger(),
MiniblocksProvider: ccf.dataComponents.MiniBlocksProvider(),
Uint64Converter: ccf.coreComponents.Uint64ByteSliceConverter(),
AppStatusHandler: ccf.statusCoreComponents.AppStatusHandler(),
OutportHandler: ccf.statusComponents.OutportHandler(),
AccountsDBSyncer: accountsDBSyncer,
CurrentEpochProvider: ccf.processComponents.CurrentEpochProvider(),
IsInImportMode: ccf.isInImportMode,
HistoryRepo: ccf.processComponents.HistoryRepository(),
ScheduledTxsExecutionHandler: ccf.processComponents.ScheduledTxsExecutionHandler(),
ProcessWaitTime: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeInMillis) * time.Millisecond,
ProcessWaitTimeSupernova: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeSupernovaInMillis) * time.Millisecond,
RepopulateTokensSupplies: ccf.flagsConfig.RepopulateTokensSupplies,
EnableEpochsHandler: ccf.coreComponents.EnableEpochsHandler(),
ExecutionManager: ccf.processComponents.ExecutionManager(),
EnableRoundsHandler: ccf.coreComponents.EnableRoundsHandler(),
ProcessConfigsHandler: ccf.coreComponents.ProcessConfigsHandler(),
PoolsHolder: ccf.dataComponents.Datapool(),
Store: ccf.dataComponents.StorageService(),
ChainHandler: ccf.dataComponents.Blockchain(),
RoundHandler: ccf.processComponents.RoundHandler(),
BlockProcessor: ccf.processComponents.BlockProcessor(),
Hasher: ccf.coreComponents.Hasher(),
Marshalizer: ccf.coreComponents.InternalMarshalizer(),
ForkDetector: ccf.processComponents.ForkDetector(),
RequestHandler: ccf.processComponents.RequestHandler(),
ShardCoordinator: ccf.processComponents.ShardCoordinator(),
Accounts: ccf.stateComponents.AccountsAdapter(),
BlackListHandler: ccf.processComponents.BlackListHandler(),
NetworkWatcher: ccf.networkComponents.NetworkMessenger(),
BootStorer: ccf.processComponents.BootStorer(),
StorageBootstrapper: shardStorageBootstrapper,
EpochHandler: ccf.processComponents.EpochStartTrigger(),
MiniblocksProvider: ccf.dataComponents.MiniBlocksProvider(),
Uint64Converter: ccf.coreComponents.Uint64ByteSliceConverter(),
AppStatusHandler: ccf.statusCoreComponents.AppStatusHandler(),
OutportHandler: ccf.statusComponents.OutportHandler(),
AccountsDBSyncer: accountsDBSyncer,
CurrentEpochProvider: ccf.processComponents.CurrentEpochProvider(),
IsInImportMode: ccf.isInImportMode,
HistoryRepo: ccf.processComponents.HistoryRepository(),
ScheduledTxsExecutionHandler: ccf.processComponents.ScheduledTxsExecutionHandler(),
ProcessWaitTime: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeInMillis) * time.Millisecond,
ProcessWaitTimeSupernova: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeSupernovaInMillis) * time.Millisecond,
MaxNumOfRequestsForHeaderProof: ccf.config.GeneralSettings.MaxNumOfRequestsForHeaderProof,
RepopulateTokensSupplies: ccf.flagsConfig.RepopulateTokensSupplies,
EnableEpochsHandler: ccf.coreComponents.EnableEpochsHandler(),
ExecutionManager: ccf.processComponents.ExecutionManager(),
EnableRoundsHandler: ccf.coreComponents.EnableRoundsHandler(),
ProcessConfigsHandler: ccf.coreComponents.ProcessConfigsHandler(),
}

argsShardBootstrapper := sync.ArgShardBootstrapper{
Expand Down Expand Up @@ -635,38 +636,39 @@ func (ccf *consensusComponentsFactory) createMetaChainBootstrapper() (process.Bo
}

argsBaseBootstrapper := sync.ArgBaseBootstrapper{
PoolsHolder: ccf.dataComponents.Datapool(),
Store: ccf.dataComponents.StorageService(),
ChainHandler: ccf.dataComponents.Blockchain(),
RoundHandler: ccf.processComponents.RoundHandler(),
BlockProcessor: ccf.processComponents.BlockProcessor(),
ExecutionManager: ccf.processComponents.ExecutionManager(),
Hasher: ccf.coreComponents.Hasher(),
Marshalizer: ccf.coreComponents.InternalMarshalizer(),
ForkDetector: ccf.processComponents.ForkDetector(),
RequestHandler: ccf.processComponents.RequestHandler(),
ShardCoordinator: ccf.processComponents.ShardCoordinator(),
Accounts: ccf.stateComponents.AccountsAdapter(),
BlackListHandler: ccf.processComponents.BlackListHandler(),
NetworkWatcher: ccf.networkComponents.NetworkMessenger(),
BootStorer: ccf.processComponents.BootStorer(),
StorageBootstrapper: metaStorageBootstrapper,
EpochHandler: ccf.processComponents.EpochStartTrigger(),
MiniblocksProvider: ccf.dataComponents.MiniBlocksProvider(),
Uint64Converter: ccf.coreComponents.Uint64ByteSliceConverter(),
AppStatusHandler: ccf.statusCoreComponents.AppStatusHandler(),
OutportHandler: ccf.statusComponents.OutportHandler(),
AccountsDBSyncer: accountsDBSyncer,
CurrentEpochProvider: ccf.processComponents.CurrentEpochProvider(),
IsInImportMode: ccf.isInImportMode,
HistoryRepo: ccf.processComponents.HistoryRepository(),
ScheduledTxsExecutionHandler: ccf.processComponents.ScheduledTxsExecutionHandler(),
ProcessWaitTime: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeInMillis) * time.Millisecond,
ProcessWaitTimeSupernova: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeSupernovaInMillis) * time.Millisecond,
RepopulateTokensSupplies: ccf.flagsConfig.RepopulateTokensSupplies,
EnableEpochsHandler: ccf.coreComponents.EnableEpochsHandler(),
EnableRoundsHandler: ccf.coreComponents.EnableRoundsHandler(),
ProcessConfigsHandler: ccf.coreComponents.ProcessConfigsHandler(),
PoolsHolder: ccf.dataComponents.Datapool(),
Store: ccf.dataComponents.StorageService(),
ChainHandler: ccf.dataComponents.Blockchain(),
RoundHandler: ccf.processComponents.RoundHandler(),
BlockProcessor: ccf.processComponents.BlockProcessor(),
ExecutionManager: ccf.processComponents.ExecutionManager(),
Hasher: ccf.coreComponents.Hasher(),
Marshalizer: ccf.coreComponents.InternalMarshalizer(),
ForkDetector: ccf.processComponents.ForkDetector(),
RequestHandler: ccf.processComponents.RequestHandler(),
ShardCoordinator: ccf.processComponents.ShardCoordinator(),
Accounts: ccf.stateComponents.AccountsAdapter(),
BlackListHandler: ccf.processComponents.BlackListHandler(),
NetworkWatcher: ccf.networkComponents.NetworkMessenger(),
BootStorer: ccf.processComponents.BootStorer(),
StorageBootstrapper: metaStorageBootstrapper,
EpochHandler: ccf.processComponents.EpochStartTrigger(),
MiniblocksProvider: ccf.dataComponents.MiniBlocksProvider(),
Uint64Converter: ccf.coreComponents.Uint64ByteSliceConverter(),
AppStatusHandler: ccf.statusCoreComponents.AppStatusHandler(),
OutportHandler: ccf.statusComponents.OutportHandler(),
AccountsDBSyncer: accountsDBSyncer,
CurrentEpochProvider: ccf.processComponents.CurrentEpochProvider(),
IsInImportMode: ccf.isInImportMode,
HistoryRepo: ccf.processComponents.HistoryRepository(),
ScheduledTxsExecutionHandler: ccf.processComponents.ScheduledTxsExecutionHandler(),
ProcessWaitTime: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeInMillis) * time.Millisecond,
ProcessWaitTimeSupernova: time.Duration(ccf.config.GeneralSettings.SyncProcessTimeSupernovaInMillis) * time.Millisecond,
MaxNumOfRequestsForHeaderProof: ccf.config.GeneralSettings.MaxNumOfRequestsForHeaderProof,
RepopulateTokensSupplies: ccf.flagsConfig.RepopulateTokensSupplies,
EnableEpochsHandler: ccf.coreComponents.EnableEpochsHandler(),
EnableRoundsHandler: ccf.coreComponents.EnableRoundsHandler(),
ProcessConfigsHandler: ccf.coreComponents.ProcessConfigsHandler(),
}

argsMetaBootstrapper := sync.ArgMetaBootstrapper{
Expand Down
1 change: 1 addition & 0 deletions integrationTests/consensus/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ func startNodesWithCommitBlock(nodes []*integrationTests.TestConsensusNode, mute
GeneralSettings: config.GeneralSettingsConfig{
SyncProcessTimeInMillis: 6000,
SyncProcessTimeSupernovaInMillis: 3000,
MaxNumOfRequestsForHeaderProof: 10,
},
},
BootstrapRoundIndex: 0,
Expand Down
130 changes: 66 additions & 64 deletions integrationTests/testSyncNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,38 +324,39 @@ func (tpn *TestProcessorNode) initBlockProcessorWithSync() {

func (tpn *TestProcessorNode) createShardBootstrapper() (TestBootstrapper, error) {
argsBaseBootstrapper := sync.ArgBaseBootstrapper{
PoolsHolder: tpn.DataPool,
Store: tpn.Storage,
ChainHandler: tpn.BlockChain,
RoundHandler: tpn.RoundHandler,
BlockProcessor: tpn.BlockProcessor,
ExecutionManager: tpn.ExecutionManager,
Hasher: TestHasher,
Marshalizer: TestMarshalizer,
ForkDetector: tpn.ForkDetector,
RequestHandler: tpn.RequestHandler,
ShardCoordinator: tpn.ShardCoordinator,
Accounts: tpn.AccntState,
BlackListHandler: tpn.BlockBlackListHandler,
NetworkWatcher: tpn.MainMessenger,
BootStorer: tpn.BootstrapStorer,
StorageBootstrapper: tpn.StorageBootstrapper,
EpochHandler: tpn.EpochStartTrigger,
MiniblocksProvider: tpn.MiniblocksProvider,
Uint64Converter: TestUint64Converter,
AppStatusHandler: TestAppStatusHandler,
OutportHandler: disabled.NewDisabledOutport(),
AccountsDBSyncer: &mock.AccountsDBSyncerStub{},
CurrentEpochProvider: &testscommon.CurrentEpochProviderStub{},
IsInImportMode: false,
HistoryRepo: &dblookupext.HistoryRepositoryStub{},
ScheduledTxsExecutionHandler: &testscommon.ScheduledTxsExecutionStub{},
ProcessWaitTime: tpn.RoundHandler.TimeDuration(),
ProcessWaitTimeSupernova: tpn.RoundHandler.TimeDuration(),
RepopulateTokensSupplies: false,
EnableEpochsHandler: tpn.EnableEpochsHandler,
EnableRoundsHandler: tpn.EnableRoundsHandler,
ProcessConfigsHandler: tpn.ProcessConfigsHandler,
PoolsHolder: tpn.DataPool,
Store: tpn.Storage,
ChainHandler: tpn.BlockChain,
RoundHandler: tpn.RoundHandler,
BlockProcessor: tpn.BlockProcessor,
ExecutionManager: tpn.ExecutionManager,
Hasher: TestHasher,
Marshalizer: TestMarshalizer,
ForkDetector: tpn.ForkDetector,
RequestHandler: tpn.RequestHandler,
ShardCoordinator: tpn.ShardCoordinator,
Accounts: tpn.AccntState,
BlackListHandler: tpn.BlockBlackListHandler,
NetworkWatcher: tpn.MainMessenger,
BootStorer: tpn.BootstrapStorer,
StorageBootstrapper: tpn.StorageBootstrapper,
EpochHandler: tpn.EpochStartTrigger,
MiniblocksProvider: tpn.MiniblocksProvider,
Uint64Converter: TestUint64Converter,
AppStatusHandler: TestAppStatusHandler,
OutportHandler: disabled.NewDisabledOutport(),
AccountsDBSyncer: &mock.AccountsDBSyncerStub{},
CurrentEpochProvider: &testscommon.CurrentEpochProviderStub{},
IsInImportMode: false,
HistoryRepo: &dblookupext.HistoryRepositoryStub{},
ScheduledTxsExecutionHandler: &testscommon.ScheduledTxsExecutionStub{},
ProcessWaitTime: tpn.RoundHandler.TimeDuration(),
ProcessWaitTimeSupernova: tpn.RoundHandler.TimeDuration(),
MaxNumOfRequestsForHeaderProof: 10,
RepopulateTokensSupplies: false,
EnableEpochsHandler: tpn.EnableEpochsHandler,
EnableRoundsHandler: tpn.EnableRoundsHandler,
ProcessConfigsHandler: tpn.ProcessConfigsHandler,
}

argsShardBootstrapper := sync.ArgShardBootstrapper{
Expand All @@ -374,38 +375,39 @@ func (tpn *TestProcessorNode) createShardBootstrapper() (TestBootstrapper, error

func (tpn *TestProcessorNode) createMetaChainBootstrapper() (TestBootstrapper, error) {
argsBaseBootstrapper := sync.ArgBaseBootstrapper{
PoolsHolder: tpn.DataPool,
Store: tpn.Storage,
ChainHandler: tpn.BlockChain,
RoundHandler: tpn.RoundHandler,
BlockProcessor: tpn.BlockProcessor,
ExecutionManager: tpn.ExecutionManager,
Hasher: TestHasher,
Marshalizer: TestMarshalizer,
ForkDetector: tpn.ForkDetector,
RequestHandler: tpn.RequestHandler,
ShardCoordinator: tpn.ShardCoordinator,
Accounts: tpn.AccntState,
BlackListHandler: tpn.BlockBlackListHandler,
NetworkWatcher: tpn.MainMessenger,
BootStorer: tpn.BootstrapStorer,
StorageBootstrapper: tpn.StorageBootstrapper,
EpochHandler: tpn.EpochStartTrigger,
MiniblocksProvider: tpn.MiniblocksProvider,
Uint64Converter: TestUint64Converter,
AppStatusHandler: TestAppStatusHandler,
OutportHandler: disabled.NewDisabledOutport(),
AccountsDBSyncer: &mock.AccountsDBSyncerStub{},
CurrentEpochProvider: &testscommon.CurrentEpochProviderStub{},
IsInImportMode: false,
HistoryRepo: &dblookupext.HistoryRepositoryStub{},
ScheduledTxsExecutionHandler: &testscommon.ScheduledTxsExecutionStub{},
ProcessWaitTime: tpn.RoundHandler.TimeDuration(),
ProcessWaitTimeSupernova: tpn.RoundHandler.TimeDuration(),
RepopulateTokensSupplies: false,
EnableEpochsHandler: &enableEpochsHandlerMock.EnableEpochsHandlerStub{},
EnableRoundsHandler: tpn.EnableRoundsHandler,
ProcessConfigsHandler: tpn.ProcessConfigsHandler,
PoolsHolder: tpn.DataPool,
Store: tpn.Storage,
ChainHandler: tpn.BlockChain,
RoundHandler: tpn.RoundHandler,
BlockProcessor: tpn.BlockProcessor,
ExecutionManager: tpn.ExecutionManager,
Hasher: TestHasher,
Marshalizer: TestMarshalizer,
ForkDetector: tpn.ForkDetector,
RequestHandler: tpn.RequestHandler,
ShardCoordinator: tpn.ShardCoordinator,
Accounts: tpn.AccntState,
BlackListHandler: tpn.BlockBlackListHandler,
NetworkWatcher: tpn.MainMessenger,
BootStorer: tpn.BootstrapStorer,
StorageBootstrapper: tpn.StorageBootstrapper,
EpochHandler: tpn.EpochStartTrigger,
MiniblocksProvider: tpn.MiniblocksProvider,
Uint64Converter: TestUint64Converter,
AppStatusHandler: TestAppStatusHandler,
OutportHandler: disabled.NewDisabledOutport(),
AccountsDBSyncer: &mock.AccountsDBSyncerStub{},
CurrentEpochProvider: &testscommon.CurrentEpochProviderStub{},
IsInImportMode: false,
HistoryRepo: &dblookupext.HistoryRepositoryStub{},
ScheduledTxsExecutionHandler: &testscommon.ScheduledTxsExecutionStub{},
ProcessWaitTime: tpn.RoundHandler.TimeDuration(),
ProcessWaitTimeSupernova: tpn.RoundHandler.TimeDuration(),
MaxNumOfRequestsForHeaderProof: 10,
RepopulateTokensSupplies: false,
EnableEpochsHandler: &enableEpochsHandlerMock.EnableEpochsHandlerStub{},
EnableRoundsHandler: tpn.EnableRoundsHandler,
ProcessConfigsHandler: tpn.ProcessConfigsHandler,
}

argsMetaBootstrapper := sync.ArgMetaBootstrapper{
Expand Down
3 changes: 3 additions & 0 deletions process/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,9 @@ var ErrNilHeartbeatCacher = errors.New("nil heartbeat cacher")
// ErrInvalidProcessWaitTime signals that an invalid process wait time was provided
var ErrInvalidProcessWaitTime = errors.New("invalid process wait time")

// ErrInvalidMaxNumOfRequestsForHeaderProof signals that an invalid max number of requests for header proof was provided
var ErrInvalidMaxNumOfRequestsForHeaderProof = errors.New("invalid max num of requests for header proof")

// ErrMetaHeaderEpochOutOfRange signals that the given header is out of accepted range
var ErrMetaHeaderEpochOutOfRange = errors.New("epoch out of range for meta block header")

Expand Down
Loading
Loading