quick workaround for epochref cache issue (#1296)
* quick workaround for epochref cache issue * disable assertion which doesn't work without epochref caches * get local testnets and altona running again
This commit is contained in:
parent
476568ac59
commit
853bd5b799
|
@ -177,11 +177,13 @@ func getEpochInfo*(blck: BlockRef, state: BeaconState): EpochRef =
|
|||
raiseAssert "multiple EpochRefs per epoch per BlockRef invalid"
|
||||
|
||||
func getEpochCache*(blck: BlockRef, state: BeaconState): StateCache =
|
||||
let epochInfo = getEpochInfo(blck, state)
|
||||
result = get_empty_per_epoch_cache()
|
||||
result.shuffled_active_validator_indices[
|
||||
state.slot.compute_epoch_at_slot] =
|
||||
epochInfo.shuffled_active_validator_indices
|
||||
when false:
|
||||
let epochInfo = getEpochInfo(blck, state)
|
||||
result = get_empty_per_epoch_cache()
|
||||
result.shuffled_active_validator_indices[
|
||||
state.slot.compute_epoch_at_slot] =
|
||||
epochInfo.shuffled_active_validator_indices
|
||||
get_empty_per_epoch_cache()
|
||||
|
||||
func init(T: type BlockRef, root: Eth2Digest, slot: Slot): BlockRef =
|
||||
BlockRef(
|
||||
|
|
|
@ -207,8 +207,10 @@ proc state_transition*(
|
|||
# the changes in case of failure (look out for `var BeaconState` and
|
||||
# bool return values...)
|
||||
doAssert not rollback.isNil, "use noRollback if it's ok to mess up state"
|
||||
doAssert stateCache.shuffled_active_validator_indices.hasKey(
|
||||
state.data.slot.compute_epoch_at_slot)
|
||||
when false:
|
||||
# TODO readd this assetion when epochref cache is back
|
||||
doAssert stateCache.shuffled_active_validator_indices.hasKey(
|
||||
state.data.slot.compute_epoch_at_slot)
|
||||
|
||||
if not process_slots(state, signedBlock.message.slot, flags):
|
||||
rollback(state)
|
||||
|
|
|
@ -344,7 +344,13 @@ proc handleAttestations(node: BeaconNode, head: BlockRef, slot: Slot) =
|
|||
cache.shuffled_active_validator_indices[
|
||||
slot.compute_epoch_at_slot].len.uint64
|
||||
except KeyError:
|
||||
raiseAssert "getEpochCache(...) didn't fill cache"
|
||||
when false:
|
||||
# TODO re-enable when getEpochCache() works
|
||||
raiseAssert "getEpochCache(...) didn't fill cache"
|
||||
let epoch = slot.compute_epoch_at_slot
|
||||
cache.shuffled_active_validator_indices[epoch] =
|
||||
get_shuffled_active_validator_indices(state, epoch)
|
||||
cache.shuffled_active_validator_indices[epoch].len.uint64
|
||||
|
||||
for committee_index in 0'u64..<committees_per_slot:
|
||||
let committee = get_beacon_committee(
|
||||
|
|
Loading…
Reference in New Issue