From 9b012cb9bb71f1197c42ffbbddce19826c0e4b25 Mon Sep 17 00:00:00 2001 From: epiqueras Date: Wed, 12 Sep 2018 13:41:53 -0500 Subject: [PATCH] chore: standardize files --- .gitattributes | 2 +- .gitignore | 385 ++------------------------------------ .soliumignore | 2 - .soliumrc.json | 16 -- .travis.yml | 2 +- CONTRIBUTING.md | 1 + LICENSE.txt => LICENSE.md | 2 +- README.md | 11 +- auditor.md | 7 +- package.json | 8 +- truffle.js | 14 +- yarn.lock | 6 +- 12 files changed, 43 insertions(+), 413 deletions(-) delete mode 100644 .soliumignore delete mode 100644 .soliumrc.json create mode 100644 CONTRIBUTING.md rename LICENSE.txt => LICENSE.md (94%) diff --git a/.gitattributes b/.gitattributes index cf9d9ee9..5e6bfb8f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ # Solidity syntax highlighting -# see: https://github.com/github/linguist/pull/3973 +# See: https://github.com/github/linguist/pull/3973 *.sol linguist-language=Solidity diff --git a/.gitignore b/.gitignore index 50ea2083..6ddc133f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,377 +1,18 @@ -# Created by .ignore support plugin (hsz.mobi) -### VisualStudioCode template -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -### Eclipse template +# See https://help.github.com/ignore-files/ for more about ignoring files. -.metadata -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.recommenders +# Dependencies +/node_modules/ -# Truffle build directory -build/ +# Production +/build/ -# External tool builders -.externalToolBuilders/ +# Logs +/yarn-debug.log* +/yarn-error.log* -# Locally stored "Eclipse launch configurations" -*.launch +# Editors +/.vscode/ +/.idea/* -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - -# Java annotation processor (APT) -.factorypath - -# PDT-specific (PHP Development Tools) -.buildpath - -# sbteclipse plugin -.target - -# Tern plugin -.tern-project - -# TeXlipse plugin -.texlipse - -# STS (Spring Tool Suite) -.springBeans - -# Code Recommenders -.recommenders/ - -# Scala IDE specific (Scala & Java development for Eclipse) -.cache-main -.scala_dependencies -.worksheet -### Linux template -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* -### Xcode template -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint -### Emacs template -# -*- mode: gitignore; -*- -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -tramp -.\#* - -# Org-mode -.org-id-locations -*_archive - -# flymake-mode -*_flymake.* - -# eshell files -/eshell/history -/eshell/lastdir - -# elpa packages -/elpa/ - -# reftex files -*.rel - -# AUCTeX auto folder -/auto/ - -# cask packages -.cask/ -dist/ - -# Flycheck -flycheck_*.el - -# server auth directory -/server/ - -# projectiles files -.projectile - -# directory configuration -.dir-locals.el -### Windows template -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk -### macOS template -# General -*.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk -### Vim template -# Swap -[._]*.s[a-v][a-z] -[._]*.sw[a-p] -[._]s[a-v][a-z] -[._]sw[a-p] - -# Session -Session.vim - -# Temporary -.netrwhist -# Auto-generated tag files -tags -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# Gradle: -.idea/**/gradle.xml -.idea/**/libraries - -# CMake -cmake-build-debug/ - -# Mongo Explorer plugin: -.idea/**/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties -### SublimeText template -# Cache files for Sublime Text -*.tmlanguage.cache -*.tmPreferences.cache -*.stTheme.cache - -# Workspace files are user-specific -*.sublime-workspace - -# Project files should be checked into the repository, unless a significant -# proportion of contributors will probably not be using Sublime Text -# *.sublime-project - -# SFTP configuration file -sftp-config.json - -# Package control specific files -Package Control.last-run -Package Control.ca-list -Package Control.ca-bundle -Package Control.system-ca-bundle -Package Control.cache/ -Package Control.ca-certs/ -Package Control.merged-ca-bundle -Package Control.user-ca-bundle -oscrypto-ca-bundle.crt -bh_unicode_properties.cache - -# Sublime-github package stores a github token in this file -# https://packagecontrol.io/packages/sublime-github -GitHub.sublime-settings - -### Python template -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -develop-eggs/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -testeth -.idea -node_modules/ -bin_output -logs +# Misc +/.DS_Store diff --git a/.soliumignore b/.soliumignore deleted file mode 100644 index 15c47afc..00000000 --- a/.soliumignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -contracts/Migrations.sol diff --git a/.soliumrc.json b/.soliumrc.json deleted file mode 100644 index b4c01172..00000000 --- a/.soliumrc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "solium:all", - "plugins": [ - "security" - ], - "rules": { - "quotes": [ - "error", - "double" - ], - "indentation": [ - "error", - 4 - ] - } -} diff --git a/.travis.yml b/.travis.yml index e1d23750..c4b08514 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "v9.4.0" + - v9.4.0 cache: directories: - node_modules diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..c29b9369 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +See [kleros.md](https://kleros.gitbooks.io/kleros-md). diff --git a/LICENSE.txt b/LICENSE.md similarity index 94% rename from LICENSE.txt rename to LICENSE.md index ac652fd9..98dd89cd 100644 --- a/LICENSE.txt +++ b/LICENSE.md @@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index ff511db1..794e4ea4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ -# Kleros Interaction Smart Contracts -

