Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hopefully fixed blocknumber handling #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions contracts/IncentiveLayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager {
bytes32 initTaskHash;
mapping(address => bytes32) challenges;
State state;
bytes32 blockhash;
bytes32 randomBitsHash;
uint taskCreationBlockNumber;
mapping(address => uint) bondedDeposits;
Expand Down Expand Up @@ -244,7 +243,6 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager {
bondDeposit(taskID, msg.sender, t.minDeposit);
t.selectedSolver = msg.sender;
t.randomBitsHash = randomBitsHash;
t.blockhash = blockhash(block.number.add(1));
t.state = State.SolverSelected;

// Burn task giver's taxes now that someone has claimed the task
Expand All @@ -271,7 +269,6 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager {
bondDeposit(taskID, msg.sender, t.minDeposit);
t.selectedSolver = msg.sender;
t.randomBitsHash = randomBitsHash;
t.blockhash = blockhash(block.number.add(1));
t.state = State.SolverSelected;

emit SolverSelected(taskID, msg.sender, t.initTaskHash, t.minDeposit, t.randomBitsHash);
Expand Down Expand Up @@ -396,7 +393,7 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager {
}

function isForcedError(uint randomBits) internal view returns (bool) {
return (uint(keccak256(abi.encodePacked(randomBits, blockhash(block.number)))) < forcedErrorThreshold);
return (uint(keccak256(abi.encodePacked(randomBits, blockhash(block.number-1)))) < forcedErrorThreshold);
}

function rewardJackpot(uint taskID) internal {
Expand Down