EYBlockchain / starlight

:zap: solidity --> zApp transpiler :zap:
Other
188 stars 38 forks source link

Non-secret arrays. #310

Closed lydiagarms closed 2 months ago

lydiagarms commented 4 months ago

We get several errors with non-secret arrays. Test the following contract. There are zappify errors for add and add1.

// SPDX-License-Identifier: CC0 pragma solidity ^0.8.0; contract Assign { secret uint256 private a; secret uint256 private b; uint256 [] public c;

function add( uint256 value) public { c[0] += value; }

function add1( uint256 value) public { c[0] += value; known a += c[0]; }

function add2( uint256 value) public { c[0] += value; known a += value; }

}

Also test with if statements:

// SPDX-License-Identifier: CC0

pragma solidity ^0.8.0;

contract MyContract {

secret uint256 private a;
uint256[] private b;

function add(uint256 value) public {
  if(b[0] < 5) {
   b[0] += 1;
  }
  a += b + value;
}

}