Truffle: Update Assert.sol to 0.4.21 and avoid compilation warnings

Created on 12 Apr 2018  路  5Comments  路  Source: trufflesuite/truffle

Issue

The contract Assert.sol within truffle's test environment has deprecated things according to solidity 0.4.21. Maybe it happens in other contracts too.

Steps to Reproduce

Create a test in solidity, import "truffle/Assert.sol" and run the test.

Actual Results

  • Warning: Use of the "var" keyword is deprecated.
  • Warning: Invoking events without "emit" prefix is deprecated.

Environment

  • Truffle version: 4.1.5

All 5 comments

Updated Assert.sol to 0.4.21 but still getting these warnings
Warning: Use of the "var" keyword is deprecated.
Warning: Invoking events without "emit" prefix is deprecated.

Hey.
To avoid the first warning, about the use of "var", you have to introduce the types on tuple assignments...
use
address a; uint256 b; address c; (a,b,c) = myFunction();
Instead of
var (a, b, c) = myFunction()

To avoid the second warning, about the keyword "emit", just type it when fire contract events. For example:
emit LogSomething(var1, var2, ..., varN)

Fixed in https://github.com/trufflesuite/truffle-core/pull/131.
The issue can be closed.

Added this to the release bucket. Will close when it's released. Thanks!

@luisfidelis Still a few warning in there sorry, they're new to 0.4.23 - sorry. But lots are gone. Going to close this, but we'll continue to revisit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Katsu1991 picture Katsu1991  路  3Comments

jleeh picture jleeh  路  3Comments

hefgi picture hefgi  路  3Comments

oed picture oed  路  3Comments

arunmitteam picture arunmitteam  路  3Comments