CRYPTO NEWS

what is the length of an array of struct?

I made a Wallet Contract to store all the tokens an account possess.

There is a mapping(address=>TokenInfo[]), and address refers to the account, TokenInfo[] stored tokens which this account holds. TokenInfo is an array of TokenInfo struct, in which token is the token address, exist means whether the token has been added to the array.

contract Wallet {     struct TokenInfo {         IERC20Token token;         uint exist;//0 means unregistered     }      mapping(address=>TokenInfo[]) public tokenList;      function Wallet() {      }      function addToken(address _account, IERC20Token _token) public {         for (uint i = 0; i < tokenList[_account].length; i++) {//seems didn't enter the loop             if (tokenList[_account][i].exist == 0) {                 var tokenInfo = TokenInfo(_token, 1);                 tokenList[_account].push(tokenInfo);             }         }     }      function getTokenListLength(address _account) public constant returns (uint) {         return tokenList[_account].length;     } } 

But when I call addToken() function, it didn’t work. It seems that it never entered the loop.

Fixed variable in Groth16

In the paper On the Size of Pairing-based Non-interactive Arguments by Jens Groth, it is always referred in the equations to satisfy that $a_0 = 1$ and the others $a_1, …, a_m in mathbb{F}$. I am not sure I understand this specification, as we can always set $a_0$ later to 1 if needed. I first::Listen

In the paper On the Size of Pairing-based Non-interactive Arguments by Jens Groth, it is always referred in the equations to satisfy that $a_0 = 1$ and the others $a_1, …, a_m in mathbb{F}$.

I am not sure I understand this specification, as we can always set $a_0$ later to 1 if needed. I first thought it was to introduce the constant 1 for the arithmetic circuit basic operation but I am wondering now if this specific value has another use.

what is the length of an array of struct?

Shopping cart
There are no products in the cart!
Continue shopping
0