Skip to content

Commit

Permalink
fix(topupcredit.sol, subsidy.circom): add comments for upper bound of…
Browse files Browse the repository at this point in the history
… constants

(1) M in subsidy calculation (2) hard cap of voice credit
  • Loading branch information
chaosma committed Sep 28, 2022
1 parent c9a24ba commit c8eb37a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions circuits/circom/subsidy.circom
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ template SubsidyPerBatch (
intStateTreeDepth,
voteOptionTreeDepth
) {
// keep MM < 2 ** 196 to avoid overflow: https://hackmd.io/@chaosma/H1_9xmT2K
var MM = 50; // protocol params should be consistent with MaciState.ts
var WW = 4; // number of decimal in float representation, should consist with MaciState.ts
var NN = 64; // maximum width of bits (10**NN < 2**253) in float division
Expand Down
2 changes: 2 additions & 0 deletions contracts/contracts/TopupCredit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import "@openzeppelin/contracts/access/Ownable.sol";

contract TopupCredit is ERC20, Ownable {
uint8 private _decimals = 1;
// keep the maximum amount less than 2**126 < sqrt(field_size)
// to avoid overflow
uint256 MAXIMUM_AIRDROP_AMOUNT = 100000 * 10**_decimals;

constructor() ERC20("TopupCredit", "TopupCredit") {
Expand Down

0 comments on commit c8eb37a

Please sign in to comment.