warning links reviewed

pull/5370/head
aniket-engg 5 years ago committed by Aniket
parent 08c0f2a9bd
commit ca7560c4e3
  1. 4
      remix-analyzer/src/solidity-analyzer/modules/blockTimestamp.ts
  2. 4
      remix-analyzer/src/solidity-analyzer/modules/constantFunctions.ts
  3. 2
      remix-analyzer/src/solidity-analyzer/modules/deleteDynamicArrays.ts
  4. 2
      remix-analyzer/src/solidity-analyzer/modules/deleteFromDynamicArray.ts
  5. 4
      remix-analyzer/src/solidity-analyzer/modules/erc20Decimals.ts
  6. 2
      remix-analyzer/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray.ts
  7. 2
      remix-analyzer/src/solidity-analyzer/modules/inlineAssembly.ts
  8. 1
      remix-analyzer/src/solidity-analyzer/modules/lowLevelCalls.ts
  9. 2
      remix-analyzer/src/solidity-analyzer/modules/selfdestruct.ts
  10. 2
      remix-analyzer/src/solidity-analyzer/modules/stringBytesLength.ts
  11. 3
      remix-analyzer/src/solidity-analyzer/modules/txOrigin.ts

@ -23,14 +23,14 @@ export default class blockTimestamp implements AnalyzerModule {
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'
more: 'https://solidity.readthedocs.io/en/develop/units-and-global-variables.html?highlight=block.timestamp#block-and-transaction-properties'
}
}).concat(this.warningblockTimestampNodes.map((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.`,
location: item.src,
more: 'http://solidity.readthedocs.io/en/develop/frequently-asked-questions.html#are-timestamps-now-block-timestamp-reliable'
more: 'https://solidity.readthedocs.io/en/develop/units-and-global-variables.html?highlight=block.timestamp#block-and-transaction-properties'
}
}))
}

@ -65,13 +65,13 @@ export default class constantFunctions implements AnalyzerModule {
warnings.push({
warning: `${funcName} : Potentially should be constant/view/pure but is not. ${comments}`,
location: func.node['src'],
more: 'http://solidity.readthedocs.io/en/develop/contracts.html#constant-functions'
more: 'https://solidity.readthedocs.io/en/develop/contracts.html#view-functions'
})
} else {
warnings.push({
warning: `${funcName} : Is constant but potentially should not be. ${comments}`,
location: func.node['src'],
more: 'http://solidity.readthedocs.io/en/develop/contracts.html#constant-functions'
more: 'https://solidity.readthedocs.io/en/develop/contracts.html#view-functions'
})
}
}

@ -19,7 +19,7 @@ export default class deleteDynamicArrays implements AnalyzerModule {
return {
warning: `The "delete" operation when applied to a dynamically sized array in Solidity generates code to delete each of the elements contained. If the array is large, this operation can surpass the block gas limit and raise an OOG exception. Also nested dynamically sized objects can produce the same results.`,
location: node.src,
more: 'http://solidity.readthedocs.io/en/latest/types.html?highlight=array#delete'
more: 'https://solidity.readthedocs.io/en/latest/types.html#delete'
}
})
}

@ -19,7 +19,7 @@ export default class deleteFromDynamicArray implements AnalyzerModule {
return {
warning: `Using "delete" on an array leaves a gap. The length of the array remains the same. If you want to remove the empty position you need to shift items manually and update the "length" property.`,
location: node.src,
more: 'https://github.com/miguelmota/solidity-idiosyncrasies'
more: 'https://github.com/miguelmota/solidity-idiosyncrasies#examples'
}
})
}

@ -34,7 +34,7 @@ export default class erc20Decimals implements AnalyzerModule {
warnings.push({
warning: `ERC20 contract's "decimals" variable should be "uint8" type`,
location: node.src,
more: ' https://eips.ethereum.org/EIPS/eip-20'
more: 'https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#decimals'
})
}
} else if (decimalsFun.length > 0) {
@ -42,7 +42,7 @@ export default class erc20Decimals implements AnalyzerModule {
warnings.push({
warning: `ERC20 contract's "decimals" function should have "uint8" as return type`,
location: fn.node.src,
more: ' https://eips.ethereum.org/EIPS/eip-20'
more: 'https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#decimals'
})
}
}

@ -25,7 +25,7 @@ export default class forLoopIteratesOverDynamicArray implements AnalyzerModule {
return {
warning: `Loops that do not have a fixed number of iterations, for example, loops that depend on storage values, have to be used carefully. Due to the block gas limit, transactions can only consume a certain amount of gas. The number of iterations in a loop can grow beyond the block gas limit which can cause the complete contract to be stalled at a certain point. \n Additionally, using unbounded loops incurs in a lot of avoidable gas costs. Carefully test how many items at maximum you can pass to such functions to make it successful.`,
location: node.src,
more: 'http://solidity.readthedocs.io/en/v0.4.24/security-considerations.html#gas-limit-and-loops'
more: 'http://solidity.readthedocs.io/en/latest/security-considerations.html#gas-limit-and-loops'
}
})
}

@ -19,7 +19,7 @@ export default class inlineAssembly implements AnalyzerModule {
warning: `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'
more: 'http://solidity.readthedocs.io/en/develop/assembly.html'
}
})
}

@ -43,7 +43,6 @@ export default class lowLevelCalls implements AnalyzerModule {
It can lead to unexpected behavior if return value is not handled properly.
Please use Direct Calls via specifying the called contract's interface.`
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 lowLevelCallTypes.CALLCODE:
text = `Use of "callcode": should be avoided whenever possible.

@ -36,7 +36,7 @@ export default class selfdestruct implements AnalyzerModule {
warnings.push({
warning: `Use of selfdestruct: No code after selfdestruct is executed. Selfdestruct is a terminal.`,
location: node.src,
more: 'http://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html#self-destruct'
more: 'https://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html#deactivate-and-self-destruct'
})
hasSelf = false
}

@ -22,7 +22,7 @@ export default class stringBytesLength implements AnalyzerModule {
return [{
warning: `"bytes" and "string" lengths are not the same since strings are assumed to be UTF-8 encoded (according to the ABI defintion) therefore one character is not nessesarily encoded in one byte of data.`,
location: this.bytesLengthChecks[0].src,
more: 'https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#argument-encoding'
more: 'https://solidity.readthedocs.io/en/develop/abi-spec.html#argument-encoding'
}]
} else {
return []

@ -20,7 +20,8 @@ export default class txOrigin implements AnalyzerModule {
return {
warning: `Use of tx.origin: "tx.origin" is useful only in very exceptional cases.
If you use it for authentication, you usually want to replace it by "msg.sender", because otherwise any contract you call can act on your behalf.`,
location: item.src
location: item.src,
more: 'https://solidity.readthedocs.io/en/develop/security-considerations.html#tx-origin'
}
})
}

Loading…
Cancel
Save