diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index 0d4acc123..b2f1d8dab 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -1256,7 +1256,7 @@ proc readValue*(r: var TomlReader, value: var GraffitiBytes) {.raises: [Defect, SerializationError, IOError].} = try: value = GraffitiBytes.init(r.readValue(string)) - except ValueError as err: + except ValueError: r.raiseUnexpectedValue("A printable string or 0x-prefixed hex-encoded raw bytes expected") proc readValue*(r: var TomlReader, val: var NatConfig) diff --git a/beacon_chain/era_db.nim b/beacon_chain/era_db.nim index 035c293b4..dcea515a3 100644 --- a/beacon_chain/era_db.nim +++ b/beacon_chain/era_db.nim @@ -151,7 +151,7 @@ proc getStateSSZ*( else: len bytes = newSeqUninitialized[byte](wanted) - let (_, written) = uncompressFramed(tmp, bytes).valueOr: + discard uncompressFramed(tmp, bytes).valueOr: return err("State failed to decompress, era file corrupt?") ok() @@ -384,7 +384,7 @@ proc getPartialState( try: readSszBytes(tmp.toOpenArray(0, partialBytes - 1), output) true - except CatchableError as exc: + except CatchableError: # TODO log? false diff --git a/beacon_chain/networking/network_metadata.nim b/beacon_chain/networking/network_metadata.nim index 2e48128bb..19875b12c 100644 --- a/beacon_chain/networking/network_metadata.nim +++ b/beacon_chain/networking/network_metadata.nim @@ -255,9 +255,6 @@ elif const_preset == "mainnet": {.compile: "network_metadata_mainnet.S".} const - eth2NetworksDir = vendorDir & "/eth2-networks" - sepoliaDir = vendorDir & "/sepolia" - mainnetMetadata = loadCompileTimeNetworkMetadata( vendorDir & "/eth2-networks/shared/mainnet", some mainnet, not incbinEnabled) praterMetadata = loadCompileTimeNetworkMetadata( diff --git a/beacon_chain/nimbus_signing_node.nim b/beacon_chain/nimbus_signing_node.nim index ce68045f7..115aade5f 100644 --- a/beacon_chain/nimbus_signing_node.nim +++ b/beacon_chain/nimbus_signing_node.nim @@ -45,7 +45,7 @@ type SigningNodeError* = object of CatchableError -proc validate(key: string, value: string): int = +func validate(key: string, value: string): int = case key of "{validator_key}": 0 diff --git a/beacon_chain/rpc/rest_constants.nim b/beacon_chain/rpc/rest_constants.nim index 0387f412f..871d7e53f 100644 --- a/beacon_chain/rpc/rest_constants.nim +++ b/beacon_chain/rpc/rest_constants.nim @@ -183,8 +183,6 @@ const "No Finalized Snapshot Available" NoImplementationError* = "Not implemented yet" - KeystoreAdditionFailure = - "Could not add some keystores" InvalidKeystoreObjects* = "Invalid keystore objects found" InvalidValidatorPublicKey* = diff --git a/beacon_chain/spec/datatypes/base.nim b/beacon_chain/spec/datatypes/base.nim index 6e176e657..fb5ddac35 100644 --- a/beacon_chain/spec/datatypes/base.nim +++ b/beacon_chain/spec/datatypes/base.nim @@ -595,7 +595,7 @@ template makeLimitedUInt*(T: untyped, limit: SomeUnsignedInt) = template asUInt64*(x: T): uint64 = uint64(distinctBase(x)) template toSszType(x: T): uint64 = - {.error: "Limited types should not be used with SSZ (abi differences)".} + {.error: "Limited types should not be used with SSZ (ABI differences)".} template makeLimitedU8*(T: untyped, limit: uint8) = makeLimitedUInt(T, limit) diff --git a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim index d50004c28..df9257114 100644 --- a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim +++ b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim @@ -670,7 +670,7 @@ proc readValue*(reader: var JsonReader[RestJson], for e in reader.readArray(string): let parsed = try: parseBiggestUInt(e) - except ValueError as err: + except ValueError: reader.raiseUnexpectedValue( "A string-encoded 8-bit usigned integer value expected") @@ -2707,7 +2707,7 @@ proc readValue*(reader: var JsonReader[RestJson], let key = try: parseKeystore(item) - except SerializationError as exc: + except SerializationError: # TODO re-raise the exception by adjusting the column index, so the user # will get an accurate syntax error within the larger message reader.raiseUnexpectedValue("Invalid keystore format") @@ -2722,7 +2722,7 @@ proc readValue*(reader: var JsonReader[RestJson], SPDIR, requireAllFields = true, allowUnknownFields = true) - except SerializationError as exc: + except SerializationError: reader.raiseUnexpectedValue("Invalid slashing protection format") some(db) else: diff --git a/beacon_chain/spec/keystore.nim b/beacon_chain/spec/keystore.nim index 8942e363a..8d26571f7 100644 --- a/beacon_chain/spec/keystore.nim +++ b/beacon_chain/spec/keystore.nim @@ -887,13 +887,6 @@ proc readValue*(reader: var JsonReader, value: var RemoteKeystore) if provenBlockProperties.isNone: reader.raiseUnexpectedValue("The required field `proven_block_properties` is missing") - let keystoreFlags = - block: - var res: set[RemoteKeystoreFlag] - if ignoreSslVerification.isSome(): - res.incl(RemoteKeystoreFlag.IgnoreSSLVerification) - res - value = case remoteType.get(RemoteSignerType.Web3Signer) of RemoteSignerType.Web3Signer: RemoteKeystore( diff --git a/beacon_chain/validators/keystore_management.nim b/beacon_chain/validators/keystore_management.nim index 7cc20326d..9af0e6080 100644 --- a/beacon_chain/validators/keystore_management.nim +++ b/beacon_chain/validators/keystore_management.nim @@ -258,44 +258,6 @@ proc checkAndCreateDataDir*(dataDir: string): bool = return true -proc checkSensitivePathPermissions(dirFilePath: string): bool = - ## If ``dirFilePath`` is file, then check if file has only - ## - ## - "(600) rwx------" permissions on Posix (Linux, MacOS, BSD) - ## - current user only ACL on Windows - ## - ## If ``dirFilePath`` is directory, then check if directory has only - ## - ## - "(700) rwx------" permissions on Posix (Linux, MacOS, BSD) - ## - current user only ACL on Windows - ## - ## Procedure returns ``true`` if directory/file is present and all required - ## permissions are set. - let r1 = isDir(dirFilePath) - let r2 = isFile(dirFilePath) - if r1 or r2: - when defined(windows): - let res = checkCurrentUserOnlyACL(dirFilePath) - if res.isErr(): - false - else: - if res.get() == false: - false - else: - true - else: - let requiredPermissions = if r1: 0o700 else: 0o600 - let res = getPermissions(dirFilePath) - if res.isErr(): - false - else: - if res.get() != requiredPermissions: - false - else: - true - else: - false - proc checkSensitiveFilePermissions*(filePath: string): bool = ## Check if ``filePath`` has only "(600) rw-------" permissions. ## Procedure returns ``false`` if permissions are different and we can't @@ -711,7 +673,6 @@ iterator listLoadableKeystores*(validatorsDir, secretsDir: string, let keyName = splitFile(file).name keystoreDir = validatorsDir / keyName - keystoreFile = keystoreDir / KeystoreFileName if not(checkKeyName(keyName)): # Skip folders which name do not satisfy "0x[a-fA-F0-9]{96, 96}". @@ -722,7 +683,6 @@ iterator listLoadableKeystores*(validatorsDir, secretsDir: string, continue let - secretFile = secretsDir / keyName keystore = loadKeystore(validatorsDir, secretsDir, keyName, nonInteractive, cache).valueOr: fatal "Unable to load keystore", keystore = file @@ -1282,14 +1242,6 @@ proc saveKeystore*( let remoteInfo = RemoteSignerInfo(url: url, id: 0) saveKeystore(validatorsDir, publicKey, @[remoteInfo], 1) -proc saveLockedKeystore( - validatorsDir: string, - publicKey: ValidatorPubKey, - url: HttpHostUri - ): Result[FileLockHandle, KeystoreGenerationError] {.raises: [Defect].} = - let remoteInfo = RemoteSignerInfo(url: url, id: 0) - saveLockedKeystore(validatorsDir, publicKey, @[remoteInfo], 1) - proc importKeystore*(pool: var ValidatorPool, validatorsDir: string, keystore: RemoteKeystore): ImportResult[KeystoreData] @@ -1298,7 +1250,6 @@ proc importKeystore*(pool: var ValidatorPool, publicKey = keystore.pubkey keyName = publicKey.fsName keystoreDir = validatorsDir / keyName - keystoreFile = keystoreDir / RemoteKeystoreFileName # We check `publicKey`. let cookedKey = publicKey.load().valueOr: @@ -1340,9 +1291,7 @@ proc importKeystore*(pool: var ValidatorPool, let publicKey = privateKey.toPubKey() keyName = publicKey.fsName - secretFile = secretsDir / keyName keystoreDir = validatorsDir / keyName - keystoreFile = keystoreDir / KeystoreFileName # We check `publicKey` in memory storage first. if publicKey.toPubKey() in pool: diff --git a/beacon_chain/validators/validator_monitor.nim b/beacon_chain/validators/validator_monitor.nim index b4b3219d1..53b7a3472 100644 --- a/beacon_chain/validators/validator_monitor.nim +++ b/beacon_chain/validators/validator_monitor.nim @@ -779,7 +779,6 @@ proc registerSyncContribution*( participants: openArray[ValidatorIndex]) = let slot = contribution_and_proof.contribution.slot - beacon_block_root = contribution_and_proof.contribution.beacon_block_root delay = seen_timestamp - slot.sync_contribution_deadline() let aggregator_index = contribution_and_proof.aggregator_index diff --git a/ncli/e2store.nim b/ncli/e2store.nim index 3047b1dd8..8763c5669 100644 --- a/ncli/e2store.nim +++ b/ncli/e2store.nim @@ -26,11 +26,6 @@ const SnappyBeaconBlock* = [byte 0x01, 0x00] SnappyBeaconState* = [byte 0x02, 0x00] - TypeFieldLen = 2 - LengthFieldLen = 4 - ReservedFieldLen = 2 - HeaderFieldLen = TypeFieldLen + LengthFieldLen + ReservedFieldLen - FAR_FUTURE_ERA* = Era(not 0'u64) type