Skip to content

Commit

Permalink
Only send PushQuery messages after building the block (ava-labs#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-kim committed Jun 1, 2023
1 parent b923ef7 commit 484b735
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 510 deletions.
14 changes: 6 additions & 8 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,12 @@ func getConsensusConfig(v *viper.Viper) snowball.Parameters {
//
// TODO: After the X-chain linearization use the
// SnowVirtuousCommitThresholdKey as before.
BetaVirtuous: v.GetInt(SnowRogueCommitThresholdKey),
BetaRogue: v.GetInt(SnowRogueCommitThresholdKey),
ConcurrentRepolls: v.GetInt(SnowConcurrentRepollsKey),
OptimalProcessing: v.GetInt(SnowOptimalProcessingKey),
MaxOutstandingItems: v.GetInt(SnowMaxProcessingKey),
MaxItemProcessingTime: v.GetDuration(SnowMaxTimeProcessingKey),
MixedQueryNumPushVdr: int(v.GetUint(SnowMixedQueryNumPushVdrKey)),
MixedQueryNumPushNonVdr: int(v.GetUint(SnowMixedQueryNumPushNonVdrKey)),
BetaVirtuous: v.GetInt(SnowRogueCommitThresholdKey),
BetaRogue: v.GetInt(SnowRogueCommitThresholdKey),
ConcurrentRepolls: v.GetInt(SnowConcurrentRepollsKey),
OptimalProcessing: v.GetInt(SnowOptimalProcessingKey),
MaxOutstandingItems: v.GetInt(SnowMaxProcessingKey),
MaxItemProcessingTime: v.GetDuration(SnowMaxTimeProcessingKey),
}
}

Expand Down
2 changes: 0 additions & 2 deletions config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ func addNodeFlags(fs *pflag.FlagSet) {
fs.Int(SnowOptimalProcessingKey, 10, "Optimal number of processing containers in consensus")
fs.Int(SnowMaxProcessingKey, 256, "Maximum number of processing items to be considered healthy")
fs.Duration(SnowMaxTimeProcessingKey, 30*time.Second, "Maximum amount of time an item should be processing and still be healthy")
fs.Uint(SnowMixedQueryNumPushVdrKey, 10, fmt.Sprintf("If this node is a validator, when a container is inserted into consensus, send a Push Query to %s validators and a Pull Query to the others. Must be <= k.", SnowMixedQueryNumPushVdrKey))
fs.Uint(SnowMixedQueryNumPushNonVdrKey, 0, fmt.Sprintf("If this node is not a validator, when a container is inserted into consensus, send a Push Query to %s validators and a Pull Query to the others. Must be <= k.", SnowMixedQueryNumPushNonVdrKey))

// ProposerVM
fs.Bool(ProposerVMUseCurrentHeightKey, false, "Have the ProposerVM always report the last accepted P-chain block height")
Expand Down
2 changes: 0 additions & 2 deletions config/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ const (
SnowOptimalProcessingKey = "snow-optimal-processing"
SnowMaxProcessingKey = "snow-max-processing"
SnowMaxTimeProcessingKey = "snow-max-time-processing"
SnowMixedQueryNumPushVdrKey = "snow-mixed-query-num-push-vdr"
SnowMixedQueryNumPushNonVdrKey = "snow-mixed-query-num-push-non-vdr"
TrackSubnetsKey = "track-subnets"
AdminAPIEnabledKey = "api-admin-enabled"
InfoAPIEnabledKey = "api-info-enabled"
Expand Down
14 changes: 0 additions & 14 deletions snow/consensus/snowball/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ type Parameters struct {
// Reports unhealthy if there is an item processing for longer than this
// duration.
MaxItemProcessingTime time.Duration `json:"maxItemProcessingTime" yaml:"maxItemProcessingTime"`

// If this node is a validator, when a container is inserted into consensus,
// send a Push Query to this many validators and a Pull Query to the other
// k - MixedQueryNumPushVdr validators. Must be in [0, K].
MixedQueryNumPushVdr int `json:"mixedQueryNumPushVdr" yaml:"mixedQueryNumPushVdr"`

// If this node is not a validator, when a container is inserted into consensus,
// send a Push Query to this many validators and a Pull Query to the other
// k - MixedQueryNumPushVdr validators. Must be in [0, K].
MixedQueryNumPushNonVdr int `json:"mixedQueryNumPushNonVdr" yaml:"mixedQueryNumPushNonVdr"`
}

// Verify returns nil if the parameters describe a valid initialization.
Expand All @@ -79,10 +69,6 @@ func (p Parameters) Verify() error {
return fmt.Errorf("%w: maxOutstandingItems = %d: fails the condition that: 0 < maxOutstandingItems", ErrParametersInvalid, p.MaxOutstandingItems)
case p.MaxItemProcessingTime <= 0:
return fmt.Errorf("%w: maxItemProcessingTime = %d: fails the condition that: 0 < maxItemProcessingTime", ErrParametersInvalid, p.MaxItemProcessingTime)
case p.MixedQueryNumPushVdr > p.K:
return fmt.Errorf("%w: mixedQueryNumPushVdr (%d) > K (%d)", ErrParametersInvalid, p.MixedQueryNumPushVdr, p.K)
case p.MixedQueryNumPushNonVdr > p.K:
return fmt.Errorf("%w: mixedQueryNumPushNonVdr (%d) > K (%d)", ErrParametersInvalid, p.MixedQueryNumPushNonVdr, p.K)
default:
return nil
}
Expand Down
41 changes: 0 additions & 41 deletions snow/engine/common/mixed_query.go

This file was deleted.

150 changes: 0 additions & 150 deletions snow/engine/common/mixed_query_test.go

This file was deleted.

17 changes: 8 additions & 9 deletions snow/engine/snowman/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ func DefaultConfigs() Config {
Validators: validators.NewSet(),
VM: &block.TestVM{},
Params: snowball.Parameters{
K: 1,
Alpha: 1,
BetaVirtuous: 1,
BetaRogue: 2,
ConcurrentRepolls: 1,
OptimalProcessing: 100,
MaxOutstandingItems: 1,
MaxItemProcessingTime: 1,
MixedQueryNumPushNonVdr: 1,
K: 1,
Alpha: 1,
BetaVirtuous: 1,
BetaRogue: 2,
ConcurrentRepolls: 1,
OptimalProcessing: 100,
MaxOutstandingItems: 1,
MaxItemProcessingTime: 1,
},
Consensus: &snowman.Topological{},
}
Expand Down
3 changes: 2 additions & 1 deletion snow/engine/snowman/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type issuer struct {
blk snowman.Block
abandoned bool
deps set.Set[ids.ID]
push bool
}

func (i *issuer) Dependencies() set.Set[ids.ID] {
Expand Down Expand Up @@ -50,5 +51,5 @@ func (i *issuer) Update(ctx context.Context) {
return
}
// Issue the block into consensus
i.t.errs.Add(i.t.deliver(ctx, i.blk))
i.t.errs.Add(i.t.deliver(ctx, i.blk, i.push))
}

0 comments on commit 484b735

Please sign in to comment.