althea-net / simple-bidirectional-erc20-channel

0 stars 2 forks source link

Solidity compile errors #2

Open mpapierski opened 6 years ago

mpapierski commented 6 years ago

Interesting issue - just few months ago it was probably working fine.

I'm not solidity expert but seems like we hit some limitation of the compiler.

λ ~/Projects/simple-bidirectional-erc20-channel/ update-deps solc --version
solc, the solidity compiler commandline interface
Version: 0.4.25+commit.59dbf8f1.Darwin.appleclang
λ ~/Projects/simple-bidirectional-erc20-channel/ update-deps truffle compile
Compiling ./contracts/ChannelManager.sol...
Compiling ./contracts/ECTools.sol...
Compiling ./contracts/Migrations.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol...

/Users/michal/Projects/simple-bidirectional-erc20-channel/contracts/ChannelManager.sol:160:44: CompilerError: Stack too deep, try removing local variables.
        Channel storage channel = channels[channelId];
                                           ^-------^
Compilation failed. See above.
janus commented 6 years ago

@mpapierski This issue is from this function isValidStateUpdate. It should be broke up into smaller functions. https://ethereum.stackexchange.com/questions/7325/stack-too-deep-try-removing-local-variables

mpapierski commented 6 years ago

Thanks @janus. I'm not a solidity expert but this links seems to explain the issue very well. With that in mind this contract could be probably improved with minimal effort.