Skip to content

Commit 70e8729

Browse files
hunjixinhunjixin
hunjixin
authored andcommitted
feat: increase difficulty to 40m hash
1 parent fcf3f37 commit 70e8729

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

hardhat/contracts/LilypadPow.sol

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ contract LilypadPow is Initializable, OwnableUpgradeable {
2222
uint256 timestamp;
2323
}
2424

25-
// todo difficulty may need to adjust in test
26-
// this difficulty was calculate with this tool https://github.com/hunjixin/pow-tool/tree/main/difficulty
27-
// Theoretically A machine with a hash rate of 8M has a probability of no more than 0.01% of not finding a nonce that meets the difficulty within 20 blocks.
28-
// However, this issue has not been well validated in practice. it can solve nonce within one minute most of the time.
29-
uint256 public targetDifficulty; // =
30-
//555460709263765739036470010701196062214039696708679004195670928130048;
25+
uint256 public targetDifficulty;
3126
mapping(address => POWSubmission[]) public powSubmissions;
3227
address[] public miners;
3328

@@ -44,7 +39,9 @@ contract LilypadPow is Initializable, OwnableUpgradeable {
4439
// https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable
4540
function initialize() public initializer {
4641
__Ownable_init();
47-
targetDifficulty = 555460709263765739036470010701196062214039696708679004195670928130048;
42+
// this difficulty was calculate with this tool https://github.com/hunjixin/pow-tool/tree/main/difficulty
43+
// Theoretically A machine with a hash rate of 40M has a probability of no more than 0.00001 of not finding a nonce that meets the difficulty within 36 blocks.
44+
targetDifficulty = 92576780592126171815437600338300430792573009392238517278497593884672;
4845
}
4946

5047
function getMinerCount() public view returns (uint256) {
@@ -154,7 +151,8 @@ contract LilypadPow is Initializable, OwnableUpgradeable {
154151

155152
function triggerNewPowRound() external onlyOwner {
156153
window_start = block.number;
157-
window_end = block.number + 30; //todo arbitary value , need to discuss
154+
// give 6 block time to confirm challenge, 30 block time used to calculate proof
155+
window_end = block.number + 36;
158156
emit NewPowRound();
159157
}
160158

0 commit comments

Comments
 (0)