Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
more parents
Browse files Browse the repository at this point in the history
Merge pull request #404 from devintegral3/feature/more_parents
  • Loading branch information
a.guzev committed Dec 27, 2019
2 parents 8c9bb07 + a416c18 commit fdb71d1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion gossip/config_emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ type EmitterConfig struct {

SelfForkProtectionInterval time.Duration `json:"selfForkProtectionInterval"`

EpochTailLength idx.Frame `json:"epochTailLength"` // number of frames before event is considered epoch tail
EpochTailLength idx.Frame `json:"epochTailLength"` // number of frames before event is considered epoch

MaxParents int `json:"maxParents"`

// thresholds on GasLeft
SmoothTpsThreshold uint64 `json:"smoothTpsThreshold"`
Expand All @@ -40,6 +42,8 @@ func DefaultEmitterConfig() EmitterConfig {
SelfForkProtectionInterval: 30 * time.Minute, // should be at least 2x of MaxEmitInterval
EpochTailLength: 1,

MaxParents: 7,

SmoothTpsThreshold: (params.EventGas + params.TxGas) * 500,
NoTxsThreshold: params.EventGas * 30,
EmergencyThreshold: params.EventGas * 5,
Expand Down
9 changes: 8 additions & 1 deletion gossip/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,14 @@ func (em *Emitter) findBestParents(epoch idx.Epoch, myStakerID idx.StakerID) (*h
strategy = ancestor.NewRandomStrategy(nil)
}

_, parents := ancestor.FindBestParents(em.net.Dag.MaxParents, heads, selfParent, strategy)
maxParents := em.config.MaxParents
if maxParents < em.net.Dag.MaxFreeParents {
maxParents = em.net.Dag.MaxFreeParents
}
if maxParents > em.net.Dag.MaxParents {
maxParents = em.net.Dag.MaxParents
}
_, parents := ancestor.FindBestParents(maxParents, heads, selfParent, strategy)
return selfParent, parents, true
}

Expand Down
2 changes: 1 addition & 1 deletion lachesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func FakeEconomyConfig() EconomyConfig {

func DefaultDagConfig() DagConfig {
return DagConfig{
MaxParents: 5,
MaxParents: 10,
MaxFreeParents: 3,
MaxEpochBlocks: 1000,
MaxEpochDuration: 4 * time.Hour,
Expand Down
2 changes: 1 addition & 1 deletion lachesis/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
MaxExtraData = 128 // it has fair gas cost, so it's fine to have a high limit

EventGas = 28000
ParentGas = EventGas / 5
ParentGas = 2400
// ExtraDataGas is cost per byte of extra event data. It's higher than regular data price, because it's a part of the header
ExtraDataGas = 150

Expand Down
2 changes: 1 addition & 1 deletion poset/frame_decide_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestConfirmBlockEvents(t *testing.T) {
}

eventCount := int(poset.dag.MaxEpochBlocks)
_ = inter.ForEachRandEvent(nodes, eventCount, poset.dag.MaxParents, nil, inter.ForEachEvent{
_ = inter.ForEachRandEvent(nodes, eventCount, 5, nil, inter.ForEachEvent{
Process: func(e *inter.Event, name string) {
input.SetEvent(e)
assertar.NoError(
Expand Down

0 comments on commit fdb71d1

Please sign in to comment.