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

Pretty print commission schedule rates and rate bounds as enumerated lists #3265

Merged
merged 4 commits into from
Sep 14, 2020

Conversation

tjanez
Copy link
Member

@tjanez tjanez commented Sep 11, 2020

Example of an old pretty print:

You are about to sign the following transaction:
  Nonce:  0
  Fee:
    Amount: AMBER 0.000002
    Gas limit: 1000
    (gas price: AMBER 0.000000002 per gas unit)
  Method: staking.AmendCommissionSchedule
  Body:
    Amendment:
      Rates:
        - Start: epoch 32
          Rate:  50.0%
        - Start: epoch 40
          Rate:  40.0%
        - Start: epoch 48
          Rate:  30.0%
        - Start: epoch 56
          Rate:  25.0%
        - Start: epoch 64
          Rate:  20.0%
      Rate Bounds:
        - Start:        epoch 32
          Minimum Rate: 10.0%
          Maximum Rate: 50.0%
        - Start:        epoch 64
          Minimum Rate: 10.0%
          Maximum Rate: 30.0%
Other info:
  Genesis document's hash: d7aff9a80cf626fb49585a37c8f8e0ec99bccdec1c93c93d566accdccdb58bef

Same example with the new pretty print:

You are about to sign the following transaction:
  Nonce:  0
  Fee:
    Amount: AMBER 0.000002
    Gas limit: 1000
    (gas price: AMBER 0.000000002 per gas unit)
  Method: staking.AmendCommissionSchedule
  Body:
    Amendment:
      Rates:
        (1) start: epoch 32
            rate:  50.0%
        (2) start: epoch 40
            rate:  40.0%
        (3) start: epoch 48
            rate:  30.0%
        (4) start: epoch 56
            rate:  25.0%
        (5) start: epoch 64
            rate:  20.0%
      Rate Bounds:
        (1) start:        epoch 32
            minimum rate: 10.0%
            maximum rate: 50.0%
        (2) start:        epoch 64
            minimum rate: 10.0%
            maximum rate: 30.0%
Other info:
  Genesis document's hash: d7aff9a80cf626fb49585a37c8f8e0ec99bccdec1c93c93d566accdccdb58bef

@tjanez tjanez added c:staking Category: staking c:cli Category: command line interface labels Sep 11, 2020
@tjanez tjanez force-pushed the tjanez/csr-enum-lists branch 2 times, most recently from 8a42cc2 to 6dac03c Compare September 11, 2020 12:50
@tjanez tjanez marked this pull request as ready for review September 11, 2020 12:51
It can be used to pass and retrieve the rate (bound) index of a
commission schedule (amendment).
Pretty print rates and rate bounds as enumerated lists to enable easier
inspection of commission schedule (amendments) in combination with a
hardware-based signer plugin.
This avoids spurious test errors when the given string is not found in a
larger string due to the first containing special regular expression
metacharacters.
@tjanez tjanez force-pushed the tjanez/csr-enum-lists branch from 6dac03c to 7284f83 Compare September 14, 2020 09:58
@codecov
Copy link

codecov bot commented Sep 14, 2020

Codecov Report

Merging #3265 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3265      +/-   ##
==========================================
+ Coverage   67.69%   67.73%   +0.04%     
==========================================
  Files         371      371              
  Lines       36874    36884      +10     
==========================================
+ Hits        24962    24984      +22     
+ Misses       8719     8712       -7     
+ Partials     3193     3188       -5     
Impacted Files Coverage Δ
go/staking/api/commission.go 95.60% <100.00%> (+0.09%) ⬆️
go/staking/api/prettyprint.go 100.00% <100.00%> (ø)
go/oasis-node/cmd/common/metrics/disk.go 65.51% <0.00%> (-20.69%) ⬇️
go/consensus/tendermint/epochtime/epochtime.go 85.71% <0.00%> (-7.94%) ⬇️
go/storage/metrics.go 76.92% <0.00%> (-7.70%) ⬇️
go/consensus/tendermint/apps/staking/query.go 49.09% <0.00%> (-7.28%) ⬇️
go/keymanager/client/client.go 82.64% <0.00%> (-5.79%) ⬇️
go/staking/api/grpc.go 55.03% <0.00%> (-4.27%) ⬇️
go/consensus/tendermint/staking/staking.go 57.45% <0.00%> (-3.32%) ⬇️
go/storage/api/root_cache.go 77.77% <0.00%> (-3.18%) ⬇️
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a760da...7284f83. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:cli Category: command line interface c:staking Category: staking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants