Skip to content
Merged
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
7 changes: 1 addition & 6 deletions sim/ec.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package sim

import (
"time"

"github.com/filecoin-project/go-f3/gpbft"
)

// Simulated EC state for each protocol instance.
type EC struct {
// Timestamp of the base chain.
BaseTimestamp time.Time
Instances []*ECInstance
Instances []*ECInstance
}

type ECInstance struct {
Expand All @@ -26,7 +22,6 @@ type ECInstance struct {

func newEC(opts *options) *EC {
return &EC{
BaseTimestamp: time.Time{},
Instances: []*ECInstance{
{
Base: *opts.baseChain,
Expand Down
4 changes: 1 addition & 3 deletions sim/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ func (v *simHost) ReceiveDecision(decision *gpbft.Justification) time.Time {
v.sim.ec.AddInstance(nextChain, nextPowerTable, nextBeacon)
v.sim.decisions.BeginInstance(decision.Vote.Instance+1, nextBase, nextPowerTable)
}
elapsedEpochs := 1 //decision.Vote.Value.Head().Epoch - v.EC.BaseEpoch
finalTimestamp := v.sim.ec.BaseTimestamp.Add(time.Duration(elapsedEpochs) * v.sim.ecEpochDuration)
// Next instance starts some fixed time after the next EC epoch is due.
nextInstanceStart := finalTimestamp.Add(v.sim.ecEpochDuration).Add(v.sim.ecStabilisationDelay)
nextInstanceStart := v.Time().Add(v.sim.ecEpochDuration).Add(v.sim.ecStabilisationDelay)
return nextInstanceStart
}

Expand Down