pooltogether / pooltogether-rng-contracts Goto Github PK
View Code? Open in Web Editor NEWPoolTogether RNG Service
License: GNU General Public License v3.0
PoolTogether RNG Service
License: GNU General Public License v3.0
Step from readme file:
yarn deploy rinkeby
failsyarn run v1.22.17 $ hardhat deploy --write true --network rinkeby (node:35736) Warning: Accessing non-existent property 'VERSION' of module exports inside circular dependency (Use
node --trace-warnings ...` to show where the warning was created)
Nothing to compile
An unexpected error occurred:
Error: ERROR processing skip func of /home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/deploy/deploy.ts:
TSError: ⨯ Unable to compile TypeScript:
deploy/deploy.ts:31:20 - error TS7053: Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{ default: BigNumber; 1: BigNumber; 4: BigNumber; 42: BigNumber; 137: BigNumber; 80001: BigNumber; }'.
No index signature with a parameter of type 'number' was found on type '{ default: BigNumber; 1: BigNumber; 4: BigNumber; 42: BigNumber; 137: BigNumber; 80001: BigNumber; }'.
31 const feeValue = fee[chainId] || fee.default
~~~~~~~~~~~~
deploy/deploy.ts:32:24 - error TS7053: Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{ default: string; 1: string; 4: string; 42: string; 137: string; 80001: string; }'.
No index signature with a parameter of type 'number' was found on type '{ default: string; 1: string; 4: string; 42: string; 137: string; 80001: string; }'.
32 const keyHashValue = keyHash[chainId] || keyHash.default
~~~~~~~~~~~~~~~~
deploy/deploy.ts:63:56 - error TS2322: Type 'string' is not assignable to type 'never'.
63 RNGChainlink = await _getContract('RNGChainlink', [vrfCoordinator, linkAddress])
~~~~~~~~~~~~~~
deploy/deploy.ts:63:72 - error TS2322: Type 'string' is not assignable to type 'never'.
63 RNGChainlink = await _getContract('RNGChainlink', [vrfCoordinator, linkAddress])
~~~~~~~~~~~
at createTSError (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/ts-node/src/index.ts:750:12)
at reportTSError (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/ts-node/src/index.ts:754:19)
at getOutput (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/ts-node/src/index.ts:941:36)
at Object.compile (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/ts-node/src/index.ts:1243:30)
at Module.m._compile (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/ts-node/src/index.ts:1370:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .ts] (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/ts-node/src/index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at DeploymentsManager.executeDeployScripts (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1101:15)
at DeploymentsManager.runDeploy (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1053:16)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SimpleTaskDefinition.action (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat-deploy/src/index.ts:409:5)
at async Environment._runTaskDefinition (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at async Environment.run (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at async SimpleTaskDefinition.action (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat-deploy/src/index.ts:555:32)
at async Environment._runTaskDefinition (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at async Environment.run (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at async SimpleTaskDefinition.action (/home/dev/Documents/Projects/Blockchain/pooltogether-rng-contracts/node_modules/hardhat-deploy/src/index.ts:640:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
`
Seems that RNGBlockhash algorithm is waiting for 2 new blocks ("saved block + 2") instead of one but return seed based on previous for current:
So in general steps are following:
This looks like vulnerability because seed will be already known at step (2) and we don't need to wait until full completion
How to fix:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.