Park rate change limitations are per block

#221 Merged at 4c1726c
Repository
Branch
max_rate_increase_per_block
Repository
Branch
2.0.0-Stable-Release
Author
  1. Michael Witrant
Reviewers
Description

To solve issue #134.

Park rate increase is limited to 0.002 APR per block. Decrease is limited to 0.004 APR per block.

The change takes effect after the switch to protocol V06, which was temporarily set to June 1st.

Comments (7)

  1. Michael Witrant author

    Given the new limits and the current encoding, the actual rate increase limit for durations < 32 blocks is less than 1, so 0. That means we can't have any rate for durations < 32 blocks. I guess it's not a problem, so I'll just update the test to use a larger duration.

    1. John L. Jegutanis

      No, it's not a problem of having a minimum parking duration.


      The code looks good, all tests pass except the following:

        Scenario: Park rates are decreased in protocol 2.0                                          # features/park_rate_change_limits.feature:76
          Given a network with nodes "Alice" and "Bob" able to mint                                 # features/step_definitions/common.rb:31
          And the network is at protocol 2.0                                                        # features/step_definitions/common.rb:705
          And node "Alice" votes for these NuBit park rates:                                        # features/step_definitions/park_rate_change_limits.rb:40
            | Duration | Annual percentage rate |
            | 6 months | 0.012 %                |
            | 1 year   | 0.012 %                |
          And node "Alice" finds enough blocks for a park rate vote to become the median            # features/step_definitions/park_rate_change_limits.rb:58
          When node "Alice" finds 6 blocks received by all other nodes                              # features/step_definitions/common.rb:233
          Then the NuBit park rates should be                                                       # features/step_definitions/park_rate_change_limits.rb:111
            | Duration | Annual percentage rate |
            | 6 months | 0.012 %                |
            | 1 year   | 0.012 %                |
      
            expected: "0.012 % on 6 months"
                 got: "0.0 % on 6 months"
      

      and this

        Scenario: Park rates are increased in protocol 2.0                               # features/park_rate_change_limits.feature:23
          Given a network with nodes "Alice" and "Bob" able to mint                      # features/step_definitions/common.rb:31
          And the network is at protocol 2.0                                             # features/step_definitions/common.rb:705
          And node "Alice" votes for these NuBit park rates:                             # features/step_definitions/park_rate_change_limits.rb:40
            | Duration | Annual percentage rate |
            | 6 months | 10 %                   |
            | 1 year   | 0.005 %                |
          And node "Alice" finds enough blocks for a park rate vote to become the median # features/step_definitions/park_rate_change_limits.rb:58
          And node "Alice" finds a block received by all other nodes                     # features/step_definitions/common.rb:233
          Then the NuBit park rates should be                                            # features/step_definitions/park_rate_change_limits.rb:111
            | Duration | Annual percentage rate |
            | 6 months | 0.002 %                |
            | 1 year   | 0.002 %                |
      
            expected: "0.002 % on 6 months"
                 got: "0.0 % on 6 months"
      

      Tried to rerun those tests with the same results.

      1. Michael Witrant author

        No, it's not a problem of having a minimum parking duration.

        Yes it was.

        The code looks good, all tests pass except the following:

        I pushed a new commit to fix them.