|
|
@ -30,7 +30,7 @@ func TestConfigValidateBasic(t *testing.T) { |
|
|
|
assert.NoError(t, cfg.ValidateBasic()) |
|
|
|
|
|
|
|
// tamper with unsafe-propose-timeout-override
|
|
|
|
cfg.Consensus.UnsafeProposeTimeoutOverride = durationPtr(-10 * time.Second) |
|
|
|
cfg.Consensus.UnsafeProposeTimeoutOverride = -10 * time.Second |
|
|
|
assert.Error(t, cfg.ValidateBasic()) |
|
|
|
} |
|
|
|
|
|
|
@ -106,16 +106,16 @@ func TestConsensusConfig_ValidateBasic(t *testing.T) { |
|
|
|
modify func(*ConsensusConfig) |
|
|
|
expectErr bool |
|
|
|
}{ |
|
|
|
"UnsafeProposeTimeoutOverride": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutOverride = durationPtr(time.Second) }, false}, |
|
|
|
"UnsafeProposeTimeoutOverride negative": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutOverride = durationPtr(-1) }, true}, |
|
|
|
"UnsafeProposeTimeoutDeltaOverride": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutDeltaOverride = durationPtr(time.Second) }, false}, |
|
|
|
"UnsafeProposeTimeoutDeltaOverride negative": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutDeltaOverride = durationPtr(-1) }, true}, |
|
|
|
"UnsafePrevoteTimeoutOverride": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutOverride = durationPtr(time.Second) }, false}, |
|
|
|
"UnsafePrevoteTimeoutOverride negative": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutOverride = durationPtr(-1) }, true}, |
|
|
|
"UnsafePrevoteTimeoutDeltaOverride": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutDeltaOverride = durationPtr(time.Second) }, false}, |
|
|
|
"UnsafePrevoteTimeoutDeltaOverride negative": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutDeltaOverride = durationPtr(-1) }, true}, |
|
|
|
"UnsafeCommitTimeoutOverride": {func(c *ConsensusConfig) { c.UnsafeCommitTimeoutOverride = durationPtr(time.Second) }, false}, |
|
|
|
"UnsafeCommitTimeoutOverride negative": {func(c *ConsensusConfig) { c.UnsafeCommitTimeoutOverride = durationPtr(-1) }, true}, |
|
|
|
"UnsafeProposeTimeoutOverride": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutOverride = time.Second }, false}, |
|
|
|
"UnsafeProposeTimeoutOverride negative": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutOverride = -1 }, true}, |
|
|
|
"UnsafeProposeTimeoutDeltaOverride": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutDeltaOverride = time.Second }, false}, |
|
|
|
"UnsafeProposeTimeoutDeltaOverride negative": {func(c *ConsensusConfig) { c.UnsafeProposeTimeoutDeltaOverride = -1 }, true}, |
|
|
|
"UnsafePrevoteTimeoutOverride": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutOverride = time.Second }, false}, |
|
|
|
"UnsafePrevoteTimeoutOverride negative": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutOverride = -1 }, true}, |
|
|
|
"UnsafePrevoteTimeoutDeltaOverride": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutDeltaOverride = time.Second }, false}, |
|
|
|
"UnsafePrevoteTimeoutDeltaOverride negative": {func(c *ConsensusConfig) { c.UnsafeVoteTimeoutDeltaOverride = -1 }, true}, |
|
|
|
"UnsafeCommitTimeoutOverride": {func(c *ConsensusConfig) { c.UnsafeCommitTimeoutOverride = time.Second }, false}, |
|
|
|
"UnsafeCommitTimeoutOverride negative": {func(c *ConsensusConfig) { c.UnsafeCommitTimeoutOverride = -1 }, true}, |
|
|
|
"PeerGossipSleepDuration": {func(c *ConsensusConfig) { c.PeerGossipSleepDuration = time.Second }, false}, |
|
|
|
"PeerGossipSleepDuration negative": {func(c *ConsensusConfig) { c.PeerGossipSleepDuration = -1 }, true}, |
|
|
|
"PeerQueryMaj23SleepDuration": {func(c *ConsensusConfig) { c.PeerQueryMaj23SleepDuration = time.Second }, false}, |
|
|
@ -164,7 +164,3 @@ func TestP2PConfigValidateBasic(t *testing.T) { |
|
|
|
reflect.ValueOf(cfg).Elem().FieldByName(fieldName).SetInt(0) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func durationPtr(t time.Duration) *time.Duration { |
|
|
|
return &t |
|
|
|
} |