diff --git a/beacon_chain/consensus_object_pools/spec_cache.nim b/beacon_chain/consensus_object_pools/spec_cache.nim index 171d5ead8..08c448ff4 100644 --- a/beacon_chain/consensus_object_pools/spec_cache.nim +++ b/beacon_chain/consensus_object_pools/spec_cache.nim @@ -99,21 +99,30 @@ iterator get_attesting_indices*(shufflingRef: ShufflingRef, if bits[index_in_committee]: yield validator_index -# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.0/specs/electra/beacon-chain.md#modified-get_attesting_indices -iterator get_attesting_indices*(shufflingRef: ShufflingRef, - slot: Slot, - committee_bits: AttestationCommitteeBits, - aggregation_bits: ElectraCommitteeValidatorsBits, on_chain: static bool): - ValidatorIndex = +# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.10/specs/electra/beacon-chain.md#modified-get_attesting_indices +iterator get_attesting_indices*( + shufflingRef: ShufflingRef, slot: Slot, + committee_bits: AttestationCommitteeBits, + aggregation_bits: ElectraCommitteeValidatorsBits, on_chain: static bool): + ValidatorIndex = when on_chain: - var pos = 0 - for committee_index in get_committee_indices(committee_bits): - for _, validator_index in get_beacon_committee( - shufflingRef, slot, committee_index): + var committee_offset = 0 + for committee_index in committee_bits.oneIndices: + if not (committee_index.uint64 < + get_committee_count_per_slot(shufflingRef)): + continue # invalid attestation, but found in check_attestation() + let committee = get_beacon_committee( + shufflingRef, slot, committee_index.CommitteeIndex) - if aggregation_bits[pos]: - yield validator_index - pos += 1 + if aggregation_bits.len < committee_offset + len(committee): + # Would overflow, invalid attestation caught in check_attestation() + continue + + for i, attester_index in committee: + if aggregation_bits[committee_offset + i]: + yield attester_index + + committee_offset += len(committee) else: let committee_index = get_committee_index_one(committee_bits) for validator_index in get_attesting_indices( diff --git a/beacon_chain/nimbus_light_client.nim b/beacon_chain/nimbus_light_client.nim index 917e9b207..08cc071ae 100644 --- a/beacon_chain/nimbus_light_client.nim +++ b/beacon_chain/nimbus_light_client.nim @@ -162,7 +162,7 @@ programMain: db.putSyncCommittee(period, syncCommittee) db.putLatestFinalizedHeader(finalizedHeader) - var optimisticFcuFut: Future[(PayloadExecutionStatus, Opt[BlockHash])] + var optimisticFcuFut: Future[(PayloadExecutionStatus, Opt[Hash32])] .Raising([CancelledError]) proc onOptimisticHeader( lightClient: LightClient, optimisticHeader: ForkedLightClientHeader) = diff --git a/beacon_chain/spec/crypto.nim b/beacon_chain/spec/crypto.nim index c164d797e..cb8747d28 100644 --- a/beacon_chain/spec/crypto.nim +++ b/beacon_chain/spec/crypto.nim @@ -7,10 +7,6 @@ {.push raises: [].} -# At the time of writing, the exact definitions of what should be used for -# cryptography in the spec is in flux, with sizes and test vectors still being -# hashed out. This layer helps isolate those chagnes. - # BLS signatures can be combined such that multiple signatures are aggregated. # Each time a new signature is added, the corresponding public key must be # added to the verification key as well - if a key signs twice, it must be added diff --git a/beacon_chain/sync/request_manager.nim b/beacon_chain/sync/request_manager.nim index 826f8f9bf..34180db34 100644 --- a/beacon_chain/sync/request_manager.nim +++ b/beacon_chain/sync/request_manager.nim @@ -164,7 +164,7 @@ proc checkResponse(idList: seq[DataColumnIdentifier], block_root = hash_tree_root(columns[i].signed_block_header.message) id = idList[i] - # Check if the column reponse is a subset + # Check if the column response is a subset if binarySearch(idList, columns[i], cmpSidecarIdentifier) == -1: return false diff --git a/docs/the_nimbus_book/src/validator-client-options.md b/docs/the_nimbus_book/src/validator-client-options.md index 4c78677a5..b0908662b 100644 --- a/docs/the_nimbus_book/src/validator-client-options.md +++ b/docs/the_nimbus_book/src/validator-client-options.md @@ -1,8 +1,8 @@ # Validator client -In the most simple setup, a single beacon node paired with an execution client is all that is needed to run a successful validator setup. +In the simplest setup, a single beacon node paired with an execution client is all that is needed to run a successful validator setup. -Nimbus however also provides options for running advanded setups that provide additional security and redundancy. +Nimbus however also provides options for running advanced setups that provide additional security and redundancy. See the [validator client page](./validator-client.md) to get started! diff --git a/ncli/ncli_split_keystore.nim b/ncli/ncli_split_keystore.nim index ce911a6d9..534c12217 100644 --- a/ncli/ncli_split_keystore.nim +++ b/ncli/ncli_split_keystore.nim @@ -5,6 +5,8 @@ # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. +{.push raises: [].} + import std/os, confutils, @@ -45,9 +47,14 @@ type name: "out-dir" }: OutDir proc main = - let conf = load Config + let conf = + try: + load Config + except ConfigurationError: + error "Configuration error" + quit 1 if conf.threshold == 0: - error "The specified treshold must be greater than zero" + error "The specified threshold must be greater than zero" quit 1 if conf.remoteSignersUrls.len == 0: @@ -55,7 +62,7 @@ proc main = quit 1 if conf.threshold > conf.remoteSignersUrls.len.uint32: - error "The specified treshold must be lower or equal to the number of signers" + error "The specified threshold must be lower or equal to the number of signers" quit 1 let rng = HmacDrbgContext.new()