Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2 protected
  • release/runtime-800 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
  • runtime-401 protected
  • v0.4.0 protected
40 results

quota

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    bgallois authored
    a4e366da
    History
    Name Last commit Last update
    ..
    src
    Cargo.toml
    README.md

    Duniter quota pallet

    Duniter identity system allows to allocate quota and refund transaction fees when not consumed.

    General behavior

    Quota system is plugged to transactions fees which is a rather critical aspect of substrate. That's why in duniter-account pallet OnChargeTransaction implementation, the default behavior is preserved, and refunds are added to a queue handeled in on_idle.

    Path for a refund

    This is what happens on a transaction:

    • frame-executive calls OnChargeTransaction implementations
    • duniter-account OnChargeTransaction implementation is called, and if an identity is linked to the account who pays the fees, request_refund is called
    • request_refund implementation of quota pallet determines whether the fees are eligible for refund based on the identity and then call queue_refund
    • queue_refund adds a refund to the RefundQueue which will be processed in on_idle
    • during on_idle, quota pallet processes the refund queue within the supplied weight limit with process_refund_queue
    • for each refund in the RefundQueue, try_refund is called
    • it first tries to use quotas to refund fees with spend_quota
    • if a certain amount of quotas has been spend, it actually performs the refund with do_refund, taking currency from the RefundAccount to give it back to the account who paid the fee

    The conditions for a refund to happen are:

    1. an identity is linked to the account who pays the fees
    2. some quotas are defined for the identity and have a non-null value after update

    TODO

    • sanity test checking that only member identities have quota