Live-testing Adaptive Issuance and Adaptive Slashing on Weeklynet

Day 3 report

Here is a summary of the scenario executed today.

Today’s scenario showcases:

  • Effects of double baking/denunciations/slashing

Important note on double baking:
Both octez-node and octez-baker are equipped with numerous safety mechanisms designed to prevent instances of double baking or double attestation. However, for today’s experiment, we deliberately configured a specific system to induce double baking. Achieving this required us to adjust our configurations, consciously deviating from recommendations and default parameters. It’s important to note that we will not delve into these settings in this report, and we wish to emphasize that double baking (as well as double attesting) is considered a misbehavior that poses a risk to the chain’s integrity, and as such, is subject to penalties and slashing. We strongly advise against attempting to replicate this particular experiment.

Delegate Actions

  • delegate1 updated staking parameters edge-of-baking-over-staking to 0.5 and limit-of-staking-over-baking to 5 on block #27,713.
  • delegate1 staked 3,000 tez on block #27,715.
  • delegate2 started a second baker on block #27,718.

Observations

  • updating staking parameters: following yesterday’s actions, the effect of changing delegate staking parameters can be observed by querying the operation content on the corresponding level.

  • double baking: double baking can be observed live either by running an alpha accuser binary, or by observing the blocks received by an Octez node. Once the chain has reached consensus on its new head, using the /chains/main/blocks/<level> RPC endpoint will only show the selected block. However, once a denunciation operation has been included in a succesor block, it can be observed via delegates’ RPC entrypoints. For example, a denunciation of delegate2’s double-baking can be observed using the following query:

 octez-client rpc get /chains/main/blocks/31046/context/delegates/tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT/denunciations

[ { "operation_hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT",
    "rewarded": "tz1VXDXJKNZ6Vd8WGoSyrfEXNpManegYm7gd",
    "misbehaviour": { "level": 30988, "round": 0, "kind": "block" } } ]

This query shows the concerned level – here, #30,988 – as well as the hash of the denunciation operation.

In this example, the denunciation operation was included at level #30,989 (just after our delegate misbehaved) and its details can be observed using usual block content queries.

octez-client rpc get /chains/main/blocks/30989/operations/2

[ { "protocol": "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK",
    "chain_id": "NetY1QgDPf4tnp3",
    "hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT",
    "branch": "BLAj4g2A92CXRwkGuKUvgfBghYWGHvsV7tZvKrh3DiMxTYy6wCx",
    "contents":
      [ { "kind": "double_baking_evidence",
          "bh1":
            { "level": 30988, "proto": 2,
              "predecessor":
                "BL2JDK6ABvDpMUYV8dyJ8xeaGpaeUzvSNikQjXRELPhCgJLM5dr",
              "timestamp": "2024-03-01T15:06:45Z", "validation_pass": 4,
              "operations_hash":
                "LLoZSMZQEkdSkbJ1zSsaM2M66mys689aUWSAmL29bW447dkQzRCt7",
              "fitness": [ "02", "0000790c", "", "ffffffff", "00000000" ],
              "context":
                "CoVpwvgxqjiyHuDZjmoF2q7pVKtPzWQtoE7mwL2JSweff3BDqAf8",
              "payload_hash":
                "vh2cAMGdJpYDPtQmC4TJY7MRaPiCFDFgbovotTA4oA2tAUSHYain",
              "payload_round": 0, "proof_of_work_nonce": "4b10075700000000",
              "liquidity_baking_toggle_vote": "pass",
              "adaptive_issuance_vote": "on",
              "signature":
                "sigXgX9MxD7cNudAiqAUWsGZJPP51r3HfP5GewEmwPn3m4aAGdQHJt25DGoi4K71u9CrANAqjGi3wUdNoFoKJqDRNiPZiiyp" },
          "bh2":
            { "level": 30988, "proto": 2,
              "predecessor":
                "BL2JDK6ABvDpMUYV8dyJ8xeaGpaeUzvSNikQjXRELPhCgJLM5dr",
              "timestamp": "2024-03-01T15:06:45Z", "validation_pass": 4,
              "operations_hash":
                "LLoapWr6xBACqgUp3rKabCFZaAdr7QrpXWimXwrpRCtgdeCj7Q5Yt",
              "fitness": [ "02", "0000790c", "", "ffffffff", "00000000" ],
              "context":
                "CoVpwvgxqjiyHuDZjmoF2q7pVKtPzWQtoE7mwL2JSweff3BDqAf8",
              "payload_hash":
                "vh2cAMGdJpYDPtQmC4TJY7MRaPiCFDFgbovotTA4oA2tAUSHYain",
              "payload_round": 0, "proof_of_work_nonce": "4b10075700000000",
              "liquidity_baking_toggle_vote": "pass",
              "adaptive_issuance_vote": "on",
              "signature":
                "sigNzTeoA8Ezy9qwje1D8pquEpPSHgXZKRRxEPCHLfsMECyvrkpyoRWeQToiJbnyXmHiSKgBWLEiDEhdcZNThm2FAyoGy53h" },
          "metadata":
            { "forbidden_delegate": "tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT" } } ] } ]

