Simple RPC for modifying the Graffiti bytes

This commit is contained in:
Zahary Karadjov 2021-03-26 19:42:20 +02:00
parent 74732a23fe
commit 1af07ad124
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
3 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,10 @@
TBD TBD
================== ==================
**New features:**
* Added the `setGraffiti` RPC (POST /api/nimbus/v1/graffiti in the REST API)
**Breaking changes:** **Breaking changes:**
* Renamed some semi-internal debug rpc to be more explicit about their nature: * Renamed some semi-internal debug rpc to be more explicit about their nature:

View File

@ -87,6 +87,10 @@ proc installNimbusApiHandlers*(rpcServer: RpcServer, node: BeaconNode) {.
updateLogLevel(level) updateLogLevel(level)
return true return true
rpcServer.rpc("setGraffiti") do (graffiti: string) -> bool:
node.graffitiBytes = GraffitiBytes.init(graffiti)
return true
rpcServer.rpc("getEth1Chain") do () -> seq[Eth1Block]: rpcServer.rpc("getEth1Chain") do () -> seq[Eth1Block]:
result = if node.eth1Monitor != nil: result = if node.eth1Monitor != nil:
mapIt(node.eth1Monitor.blocks, it) mapIt(node.eth1Monitor.blocks, it)
@ -154,7 +158,6 @@ proc installNimbusApiHandlers*(rpcServer: RpcServer, node: BeaconNode) {.
for peer in v: for peer in v:
peers.add(peer.toNode(backOff.getOrDefault(peer.peerId))) peers.add(peer.toNode(backOff.getOrDefault(peer.peerId)))
gossipsub.add(topic, peers) gossipsub.add(topic, peers)
res.add("gossipsub", gossipsub) res.add("gossipsub", gossipsub)

View File

@ -333,6 +333,15 @@ Set the current logging level dynamically: TRACE, DEBUG, INFO, NOTICE, WARN, ERR
curl -d '{"jsonrpc":"2.0","id":"id","method":"setLogLevel","params":["DEBUG; TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none"] }' -H 'Content-Type: application/json' localhost:9190 -s | jq curl -d '{"jsonrpc":"2.0","id":"id","method":"setLogLevel","params":["DEBUG; TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none"] }' -H 'Content-Type: application/json' localhost:9190 -s | jq
``` ```
### setGraffiti
Set the graffiti bytes that will be included in proposed blocks. The graffiti bytes can be
specified as an UTF-8 encoded string or as an 0x-prefixed hex string specifying raw bytes.
```
curl -d '{"jsonrpc":"2.0","id":"id","method":"setGraffiti","params":["Mr F was here"] }' -H 'Content-Type: application/json' localhost:9190 -s | jq
```
### getEth1Chain ### getEth1Chain
Get the list of Eth1 blocks that the beacon node is currently storing in memory. Get the list of Eth1 blocks that the beacon node is currently storing in memory.