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

PoS spec updates #283

Merged
merged 25 commits into from
Nov 2, 2022
Merged

PoS spec updates #283

merged 25 commits into from
Nov 2, 2022

Conversation

tzemanovic
Copy link
Member

@tzemanovic tzemanovic commented Aug 5, 2022

moved from anoma/anoma#1075, partially addresses #488

depends on #282

@tzemanovic tzemanovic added the documentation Improvements or additions to documentation label Aug 30, 2022
@tzemanovic tzemanovic changed the title PoS spec - add new rewards and commissions system PoS spec updates Aug 31, 2022
Added logic for reward products handing when validator's voting power
changes to cross from or into `below_threshold` validator set.
@juped juped mentioned this pull request Sep 20, 2022
- `total_voting_power (required)`
- `validator_set/consensus (required)`: the set of up to `max_validator_slots` (parameter) validators, ordered by their bonded stake
- `validator_set/below_capacity (required)`: the set of validators below consensus capacity, but with bonded stake above the `min_validator_stake` parameter, also ordered by their bonded stake
- `total_deltas (required)`

- standard validator metadata (these are regular storage values, not epoched data):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we particularly want these fields to be listed separately to the other validator-specific fields above? I would think to combine them

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can combine them yeah


Only XAN tokens can be staked in bonds. The tokens being staked (bonds and unbonds amounts) are kept in the PoS account under `{xan_address}/balance/{pos_address}` until they are withdrawn.
Only NAM tokens can be staked in bonds. The tokens being staked (amounts in the bonds and unbonds) are kept in the PoS account under `{nam_address}/balance/{pos_address}` until they are withdrawn.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to forget that accumulated rewards are held in the PoS account and should maybe be included here. But how to treat these and whether or not to include them in the deltas may be a larger discussion