Once denunced, delegate2 became forbidden and could no longer participate in consensus. This means that its (pre)attestations and block proposals were refused by the Tezos protocol until the delegate had been slashed and then unforbidden. This interdiction is lifted once all pending slashes have been applied and the delegate has enough frozen deposits to insure their baking rights for the next cycle. This will happen automatically afterCONSENSUS_RIGHTS_DELAY (which is 2) cycles when rights computed right after the slash take effect, or possibly sooner if the delegate was overstaked or actively stakes more funds to match their previously computed rights. This change aims to protect bakers from incurring further penalties if a faulty configuration causes them to double bake/attest, by giving them some time to fix it.

In our scenario, delegate2 keeps its two bakers running. Thus, several occurrences of the sequence (1) double-baking, (2) denunciation, (3) forbidding, and (4) slashing can be observed.

Slashing happens at the end of the cycle following the one where the misbehaviour was made (letting at least one cycle for denunciations to be made).

Here, we can observe the effect of slashing and how the associated denunciation rewards are alllocated on block #31,232.

    octez-client rpc get /chains/main/blocks/31232/metadata  | jq .balance_updates

[
 ...
  {
    "kind": "freezer",
    "category": "deposits",
    "staker": {
      "baker": "tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT"
    },
    "change": "-28254579268",
    "origin": "delayed_operation",
    "delayed_operation_hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT"
  },
  {
    "kind": "freezer",
    "category": "deposits",
    "staker": {
      "delegate": "tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT"
    },
    "change": "-181839777",
    "origin": "delayed_operation",
    "delayed_operation_hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT"
  },
  {
    "kind": "burned",
    "category": "punishments",
    "change": "28436419045",
    "origin": "delayed_operation",
    "delayed_operation_hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT"
  },
  {
    "kind": "freezer",
    "category": "deposits",
    "staker": {
      "baker": "tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT"
    },
    "change": "-4709096545",
    "origin": "delayed_operation",
    "delayed_operation_hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT"
  },
  {
    "kind": "freezer",
    "category": "deposits",
    "staker": {
      "delegate": "tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT"
    },
    "change": "-30306629",
    "origin": "delayed_operation",
    "delayed_operation_hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT"
  },
  {
    "kind": "contract",
    "contract": "tz1VXDXJKNZ6Vd8WGoSyrfEXNpManegYm7gd",
    "change": "4739403174",
    "origin": "delayed_operation",
    "delayed_operation_hash": "ooX9YDDP7iLZUCfevbMgSdWoZVyp6VjtTvYy6K1J7VKh3C79qVT"
  },
 ...
  {
    "kind": "burned",
    "category": "lost attesting rewards",
    "delegate": "tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT",
    "participation": true,
    "revelation": false,
    "change": "441366142",
    "origin": "block"
  }
]

We encourage you to look at our New Staking UX proposal document for more information.

It’s also worth noting that, by having misbehaved early in the cycle, and thus being unable to participate in consensus, delegate2 lost all its attesting rewards for the cycle.

Frozen staked balances are impacted by slashing:

delegate2’s balance can be compared before/after slashing using the usual RPC queries:

octez-client rpc get /chains/main/blocks/31231/context/contracts/tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT/staked_balance

"438059817290"

and

octez-client rpc get /chains/main/blocks/31232/context/contracts/tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT/staked_balance

"405096141477"

Same goes for its stakers, as they are slashed proportionally to their contribution of delegate2s stake. For instance, for staker3 we get:

octez-client rpc get /chains/main/blocks/31231/context/contracts/tz1STa3McBCrYBXvcA5bCW4KFQQxCQyxDnXG/staked_balance

"2819249185"

and

octez-client rpc get /chains/main/blocks/31232/context/contracts/tz1STa3McBCrYBXvcA5bCW4KFQQxCQyxDnXG/staked_balance

"2607102779"

As expected, for double baking, slashing induces a penalty of 7% of the frozen_deposits of the offending delegate (as well as for its stakers). 1/7th of this penalty is used to reward the denunciator.

This can be verified with the following RPCs:

octez-client rpc get /chains/main/blocks/30988/context/contracts/tz1dLG2tSWJzYXRNEeQQWoYpF5rCB5WF33yT/frozen_deposits

"473940317416"

From the balance updates we get:

burned from baker deposits:    28254579268
rewarded from baker deposits:   4709096545
burned from staker deposits:     181839777 
rewarded from staker deposits:    30306629
-------------------------------------------
Total slashed :                33175822219

This total slashed value corresponds to 7% of the total stake deposits observed 473940317416 * 7% = 33175822219.

Note that 7% is the current constant used with Weeklynet, while on Mainnet it’s set to 5% since the activation of Oxford.

1 Like