diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index 0ce93a1ca..c6308d0fd 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -195,12 +195,6 @@ type desc: "Number of worker threads (\"0\" = use as many threads as there are CPU cores available)" name: "num-threads" }: int - useJwt* {. - hidden - desc: "Enable JWT authentication headers; temporary option feature gate (debugging; option may be remove without warning)", - defaultValue: true - name: "use-jwt-debug" }: bool - # https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.8/src/engine/authentication.md#key-distribution jwtSecret* {. desc: "A file containing the hex-encoded 256 bit secret key to be used for verifying/generating jwt tokens" diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 53b78c4d1..d5909b378 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -405,7 +405,7 @@ proc init*(T: type BeaconNode, quit 1 let optJwtSecret = - if config.useJwt: + block: let jwtSecret = rng[].checkJwtSecret( string(config.dataDir), config.jwtSecret) if jwtSecret.isErr: @@ -414,8 +414,6 @@ proc init*(T: type BeaconNode, quit 1 some jwtSecret.get - else: - none(seq[byte]) template getDepositContractSnapshot: auto = if depositContractSnapshot.isSome: @@ -1775,7 +1773,7 @@ proc doCreateTestnet*(config: BeaconNodeConf, rng: var BrHmacDrbgContext) {.rais eth1Hash = if config.web3Urls.len == 0: eth1BlockHash else: (waitFor getEth1BlockHash( config.web3Urls[0], blockId("latest"), - if config.useJwt: + block: let jwtSecret = rng.checkJwtSecret( string(config.dataDir), config.jwtSecret) if jwtSecret.isErr: @@ -1783,9 +1781,7 @@ proc doCreateTestnet*(config: BeaconNodeConf, rng: var BrHmacDrbgContext) {.rais err = jwtSecret.error quit 1 - some jwtSecret.get - else: - none(seq[byte]))).asEth2Digest + some jwtSecret.get)).asEth2Digest cfg = getRuntimeConfig(config.eth2Network) var initialState = newClone(initialize_beacon_state_from_eth1( @@ -1866,7 +1862,7 @@ proc doWeb3Cmd(config: BeaconNodeConf, rng: var BrHmacDrbgContext) waitFor testWeb3Provider(config.web3TestUrl, metadata.cfg.DEPOSIT_CONTRACT_ADDRESS, - if config.useJwt: + block: let jwtSecret = rng.checkJwtSecret( string(config.dataDir), config.jwtSecret) @@ -1874,9 +1870,7 @@ proc doWeb3Cmd(config: BeaconNodeConf, rng: var BrHmacDrbgContext) fatal "Specified a JWT secret file which couldn't be loaded", err = jwtSecret.error quit 1 - some jwtSecret.get - else: - none(seq[byte])) + some jwtSecret.get) proc doSlashingExport(conf: BeaconNodeConf) {.raises: [IOError, Defect].}= let