StateDB ZKInputs generation compatible with circom

- Add SignatureConstant to L1Tx.TxCompressedData
- ZKInputs generation works initial version working and compatible with circom Hermez circuit
    - Lots of small updates for circuits compatibility
- Update version (with new changes) of `go-iden3-crypto` & `go-merkletree`
This commit is contained in:
arnaucube
2020-12-01 22:15:19 +01:00
parent d306f4890a
commit 80cbac24f9
13 changed files with 187 additions and 105 deletions

View File

@@ -167,8 +167,9 @@ func (tx L1Tx) TxCompressedData() (*big.Int, error) {
if err != nil {
return nil, tracerr.Wrap(err)
}
var b [31]byte
// b[0:7] empty: no fee neither nonce
// b[0:7] empty: no ToBJJSign, no fee, no nonce
copy(b[7:11], tx.TokenID.Bytes())
copy(b[11:13], amountFloat16.Bytes())
toIdxBytes, err := tx.ToIdx.Bytes()
@@ -181,8 +182,8 @@ func (tx L1Tx) TxCompressedData() (*big.Int, error) {
return nil, tracerr.Wrap(err)
}
copy(b[19:25], fromIdxBytes[:])
copy(b[25:27], []byte{0, 1}) // TODO this will be generated by the ChainID config parameter
// b[27:] empty: no signature
copy(b[25:27], []byte{0, 0}) // TODO this will be generated by the ChainID config parameter
copy(b[27:31], SignatureConstantBytes[:])
bi := new(big.Int).SetBytes(b[:])
return bi, nil