Skip to content

💣 The function getPunishment is inaccurate #276

@fulldecent

Description

@fulldecent

In the Griefing contract, the function getPunishment exists to show the amount of punishment that is achievable for a given amount of cost.

The function returns incorrect values for two reasons:

  1. The punishment amount is not limited by the maximum amount staked.
  2. The getPunishment function uses multiplication but the actual getCost function which is used employes division. Due to quantization effects, division is not the inverse of multiplication. (e.g. 1÷3×3 ≠ 1)

Recommendation: remove the getPunishment function entirely because it can never be accurate.

References:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions