Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

pallet-treasury: Ensure we respect max_amount for spend across batch calls #13468

Merged

Commits on Feb 24, 2023

  1. pallet-treasury: Ensure we respect max_amount for spend across ba…

    …tch calls
    
    When calling `spend` the origin defines the `max_amount` of tokens it is allowed to spend. The
    problem is that someone can send a `batch(spend, spend)` to circumvent this restriction as we don't
    check across different calls that the `max_amount` is respected. This pull request fixes this
    behavior by introducing a so-called dispatch context. This dispatch context is created once per
    outer most `dispatch` call. For more information see the docs in this pr. The treasury then uses
    this dispatch context to attach information about already spent funds per `max_amount` (we assume
    that each origin has a different `max_amount` configured). So, a `batch(spend, spend)` is now
    checked to stay inside the allowed spending bounds.
    
    Fixes: #13167
    bkchr committed Feb 24, 2023
    Configuration menu
    Copy the full SHA
    4969395 View commit details
    Browse the repository at this point in the history
  2. Import Box for wasm

    bkchr committed Feb 24, 2023
    Configuration menu
    Copy the full SHA
    9d4276b View commit details
    Browse the repository at this point in the history
  3. FMT

    bkchr committed Feb 24, 2023
    Configuration menu
    Copy the full SHA
    0ed680c View commit details
    Browse the repository at this point in the history