Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some fail tips on nimbus_beacon_node deposits import #6270

Open
wants to merge 6 commits into
base: unstable
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion beacon_chain/validators/keystore_management.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1811,18 +1811,27 @@ proc importKeystoresFromDir*(rng: var HmacDrbgContext, meth: ImportMethod,
burnMem(singleSaltSalt)

try:
for file in walkDirRec(importedDir):
let importedFiles = walkDirRec(importedDir).toSeq
if importedFiles.len == 0:
fatal "No keystore file found at kyes path"
tersec marked this conversation as resolved.
Show resolved Hide resolved
xalexec marked this conversation as resolved.
Show resolved Hide resolved
var invalidFlag = false
xalexec marked this conversation as resolved.
Show resolved Hide resolved
var hasValid = false
for file in importedFiles:
let filenameParts = splitFile(file)
if toLowerAscii(filenameParts.ext) != ".json":
invalidFlag = true
continue

# In case we are importing from eth2.0-deposits-cli, the imported
# validator_keys directory will also include a "deposit_data" file
# intended for uploading to the launchpad. We'll skip it to avoid
# the "Invalid keystore" warning that it will trigger.
if filenameParts.name.startsWith("deposit_data"):
invalidFlag = true
continue

hasValid = true

let keystore =
try:
Json.loadFile(file, Keystore,
Expand Down Expand Up @@ -1892,6 +1901,8 @@ proc importKeystoresFromDir*(rng: var HmacDrbgContext, meth: ImportMethod,

if password.len == 0:
break
if not hasValid and invalidFlag:
fatal "Not found valid file,the keystore file must ending by .json and not start with deposit_data"
tersec marked this conversation as resolved.
Show resolved Hide resolved
xalexec marked this conversation as resolved.
Show resolved Hide resolved
except OSError:
fatal "Failed to access the imported deposits directory"
quit 1
Expand Down
Loading