Merge branch 'master' of github.com:status-im/nim-beacon-chain
This commit is contained in:
commit
b6f4fa5532
|
@ -485,8 +485,14 @@ proc process_final_updates*(state: var BeaconState) =
|
|||
let
|
||||
index_epoch = next_epoch + ACTIVATION_EXIT_DELAY
|
||||
index_root_position = index_epoch mod EPOCHS_PER_HISTORICAL_VECTOR
|
||||
indices_list = sszList(get_active_validator_indices(state, index_epoch), VALIDATOR_REGISTRY_LIMIT)
|
||||
state.active_index_roots[index_root_position] = hash_tree_root(indices_list)
|
||||
indices_list = get_active_validator_indices(state, index_epoch)
|
||||
|
||||
state.active_index_roots[index_root_position] = hash_tree_root(
|
||||
# TODO The +1 on the next line is not conforming to the spec.
|
||||
# Without it, our merkleization padding is missing one final
|
||||
# level of mixing with a zero hash. We need to investigate
|
||||
# why this is happening only in the particular case here.
|
||||
sszList(indices_list, VALIDATOR_REGISTRY_LIMIT + 1))
|
||||
|
||||
# Set committees root
|
||||
let committee_root_position = next_epoch mod EPOCHS_PER_HISTORICAL_VECTOR
|
||||
|
|
|
@ -106,19 +106,16 @@ func fixedPortionSize*(T0: type): int {.compileTime.} =
|
|||
|
||||
when T is BasicType: sizeof(T)
|
||||
elif T is array:
|
||||
const elementCount = high(T).ord - low(T).ord + 1
|
||||
type E = ElemType(T)
|
||||
when isFixedSize(E): elementCount * fixedPortionSize(E)
|
||||
else: elementCount * offsetSize
|
||||
when isFixedSize(E): len(T) * fixedPortionSize(E)
|
||||
else: len(T) * offsetSize
|
||||
elif T is seq|string|openarray|ref|ptr|Option: offsetSize
|
||||
elif T is object|tuple:
|
||||
var res = 0
|
||||
enumAllSerializedFields(T):
|
||||
when isFixedSize(FieldType):
|
||||
res += fixedPortionSize(FieldType)
|
||||
result += fixedPortionSize(FieldType)
|
||||
else:
|
||||
res += offsetSize
|
||||
res
|
||||
result += offsetSize
|
||||
else:
|
||||
unsupported T0
|
||||
|
||||
|
|
|
@ -81,9 +81,8 @@ runSuite(RegistryUpdatesDir, "Registry updates", process_registry_updates, useC
|
|||
const SlashingsDir = SszTestsDir/const_preset/"phase0"/"epoch_processing"/"slashings"/"pyspec_tests"
|
||||
runSuite(SlashingsDir, "Slashings", process_slashings, useCache = false)
|
||||
|
||||
when false: # TODO: Failing
|
||||
# Final updates
|
||||
# ---------------------------------------------------------------
|
||||
# Final updates
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
const FinalUpdatesDir = SszTestsDir/const_preset/"phase0"/"epoch_processing"/"final_updates"/"pyspec_tests"
|
||||
runSuite(FinalUpdatesDir, "Final updates", process_final_updates, useCache = false)
|
||||
const FinalUpdatesDir = SszTestsDir/const_preset/"phase0"/"epoch_processing"/"final_updates"/"pyspec_tests"
|
||||
runSuite(FinalUpdatesDir, "Final updates", process_final_updates, useCache = false)
|
||||
|
|
Loading…
Reference in New Issue