[go: up one dir, main page]

Proto/RPC: Expose min_delegated_in_cycle via RPCs

What

Add access to min_delegated_in_cycle field via RPC.

Why

With !10455 (merged), rights are now computed using the minimum delegated tez over the cycle.
This value is not exposed via RPCs.

How

This MR adds:

  • the min_delegated_in_cycle field in the delegate info type/encoding that is accessible via GET /chain/main/blocks/[block_id]/context/delegates/[pkh]
  • an dedicated RPC to access this value via GET /chain/main/blocks/[block_id]/context/delegates/[pkh]/min_delegated_in_cyle

Manually testing the MR

  • Run a sandbox node
  • Activate alpha
  • Make the deletaged stake delegate change
  • Observe that the min_delegated_stake is consistent with you changes
./src/bin_node/octez-sandboxed-node.sh 1 --connections 0 &
eval `./src/bin_client/octez-init-sandboxed-client.sh 1`
octez-activate-alpha
# observe the new added field
octez-client rpc get /chains/main/blocks/head/context/delegates/tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN 
octez-client transfer 1000 from bootstrap1 to bootstrap2 --burn-cap 0.06425 -w none
octez-client bake for --minimal-timestamp
# Transferring should have reduced the minimum delegated stake of bootstrap1
octez-client rpc get /chains/main/blocks/head/context/delegates/tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
octez-client transfer 1000 from bootstrap2 to bootstrap1 --burn-cap 0.06425 -w none
octez-client bake for --minimal-timestamp
# Transferring should *NOT* have increased the minimum delegated stake of bootstrap1
octez-client rpc get /chains/main/blocks/head/context/delegates/tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Mathias Bourgoin

Merge request reports

Loading