contracts: Add Solidity Linter to Travis (#376)

This commit is contained in:
terence tsao 2018-08-06 08:12:55 -07:00 committed by Raul Jordan
parent bfaa248b39
commit 7a1f5869c2
3 changed files with 41 additions and 6 deletions

16
.soliumrc.json Normal file
View File

@ -0,0 +1,16 @@
{
"extends": "solium:recommended",
"plugins": [
"security"
],
"rules": {
"quotes": [
"error",
"double"
],
"indentation": [
"error",
4
]
}
}

View File

@ -52,7 +52,7 @@ matrix:
install: true # Skip install go packages.
script:
# Ensure everything builds
# Ensure everything builds.
- |
bazel \
--bazelrc=.travis-bazelrc \
@ -68,11 +68,24 @@ matrix:
# Check that BUILD files are formatted correctly.
- ./check_gazelle.sh
# Check that target visibility is correct..
# Check that target visibility is correct.
- ./check_visibility.sh
# Shutdown must be last.
- bazel shutdown
- bazel shutdown
notifications:
email: false
- language: node_js
os: linux
env:
- solidity
node_js:
- "lts/*"
before_install:
- npm install -g solium
install: true # Skip npm install.
script:
# Check solidity linter.
- solium -d contracts/

View File

@ -25,8 +25,14 @@ contract ValidatorRegistration {
)
public payable
{
require(msg.value == VALIDATOR_DEPOSIT);
require(!usedPubkey[_pubkey]);
require(
msg.value == VALIDATOR_DEPOSIT,
"Incorrect validator deposit"
);
require(
!usedPubkey[_pubkey],
"Public key already used"
);
usedPubkey[_pubkey] = true;