fix all standard issues

pull/1/head
yann300 8 years ago
parent 31230f8559
commit 24c4642a91
  1. 1
      src/app/contract/publishOnSwarm.js
  2. 5
      src/app/files/file-explorer.js
  3. 1
      src/app/panels/file-panel.js
  4. 5
      src/app/staticanalysis/modules/blockBlockhash.js
  5. 6
      src/app/staticanalysis/modules/blockTimestamp.js
  6. 3
      src/app/staticanalysis/modules/inlineAssembly.js
  7. 25
      src/app/staticanalysis/modules/lowLevelCalls.js
  8. 2
      src/app/staticanalysis/modules/thisLocal.js
  9. 1
      src/app/tabs/run-tab.js
  10. 2
      test-browser/tests/sharedFolderExplorer.js

@ -51,7 +51,6 @@ module.exports = (contract, appAPI, cb) => {
})
}
function swarmVerifiedPublish (content, expectedHash, cb) {
swarmgw.put(content, function (err, ret) {
if (err) {

@ -316,9 +316,10 @@ function fileExplorer (appAPI, files) {
self.element = el
}
}
/******************************************************************************
/*
HELPER FUNCTIONS
******************************************************************************/
*/
function adaptEnvironment (label, focus, hover) {
var li = getLiFrom(label)
li.style.position = 'relative'

@ -1,4 +1,5 @@
/* global confirm, prompt */
var $ = require('jquery')
var csjs = require('csjs-inject')
var yo = require('yo-yo')
var minixhr = require('minixhr') // simple and small cross-browser XMLHttpRequest (XHR)

@ -14,7 +14,10 @@ blockBlockhash.prototype.visit = function (node) {
blockBlockhash.prototype.report = function (compilationResults) {
return this.warningNodes.map(function (item, i) {
return {
warning: `use of "block.blockhash": "block.blockhash" is used to access the last 256 block hashes. A miner computes the block hash by "summing up" the information in the current block mined. By "summing up" the information in a clever way a miner can try to influence the outcome of a transaction in the current block. This is especially easy if there are only a small number of equally likely outcomes.`,
warning: `use of "block.blockhash": "block.blockhash" is used to access the last 256 block hashes.
A miner computes the block hash by "summing up" the information in the current block mined.
By "summing up" the information in a clever way a miner can try to influence the outcome of a transaction in the current block.
This is especially easy if there are only a small number of equally likely outcomes.`,
location: item.src
}
})

@ -16,13 +16,15 @@ blockTimestamp.prototype.visit = function (node) {
blockTimestamp.prototype.report = function (compilationResults) {
return this.warningNowNodes.map(function (item, i) {
return {
warning: `use of "now": "now" does not mean current time. Now is an alias for block.timestamp. Block.timestamp can be influenced by miners to a certain degree, be careful.`,
warning: `use of "now": "now" does not mean current time. Now is an alias for block.timestamp.
Block.timestamp can be influenced by miners to a certain degree, be careful.`,
location: item.src,
more: 'http://solidity.readthedocs.io/en/develop/frequently-asked-questions.html#are-timestamps-now-block-timestamp-reliable'
}
}).concat(this.warningblockTimestampNodes.map(function (item, i) {
return {
warning: `use of "block.timestamp": "block.timestamp" can be influenced by miners to a certain degree. That means that a miner can "choose" the block.timestamp, to a certain degree, to change the outcome of a transaction in the mined block.`,
warning: `use of "block.timestamp": "block.timestamp" can be influenced by miners to a certain degree.
That means that a miner can "choose" the block.timestamp, to a certain degree, to change the outcome of a transaction in the mined block.`,
location: item.src,
more: 'http://solidity.readthedocs.io/en/develop/frequently-asked-questions.html#are-timestamps-now-block-timestamp-reliable'
}

@ -14,7 +14,8 @@ inlineAssembly.prototype.visit = function (node) {
inlineAssembly.prototype.report = function (compilationResults) {
return this.inlineAssNodes.map((node) => {
return {
warning: `CAUTION: The Contract uses inline assembly, this is only advised in rare cases. Additionally static analysis modules do not parse inline Assembly, this can lead to wrong analysis results.`,
warning: `CAUTION: The Contract uses inline assembly, this is only advised in rare cases.
Additionally static analysis modules do not parse inline Assembly, this can lead to wrong analysis results.`,
location: node.src,
more: 'http://solidity.readthedocs.io/en/develop/assembly.html#solidity-assembly'
}

@ -25,21 +25,30 @@ lowLevelCalls.prototype.report = function (compilationResults) {
var morehref = null
switch (item.type) {
case common.lowLevelCallTypes.CALL:
text = `use of "call": the use of low level "call" should be avoided whenever possible. It can lead to unexpected behavior if return value is not handled properly. Please use Direct Calls via specifying the called contract's interface.<br />`
morehref = `http://solidity.readthedocs.io/en/develop/control-structures.html?#external-function-calls`
text = `use of "call": the use of low level "call" should be avoided whenever possible.
It can lead to unexpected behavior if return value is not handled properly.
Please use Direct Calls via specifying the called contract's interface.<br />`
morehref = 'http://solidity.readthedocs.io/en/develop/control-structures.html?#external-function-calls'
// http://solidity.readthedocs.io/en/develop/frequently-asked-questions.html?#why-is-the-low-level-function-call-less-favorable-than-instantiating-a-contract-with-a-variable-contractb-b-and-executing-its-functions-b-dosomething
break
case common.lowLevelCallTypes.CALLCODE:
text = `use of "callcode": the use of low level "callcode" should be avoided whenever possible. External code that is called can change the state of the calling contract and send ether form the caller's balance. If this is wantend behaviour use the Solidity library feature if possible.<br />`
morehref = `http://solidity.readthedocs.io/en/develop/contracts.html#libraries`
text = `use of "callcode": the use of low level "callcode" should be avoided whenever possible.
External code that is called can change the state of the calling contract and send ether form the caller's balance.
If this is wantend behaviour use the Solidity library feature if possible.<br />`
morehref = 'http://solidity.readthedocs.io/en/develop/contracts.html#libraries'
break
case common.lowLevelCallTypes.DELEGATECALL:
text = `use of "delegatecall": the use of low level "delegatecall" should be avoided whenever possible. External code that is called can change the state of the calling contract and send ether form the caller's balance. If this is wantend behaviour use the Solidity library feature if possible.<br />`
morehref = `http://solidity.readthedocs.io/en/develop/contracts.html#libraries`
text = `use of "delegatecall": the use of low level "delegatecall" should be avoided whenever possible.
External code that is called can change the state of the calling contract and send ether form the caller's balance.
If this is wantend behaviour use the Solidity library feature if possible.<br />`
morehref = 'http://solidity.readthedocs.io/en/develop/contracts.html#libraries'
break
case common.lowLevelCallTypes.SEND:
text = `use of "send": "send" does not throw an exception when not successful, make sure you deal with the failure case accordingly. Use "transfer" whenever failure of the ether transfer should rollback the whole transaction. Note: if you "send/transfer" ether to a contract the fallback function is called, the callees fallback function is very limited due to the limited amount of gas provided by "send/transfer". No state changes are possible but the callee can log the event or revert the transfer. "send/transfer" is syntactic sugar for a "call" to the fallback function with 2300 gas and a specified ether value. <br />`
morehref = `http://solidity.readthedocs.io/en/develop/security-considerations.html#sending-and-receiving-ether`
text = `use of "send": "send" does not throw an exception when not successful, make sure you deal with the failure case accordingly.
Use "transfer" whenever failure of the ether transfer should rollback the whole transaction.
Note: if you "send/transfer" ether to a contract the fallback function is called, the callees fallback function is very limited due to the limited amount of gas provided by "send/transfer".
No state changes are possible but the callee can log the event or revert the transfer. "send/transfer" is syntactic sugar for a "call" to the fallback function with 2300 gas and a specified ether value. <br />`
morehref = 'http://solidity.readthedocs.io/en/develop/security-considerations.html#sending-and-receiving-ether'
break
}
return { warning: text, more: morehref, location: item.node.src }

@ -14,7 +14,7 @@ thisLocal.prototype.visit = function (node) {
thisLocal.prototype.report = function (compilationResults) {
return this.warningNodes.map(function (item, i) {
return {
warning: `Use of "this" for local functions: Never use this to call functions in the same contract, it only consumes more gas than normal local calls.`,
warning: 'Use of "this" for local functions: Never use this to call functions in the same contract, it only consumes more gas than normal local calls.',
location: item.src,
more: 'http://solidity.readthedocs.io/en/develop/control-structures.html#external-function-calls'
}

@ -212,7 +212,6 @@ function updateAccountBalances (container, appAPI) {
}
function updatePendingTxs (container, appAPI) {
container.querySelector('#pendingtxs').innerText = Object.keys(appAPI.udapp().pendingTransactions()).length + ' pending'
}

@ -5,7 +5,7 @@ var sauce = require('./sauce')
var sources = {
'sources': {
'localhost/folder1/contract2.sol': `contract test2 { function get () returns (uint) { return 11; }}`
'localhost/folder1/contract2.sol': 'contract test2 { function get () returns (uint) { return 11; }}'
}
}

Loading…
Cancel
Save