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

VC: Fix graffiti settings #6946

Merged
merged 4 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all 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: 4 additions & 9 deletions beacon_chain/rpc/rest_key_management_api.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Copyright (c) 2021-2025 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).
Expand Down Expand Up @@ -667,15 +667,10 @@ proc installKeymanagerHandlers*(router: var RestRouter, host: KeymanagerHost) =
decodeBody(SetGraffitiRequest, contentBody.get()).valueOr:
return keymanagerApiError(Http400, InvalidGraffitiRequestError)

if not(host.checkValidatorKeystoreDir(pubkey)):
return keymanagerApiError(Http404, ValidatorNotFoundError)
host.setGraffiti(pubkey, GraffitiBytes.init(req.graffiti)).isOkOr:
return keymanagerApiError(Http500, "Failed to set graffiti: " & error)

let status = host.setGraffiti(pubkey, GraffitiBytes.init(req.graffiti))
if status.isOk:
RestApiResponse.response(Http202)
else:
keymanagerApiError(
Http500, "Failed to set graffiti: " & status.error)
RestApiResponse.response(Http202)

# https://ethereum.github.io/keymanager-APIs/?urls.primaryName=dev#/Graffiti/deleteGraffiti
router.api2(MethodDelete, "/eth/v1/validator/{pubkey}/graffiti") do (
Expand Down
8 changes: 2 additions & 6 deletions beacon_chain/validator_client/block_service.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Copyright (c) 2021-2025 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).
Expand Down Expand Up @@ -107,11 +107,7 @@ proc publishBlockV3(
) {.async: (raises: [CancelledError]).} =
let
genesisRoot = vc.beaconGenesis.genesis_validators_root
graffiti =
if vc.config.graffiti.isSome():
vc.config.graffiti.get()
else:
defaultGraffitiBytes()
graffiti = vc.getGraffitiBytes(validator)
vindex = validator.index.get()

logScope:
Expand Down
Loading