diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-03-18 17:06:38 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-18 17:06:38 +0800 |
commit | 9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101 (patch) | |
tree | a9c3c3c9520fca2205c5eef9b1355a5db0fca539 /core/utils | |
parent | 89dddf787c9360f0fed76738fb515be30c7d73bc (diff) | |
download | dexon-consensus-9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101.tar dexon-consensus-9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101.tar.gz dexon-consensus-9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101.tar.bz2 dexon-consensus-9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101.tar.lz dexon-consensus-9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101.tar.xz dexon-consensus-9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101.tar.zst dexon-consensus-9e97ddc00c67ee13ceb8fc597f4f55cfd6df6101.zip |
test: try to mitigate flaky tests (#498)
* Add assertion to make sure all nodes are synced.
* Retry round event with BA's interval
We are about to modify lambdaDKG with block height, instead of timing.
Therefore, the last interval we could use is BA's interval.
* Check ctx in inifite loop
* Disable this panic temporary
If a fast sync triggered by receiving types.AgreementResult from later
position, this panic would be triggered 100%, ex.
current-round: 1,
change-notary-height: 120,
agreeemnt-result from round:2 height:121
However, I don't have easy way to fix it temporary.
* Lower down the test size for TCP
* Fix typo
* Fixup: revert the removed panic
Diffstat (limited to 'core/utils')
-rw-r--r-- | core/utils/round-event.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/utils/round-event.go b/core/utils/round-event.go index 1ce877d..2689840 100644 --- a/core/utils/round-event.go +++ b/core/utils/round-event.go @@ -135,6 +135,7 @@ type RoundEvent struct { roundShift uint64 ctx context.Context ctxCancel context.CancelFunc + retryInterval time.Duration } // NewRoundEvent creates an RoundEvent instance. @@ -144,16 +145,17 @@ func NewRoundEvent(parentCtx context.Context, gov governanceAccessor, roundShift uint64) (*RoundEvent, error) { // We need to generate valid ending block height of this round (taken // DKG reset count into consideration). + initConfig := GetConfigWithPanic(gov, initRound, logger) e := &RoundEvent{ gov: gov, logger: logger, lastTriggeredRound: initRound, roundShift: roundShift, + retryInterval: initConfig.LambdaBA, } e.ctx, e.ctxCancel = context.WithCancel(parentCtx) e.config = RoundBasedConfig{} - e.config.SetupRoundBasedFields(initRound, GetConfigWithPanic( - gov, initRound, logger)) + e.config.SetupRoundBasedFields(initRound, initConfig) e.config.SetRoundBeginHeight(initRoundBeginHeight) // Make sure the DKG reset count in current governance can cover the initial // block height. @@ -245,7 +247,7 @@ func (e *RoundEvent) ValidateNextRound(blockHeight uint64) { select { case <-e.ctx.Done(): return - case <-time.After(500 * time.Millisecond): + case <-time.After(e.retryInterval): } } } |