- Kleros + Kleros Interaction Smart Contracts

@@ -18,7 +16,6 @@ Smart contracts able to interact with Kleros and standard proposals. - ## Getting Started ### Setting Up The Environment @@ -28,10 +25,13 @@ Install [Truffle Suite](https://truffleframework.com/) and [Ganache](https://tru ### Running Tests Compile the project using `Truffle` suite + ``` truffle compile ``` + Run tests + ``` truffle test ``` @@ -48,9 +48,10 @@ truffle test - `yarn run cz` - Run commitizen. - `yarn run build` - Compile contracts. - ## Troubleshooting + > Could not connect to your Ethereum client. Please check that your Ethereum client: + - is running - is accepting RPC connections (i.e., "--rpc" option is used in geth) - is accessible over the network diff --git a/auditor.md b/auditor.md index 2737f879..2ba3736f 100644 --- a/auditor.md +++ b/auditor.md @@ -1,7 +1,9 @@ ## ArbitrablePermissionList + ArbitrablePermissionList implements an arbitrator (see [ERC792](https://github.com/ethereum/EIPs/issues/792)) curated registry. ### Notes + - Anyone can post an item with a deposit. - If no one complains within a defined time period, the item is added to the registry. - Anyone can complain and also post a deposit. If someone does, a dispute is created. The winner of the dispute gets the deposit of the other party and the item is added or removed accordingly. @@ -9,14 +11,17 @@ ArbitrablePermissionList implements an arbitrator (see [ERC792](https://github.c - In case the arbitrator refuses to rule, the item is put in the initial absent status and the balance is split equally between parties. ### Notes on security + - In some cases we use `send` instead of `transfer` on purpose to prevent someone from blocking the contract. - We avoid using SafeMath in numeric operation, as it is redundant. ## BlockhashRNGFallback + BlockHashRNGFallback implements a random number generator which stores the blockhash as a pseudo-random number throughout time. If the requested random number is not set by 256 blocks the contract returns the random number for the previous block. This avoids returning zero when data is not available and blocking forever contracts waiting for this random number. ### Notes + - The blockhash will become unreachable after 256 blocks so we give parties an incentive to save it. Rewards are paid from a reward pool. - Anyone can contribute to the reward pool. - The blockhash can be slightly manipulated by the miners (by block withholding and building upon the block of their choice in case of fork). This attack would allow miners to "reroll" the number but not to fix it to a particular value. -This makes it not suited for applications like gambling. But for others like drawing juror, it may be sufficient. As the number of jurors increases, it would be harder and harder to manipulate the RNG to create a set of juror statistically different from the underlying juror pool. + This makes it not suited for applications like gambling. But for others like drawing juror, it may be sufficient. As the number of jurors increases, it would be harder and harder to manipulate the RNG to create a set of juror statistically different from the underlying juror pool. diff --git a/package.json b/package.json index 725a25b7..b6c9c3c9 100644 --- a/package.json +++ b/package.json @@ -45,14 +45,14 @@ }, "homepage": "https://github.com/kleros/kleros-interaction#readme", "devDependencies": { + "coveralls": "^3.0.2", "eth-gas-reporter": "0.1.1", + "ganache-cli": "^6.1.6", "husky": "^0.14.3", - "kleros-scripts": "^0.10.0", + "kleros-scripts": "^0.10.1", "npm-run-all": "^4.1.3", - "standard-version": "^4.4.0", - "coveralls": "^3.0.2", - "ganache-cli": "^6.1.6", "solidity-coverage": "^0.5.7", + "standard-version": "^4.4.0", "truffle": "^4.1.13", "web3": "^1.0.0-beta.22" }, diff --git a/truffle.js b/truffle.js index 19956bb6..edfb2f63 100644 --- a/truffle.js +++ b/truffle.js @@ -1,11 +1,11 @@ module.exports = { - networks: { - development: { - host: 'localhost', - port: 8545, - network_id: '*' // Match any network id - } - }, + // mocha: { + // reporter: 'eth-gas-reporter', + // reporterOptions: { + // currency: 'USD', + // gasPrice: 21 + // } + // }, solc: { optimizer: { enabled: true, diff --git a/yarn.lock b/yarn.lock index baeca3b3..1d461725 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3863,9 +3863,9 @@ klaw@^1.0.0: optionalDependencies: graceful-fs "^4.1.9" -kleros-scripts@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/kleros-scripts/-/kleros-scripts-0.10.0.tgz#4c9dfbe6f7e177a05428ec20ab25d02c055fb49b" +kleros-scripts@^0.10.1: + version "0.10.1" + resolved "https://registry.yarnpkg.com/kleros-scripts/-/kleros-scripts-0.10.1.tgz#a767a51e0691950630680003c64fa9dde6bee030" dependencies: "@commitlint/cli" "^6.1.0" "@commitlint/config-conventional" "^6.1.0"