Fixed Simulator Slot Alignment (#607)

This commit is contained in:
terence tsao 2018-10-02 18:02:52 -07:00 committed by Raul Jordan
parent 593e3dcdf9
commit aec2ea3b1b
4 changed files with 7 additions and 2 deletions

View File

@ -44,7 +44,7 @@ var defaultConfig = &Config{
}
var demoConfig = &Config{
GenesisTime: time.Now(),
GenesisTime: time.Now().Add(-8 * time.Second),
CycleLength: uint64(5),
ShardCount: 3,
DefaultBalance: new(big.Int).Div(big.NewInt(32), big.NewInt(int64(1e18))),

View File

@ -182,7 +182,7 @@ func (sim *Simulator) run(delayChan <-chan time.Time, done <-chan struct{}) {
}
block := types.NewBlock(&pb.BeaconBlock{
SlotNumber: sim.slotNum,
SlotNumber: sim.chainService.CurrentBeaconSlot(),
Timestamp: ptypes.TimestampNow(),
PowChainRef: powChainRef,
ActiveStateHash: activeStateHash[:],

View File

@ -55,6 +55,10 @@ func (mc *mockChainService) GenesisBlock() (*types.Block, error) {
return types.NewGenesisBlock([32]byte{}, [32]byte{}), nil
}
func (mc *mockChainService) CurrentBeaconSlot() uint64 {
return 0
}
func TestLifecycle(t *testing.T) {
hook := logTest.NewGlobal()
db := database.NewKVStore()

View File

@ -52,6 +52,7 @@ type StateFetcher interface {
CurrentActiveState() *ActiveState
CurrentCrystallizedState() *CrystallizedState
GenesisBlock() (*Block, error)
CurrentBeaconSlot() uint64
}
// POWChainService is an interface for a proof-of-work chain web3 service.