Skip to content
Snippets Groups Projects

Fees should use the right units

Closed Carles Barrobés requested to merge transfer-fee-bug into develop
3 unresolved threads

Follow-up to !5 (comment 40410)

Looking at the code in develop right now I think it still suffers from one of the issues I mentioned, which is that the fees are multiplied by powBase (https://git.duniter.org/clients/cesium-grp/cesium2s/-/blob/develop/src/app/account/accounts.service.ts?ref_type=heads#L483) when in fact they souldn't, as they are in GDcents and not GD (see https://git.duniter.org/clients/cesium-grp/cesium2s/-/blob/develop/src/app/network/network.service.ts?ref_type=heads#L25).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
139 142
140 143 build:
141 144 extends: .build
142 needs: ["build:env"]
143 145 image: ${CI_BUILD_IMAGE}
144 only:
145 - develop
  • Author Developer

    I had to make these changes to ensure a minimal build pipeline will run for merge requests. I still reuse the build image pushed in develop builds, but also make sure additional npm packages added in a branch are installed.

  • build is only used from a develop branch. For any other branch, we used build:feature Is you remove needs, the build will be executed even if build:env failed...

    May be we could merge build and build:features tasks into one task, using rules ?

  • Author Developer

    Ah OK cool I hadn't noticed that.

  • Please register or sign in to reply
  • Author Developer

    The pipeline was broken for MRs... now it is fixed @blavenie can you review pls?

  • 139 142
    140 143 build:
    141 144 extends: .build
    142 needs: ["build:env"]
    143 145 image: ${CI_BUILD_IMAGE}
    144 only:
    145 - develop
    146 146
    147 147 build:feature:
    148 148 extends: .build
    149 149 image: ${CI_BUILD_IMAGE}
    150 150 script:
    151 151 # Install deps, because it may have changed since the last build image (build from develop)
    152 152 - npm install
    • See how build from a branch already execute npm install. It should not be executed for the develop branch, because the build:env task already create a fresh docker image, with all up to date dependencies. What is wrong here is a only part : your merge request was excluded because not in feature/. May be we should add issue/ branchs ?

      Edited by Benoit Lavenier
    • Please register or sign in to reply
  • 479 479 throw new Error('ERROR.AMOUNT_NEGATIVE');
    480 480 }
    481 481
    482 // Remove decimals, in amount and fee
    482 // Convert amount to right unit ("cents")
    483 483 amount = amount * powBase;
    484 if (fee) fee = fee * powBase;
    • I dont understand why we need to remove this line ? The fee argument (see function jsdoc) are in decimals. So we need to convert in cents, before using it.

    • Author Developer

      Interesting... although while it is true that the docstring mentions decimals, your comment contradicts my observations, which are:

      So for the time being I would even remove the fee parameter and always use the network values (in cents) to prevent tripping others up.

      But I see your point, this is not really a bug (it only converts the undefined argument to align the units) but it makes the code confusing and unit mismatch is a potential source of bugs and the variable names aren't helping make out the difference.

      Edited by Carles Barrobés
    • Please register or sign in to reply
  • Author Developer

    I will close for now, because the code is not really buggy as I initially thought (just confusing IMO). As per the pipeline changes, I will do those separately if I run into problems in another MR

  • Please register or sign in to reply
    Loading