@@ -53,48 +49,49 @@ For slashing tokens, we implement a [PoS slash pool account](vp.md#pos-slash-poo

The validator transactions are assumed to be applied with an account address `validator_address`.

- `become_validator(consensus_key, staking_reward_address)`:
- `become_validator(consensus_key, commission_rate, max_commission_rate_change)`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How precise do we care to be here with the input arguments? Technically, this function also requires the validator address and the current epoch as inputs at the moment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For current epoch, we can maybe extend the line 50 with e.g. and assuming a transaction uses host environment function to find the current epoch. I think we could also specify them in args to be more complete

- creates a record in `validator/{validator_address}/consensus_key` in epoch `n + pipeline_length`
- creates a record in `validator/{validator_address}/staking_reward_address`
- creates a record in `validator/{validator_address}/commission_rate` in epoch `n + pipeline_length`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does commission_rate need to be epoched? Currently when the inflation is applied, the commission rate is read from storage as a single value, then it is applied to store the delegator rewards product, which is epoched and contains the commission rate information inherently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, good point! Let's just use a single value and document why

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought more about this... I now think it is right to be epoched to ensure that this can only change by at most max_commission_rate_change per epoch.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at minimum, we could do something like a tuple of (last_rate, current_rate) just so we have the last epoch's commission rate. There will be a change_commission_rate tx that will just need to check against the last epoch's rate every time it is called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right! I guess it doesn't need to be fully "epoched", but for this it may be convenient

…wards

* origin/main: (632 commits)
  ci: use commit hash instead of pr number
  ci: fix binaries sha
  changelog: add #720
  fix: rename correctly in debug wasm build
  Namada 0.9.0
  release.sh: list prerequisites in a comment
  changelog: add #569
  queries: fix unused import in wasm build
  Fixes pgf council vote format
  Rwnames `type`, adds examples
  Custom proposal and vote memos in governance spec
  RPC: fix storage_value to return data as read w/o re-encoding in Option
  [ci] wasm checksums update
  router: add `with_options` for handlers that use request/response
  move the current RPC patterns under "shell" sub-router
  make fmt
  Log at INFO by default for namadan
  Add changelog
  ledger/queries: comment out `println`s for router path matching dbg
  ledger/queries: fix require_no_proof doc-string
  ci: fix workflow name
  ci: fix mold usage
  Update README.md
  some doc comment edits
  fix: namadan should log at info by default
  ci: use mold linker
  changelog: add #632
  feat: change native token to nam
  [ci] wasm checksums update
  changelog: add #671
  add back consensus timeout commit config for abciplus
  switch to tendermint-rs with consensus timeout
  wasm: update checksums
  changelog: add #553
  apps: replace RPC module and its handlers with new queries mod
  shared: add new queries router macro to replicate handwritten RPC paths
  add deps for router macro and update `Cargo.lock`s
  protocol: update imports and add missing rustdoc
  move ledger's protocol module into shared crate
  ci: invalide cf cache
  fix broken link
  split back out the core VPs
  Modify specs
  test/e2e/helpers: add a helper to query and parse block height
  changelog: add #658
  client: add a block query to print hash, height and time of a block
  Namada 0.8.1
  changelog: add #510
  [feat]: Make process proposal stateless
  test/e2e: fix node_connectivity test
  test/e2e: update expected string for non-validator node
  [fix]: Removed unnecessary patches in wasm
  [feat]: Patched tendermint-rs and ibc-rs to compatible versions
  app: set "namada" set default bin for `cargo run`
  wasm: update checksums.json
  [fix]: Fixed the borsh schema for libsecp256k signatures
  [feat]: Added the recovery id to secp256k signatures
  [ci] wasm checksums update
  feat: remove nft
  fix: rename anoma to namada, remove author print
  CI: add workaround for release build missing git tag
  Namada 0.8.0
  changelog: add #547
  wasm: update checksums
  [chore]: Lints and formatting
  [fix]: Fixed proof specs for non-existence proofs
  [fix]: Update the main tree when deleting a key
  [fix]: Fixed last ibc unit test
  [fix]: Fixed some tests.
  [feat]: Refactored the merkle tree into a more maintainable multi-store
  build: pin abciplus library revisions
  wasm: update checksums.json
  ci: standardize on one tendermint hash
  formatting changes
  change `L_{NAM}` -> `L_{PoS}` for clarity and consistency
  change inflation `I` to have units of tokens per epoch
  fix term ordering in error calculation
  Remove other `:=` in favor of `=`
  distinguish new and old inflation rates with a prime
  fix md rendering
  correct the shielded pool error calculation
  change storing of error to storing of token ratios (same procedure)
  fix: `I` is percent per annum
  distinguish between `K` in storage and `K` as intermediate value in inflation calculation
  Use `I` for inflation rates, as `R` reserved for locked ratios
  specify some default values, other small edits
  release: add scripts/release.sh
  release: add release.toml to wasm workspace and wasm_for_tests
  release: don't tag from cargo release
  release: update release.toml for cargo-release 0.21.4
  wasm: remove tx_from_intent build
  wasm: repair wasm checksums
  Add changelog
  Add changelog
  Fix TransactionGasExceededed typo
  changelog: add #594
  shared/storage: fix the height recorded for a new epoch
  Apply suggestions from code review
  changelog: add #590
  wasm/tx_bond: fix delegation detection to compare source and validator
  ...
@tzemanovic tzemanovic marked this pull request as ready for review November 2, 2022 17:38
Copy link
Collaborator

@brentstone brentstone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@brentstone brentstone merged commit 02d0cab into main Nov 2, 2022
@brentstone brentstone deleted the tomas/pos-spec-add-rewards branch November 2, 2022 19:53
phy-chain pushed a commit to phy-chain/namada that referenced this pull request Mar 1, 2024
* feat: shielded transfers in WebWorker

* fix: anoma tests

* feat: shielded transfers notifications (anoma#286)

* feat: shielded transfers notifications

* feat: add msgId to the toast description

* feat: update masp

* fix: notifications tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants