Skip to content

Commit 4317a9e

Browse files
threshold to float calculate (#73)
threshold to float calculate
1 parent 9ca0afd commit 4317a9e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mainnet_contract/contracts/Subnet.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ contract Subnet {
8181
});
8282
validators[1] = Validators({
8383
set: initial_validator_set,
84-
threshold: int256((initial_validator_set.length * 2) / 3)
84+
//float mul 100
85+
threshold: int256((initial_validator_set.length * 2 * 100) / 3)
8586
});
8687
current_validators = validators[1];
8788
setLookup(initial_validator_set);
@@ -188,7 +189,8 @@ contract Subnet {
188189

189190
validators[validationParams.number] = Validators({
190191
set: next,
191-
threshold: int256((next.length * 2) / 3)
192+
//float mul 100
193+
threshold: int256((next.length * 2 * 100) / 3)
192194
});
193195
} else revert("Invalid Next Block");
194196
}
@@ -207,7 +209,7 @@ contract Subnet {
207209
}
208210
(bool is_unique, int unique_counter) = checkUniqueness(signer_list);
209211
if (!is_unique) revert("Verification Fail : is_unique is false");
210-
if (unique_counter < current_validators.threshold)
212+
if (unique_counter * 100 < current_validators.threshold)
211213
revert(
212214
"Verification Fail : unique_counter lower current_validators.threshold"
213215
);

0 commit comments

Comments
 (0)