rm unused/bitrotted ncli_query (#6618)

This commit is contained in:
tersec 2024-10-10 05:22:44 +00:00 committed by GitHub
parent 5418b8375a
commit 6e610f64e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 66 deletions

View File

@ -52,7 +52,6 @@ else
endif
# unconditionally built by the default Make target
# TODO re-enable ncli_query if/when it works again
TOOLS_CORE_CUSTOMCOMPILE := \
libnimbus_lc.a

View File

@ -1,65 +0,0 @@
# beacon_chain
# Copyright (c) 2020-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * 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.
import
std/[os, strutils],
confutils, json_serialization,
stew/byteutils,
../beacon_chain/spec/[crypto, datatypes]
type
QueryCmd* = enum
nimQuery
get
QueryConf = object
file* {.
defaultValue: ""
desc: "BeaconState ssz file"
name: "file" }: InputFile
case queryCmd* {.
defaultValue: nimQuery
command
desc: "Query the beacon node database and print the result" }: QueryCmd
of nimQuery:
nimQueryExpression* {.
argument
desc: "Nim expression to evaluate (using limited syntax)" }: string
of get:
getQueryPath* {.
argument
desc: "REST API path to evaluate" }: string
let
config = QueryConf.load()
case config.queryCmd
of QueryCmd.nimQuery:
# TODO: This will handle a simple subset of Nim using
# dot syntax and `[]` indexing.
echo "nim query: ", config.nimQueryExpression
of QueryCmd.get:
let pathFragments = config.getQueryPath.split('/', maxsplit = 1)
let bytes =
case pathFragments[0]
of "genesis_state":
readFile(config.file.string).string.toBytes()
else:
stderr.write config.getQueryPath & " is not a valid path"
quit 1
# TODO nasty compile error here
# /home/arnetheduck/status/nim-beacon-chain/beacon_chain/ssz/navigator.nim(45, 50) template/generic instantiation of `getFieldBoundingOffsets` from here
# Error: internal error: (filename: "semtypes.nim", line: 1864, column: 21)
# let navigator = DynamicSszNavigator.init(bytes, BeaconState)
# echo navigator.navigatePath(pathFragments[1 .. ^1]).toJson