-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storing previous randomness values (#1197)
- Loading branch information
1 parent
947e237
commit e153a29
Showing
8 changed files
with
272 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pragma solidity ^0.5.3; | ||
|
||
import "../Random.sol"; | ||
|
||
contract TestRandom is Random { | ||
function addTestRandomness(uint256 blockNumber, bytes32 randomness) external { | ||
addRandomness(blockNumber, randomness); | ||
} | ||
function getTestRandomness(uint256 blockNumber, uint256 cur) external view returns (bytes32) { | ||
return _getBlockRandomness(blockNumber, cur); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
import { CeloContractName } from '@celo/protocol/lib/registry-utils' | ||
import { deploymentForCoreContract } from '@celo/protocol/lib/web3-utils' | ||
import { config } from '@celo/protocol/migrationsConfig' | ||
import { RandomInstance } from 'types' | ||
|
||
module.exports = deploymentForCoreContract<RandomInstance>(web3, artifacts, CeloContractName.Random) | ||
const initializeArgs = async (_: string): Promise<any[]> => { | ||
return [config.random.randomnessBlockRetentionWindow] | ||
} | ||
|
||
module.exports = deploymentForCoreContract<RandomInstance>( | ||
web3, | ||
artifacts, | ||
CeloContractName.Random, | ||
initializeArgs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.