Skip to content

Commit

Permalink
rewrite verify_rights
Browse files Browse the repository at this point in the history
  • Loading branch information
NicNomadic committed Dec 9, 2024
1 parent 004d400 commit 40932e4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 38 deletions.
8 changes: 8 additions & 0 deletions docs/tutorials/join-dal-baker/run-baker.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ The amount of tez that the account stakes determines how often it is called on t
Therefore, staking more tez brings more rewards but does not reduce the attestation delay.

:::

## Checking for (pre-)attestations

After the delay computed above has passed, **the baker log** (not the Octez node log, neither the DAL node log) should contain lines about:

- Consensus pre-attestations: `injected preattestation ...`
- Consensus attestations: `injected attestation ...`
- Attach DAL attestations: `ready to attach DAL attestation ...`
77 changes: 39 additions & 38 deletions docs/tutorials/join-dal-baker/verify-rights.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
---
title: "Step 5: Verify attestation rights"
title: "Step 5: Troubleshooting"
authors: Tezos core developers, Tim McMackin
last_update:
date: 2 December 2024
---

After the delay that you calculated in [Step 4: Run an Octez baking daemon](/tutorials/join-dal-baker/run-baker), the baker starts receiving attestation rights, including the rights to attest that DAL data is available.

Follow these steps to verify that your DAL node is receiving attestation rights:
If after the delay that you calculated in [Step 4: Run an Octez baking daemon](/tutorials/join-dal-baker/run-baker), the baker does not starts inserting consensus (pre-)attestations and DAL attestations, follow these instructions to diagnose and fix the issue.

1. Record the address of your baker account in an environment variable so you can use it for commands that cannot get addresses by their Octez client aliases:

```bash
MY_BAKER="$(octez-client show address my_baker | head -n 1 | cut -d ' ' -f 2)"
```

1. Run these commands to get the attestation rights for the baker in the current cycle:
1. Run these commands to get the (consensus) attestation rights for the baker in the current cycle:

1. Get the current cycle by running this command:

Expand Down Expand Up @@ -43,25 +41,39 @@ Follow these steps to verify that your DAL node is receiving attestation rights:
```
If the command returns an empty array (`[]`), the baker has no rights in the specified cycle.
In this case, the delay may not be over or there may be other problems.
Try these troubleshooting steps:
- Make sure that your node and baker are running.
- Check to see if you will receive rights two cycles in the future, using commands similar to those above for the current cycle.
You can see who will receive rights no farther than two cycles in the future.
This number of cycles is set by the `consensus_rights_delay` network parameter.
If this returns a list of future attestation rights for your account, you must wait for that cycle to arrive.
- Verify that your DAL node is connected to the network by following the instructions in [Troubleshooting](https://tezos.gitlab.io/shell/dal_run.html#troubleshooting) in the Octez documentation.
- Otherwise, make sure that your node and baker are running.
- Verify that the staked balance of your account is at least 6,000 tez by running the command `octez-client get staked balance for my_baker`.
If the response is less than 6,000 tez, you have not staked enough.
Ensure that you are registered as a delegate and stake more tez, retaining a small amount for transaction fees.
If necessary you can get more from the faucet.
- Check to see if you will receive rights two cycles in the future, using commands similar to those above for the current cycle.
You can see who will receive rights no farther than two cycles in the future.
This number of cycles is set by the `consensus_rights_delay` network parameter.
- Check to see if you are active and re-register as a delegate if necessary:
1. Run this command to see if your account is marked as inactive:
If this returns a list of future attestation rights for your account, the delay has not expired yet and you must wait for that cycle to arrive.
```bash
octez-client rpc get /chains/main/blocks/head/context/delegates/$MY_BAKER/deactivated
```
Baker accounts are deactivated when the baker is offline for a certain time.
1. If the value for the `deactivated` field is `true`, re-register as a baker by running this command:
```bash
octez-client register key my_baker as delegate
```
You can find when the next cycle will start by running these commands:
When the next cycle starts, Tezos calculates attestation rights for two cycles in the future and includes your baker.
You can find when the next cycle will start by running these commands:
1. Find the last level of the current cycle by running this command:
Expand All @@ -78,33 +90,15 @@ Follow these steps to verify that your DAL node is receiving attestation rights:
The response shows the estimated time when the cycle will end.
You can also find when the next cycle will start by going to a block explorer such as https://ghostnet.tzkt.io.
For example, this drop-down shows that the next cycle starts in 29 minutes:
You can also find when the next cycle will start by going to a block explorer such as https://ghostnet.tzkt.io.
For example, this drop-down shows that the next cycle starts in 29 minutes:
<img src="/img/tutorials/tzkt-next-cycle.png" alt="The TZKT block explorer, showing information about the current cycle" style={{width: 300}} />
Wait for your baker to receive attestation rights.
- Check to see if you are active and re-register as a delegate if necessary:
1. Run this command to see if your account is marked as inactive:
```bash
octez-client rpc get /chains/main/blocks/head/context/delegates/$MY_BAKER/deactivated
```
Baker accounts are deactivated when the baker is offline for a certain time.
1. If the value for the `deactivated` field is `true`, re-register as a baker by running this command:
```bash
octez-client register key my_baker as delegate
```
1. When your baker receives attestation rights as determined by the `/chains/main/blocks/head/helpers/attestation_rights` RPC call, run this command to get the shards that are assigned to your DAL node:
1. When your baker receives attestation rights as determined by the `/chains/main/blocks/head/helpers/attestation_rights` RPC call, run this command to get the shards that are assigned to your DAL node for the next block:
```bash
octez-client rpc get /chains/main/blocks/head/context/dal/shards?delegates=$MY_BAKER
octez-client rpc get "/chains/main/blocks/head/context/dal/shards?delegates=$MY_BAKER"
```
The response includes your account's address and a list of shards, as in this example:
Expand All @@ -116,6 +110,9 @@ Follow these steps to verify that your DAL node is receiving attestation rights:
These shards are pieces of data that the baker is assigned to attest.
Note that you have to potentially execute the command above during many block levels in order to find a block where you have some shards assigned.
Unfortunately, there is currently no simple command line to get all your DAL rights for a whole cycle, for example.
1. Verify the baker's activity on the Explorus block explorer by going to the Consensus Ops page at https://explorus.io/consensus_ops, selecting Ghostnet, and searching for your address.
For example, this screenshot shows consensus operations that include DAL attestations, indicated by a number in the "DAL attestation bitset" column.
Expand All @@ -125,8 +122,12 @@ Follow these steps to verify that your DAL node is receiving attestation rights:
If there is no DAL attestation, the block explorer shows a document icon with an X in it: ![](/img/tutorials/dal-explorus-no-attestation-icon.png).
This icon can appear before the bakers complete attestations and then turn into a binary number when they attest.
Now you have a complete DAL baking setup.
Your baker is attesting to the availability of DAL data and the DAL node is sharing it to Smart Rollups across the network.
If you see the rights, you will see the attestations in the baker's log when scheduled. Now you have a complete DAL baking setup.
Your baker is attesting to the availability of DAL data and the DAL node is sharing it to Smart Rollups across the network.
If you don't see DAL attestation rights:
- Verify that your DAL node is connected to the network by following the instructions in [Troubleshooting](https://tezos.gitlab.io/shell/dal_run.html#troubleshooting) in the Octez documentation.
## Optional: Unstaking your tez and receiving your baking rewards
Expand Down

0 comments on commit 40932e4

Please sign in to comment.