diff --git a/beacon-chain/params/config.go b/beacon-chain/params/config.go index 4a116054b..4fa7a0085 100644 --- a/beacon-chain/params/config.go +++ b/beacon-chain/params/config.go @@ -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))), diff --git a/beacon-chain/simulator/service.go b/beacon-chain/simulator/service.go index 2f214310b..597404ca8 100644 --- a/beacon-chain/simulator/service.go +++ b/beacon-chain/simulator/service.go @@ -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[:], diff --git a/beacon-chain/simulator/service_test.go b/beacon-chain/simulator/service_test.go index 7642f7b6e..fb24c102f 100644 --- a/beacon-chain/simulator/service_test.go +++ b/beacon-chain/simulator/service_test.go @@ -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() diff --git a/beacon-chain/types/interfaces.go b/beacon-chain/types/interfaces.go index 67db234f7..9ab5fa9bd 100644 --- a/beacon-chain/types/interfaces.go +++ b/beacon-chain/types/interfaces.go @@ -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.