diff --git a/chain/src/test/java/org/ethereum/beacon/chain/DefaultBeaconChainTest.java b/chain/src/test/java/org/ethereum/beacon/chain/DefaultBeaconChainTest.java index 3df3e9bac..01eb39d8b 100644 --- a/chain/src/test/java/org/ethereum/beacon/chain/DefaultBeaconChainTest.java +++ b/chain/src/test/java/org/ethereum/beacon/chain/DefaultBeaconChainTest.java @@ -22,8 +22,11 @@ import org.ethereum.beacon.core.BeaconBlock; import org.ethereum.beacon.core.BeaconBlockBody; import org.ethereum.beacon.core.BeaconState; +import org.ethereum.beacon.core.spec.SpecConstants; import org.ethereum.beacon.core.state.Eth1Data; import org.ethereum.beacon.core.types.BLSSignature; +import org.ethereum.beacon.core.types.Millis; +import org.ethereum.beacon.core.types.ShardNumber; import org.ethereum.beacon.core.types.SlotNumber; import org.ethereum.beacon.core.types.Time; import org.ethereum.beacon.db.Database; @@ -133,14 +136,27 @@ public void testRejectBlocks_future() { BeaconChainSpec spec = BeaconChainSpec.Builder.createWithDefaultParams() + .withConstants(new SpecConstants() { + @Override + public ShardNumber getShardCount() { + return ShardNumber.of(16); + } + + @Override + public SlotNumber.EpochLength getSlotsPerEpoch() { + return new SlotNumber.EpochLength(UInt64.valueOf(4)); + } + }) .withComputableGenesisTime(false) .withVerifyDepositProof(false) .build(); + StateTransition perSlotTransition = StateTransitionTestUtil.createNextSlotTransition(); - MutableBeaconChain beaconChain = createBeaconChain(spec, perSlotTransition, schedulers); + MutableBeaconChain beaconChain = createBeaconChain(spec, perSlotTransition, schedulers); beaconChain.init(); + BeaconTuple initialTuple = beaconChain.getRecentlyProcessed(); Assert.assertEquals(spec.getConstants().getGenesisSlot(), initialTuple.getBlock().getSlot()); @@ -153,7 +169,8 @@ public void testRejectBlocks_future() { // assert block.slot <= get_current_slot(store.time) + 1 BeaconState state = perSlotTransition.apply(new BeaconStateExImpl(parent.getState())); SlotNumber currentSlot = spec.get_current_slot(parent.getState(), schedulers.getCurrentTime()); - SlotNumber nextToCurrentSlot = spec.get_current_slot(state, currentTime).increment(); + schedulers.addTime(Millis.BIT_SIZE); + SlotNumber nextToCurrentSlot = spec.get_current_slot(state, schedulers.getCurrentTime()).increment(); final boolean actual = nextToCurrentSlot.greaterEqual(currentSlot); // assert store.time >= pre_state.genesis_time + block.slot * SECONDS_PER_SLOT