Add HashGlobalInputs for ZKInputs

Add HashGlobalInputs for ZKInputs compatible with js & circom circuits version.

Compatible with hermeznetwork/commonjs at version: c6a1448db5bae4cda839ce36c1f35d8defccc9cd
(c6a1448db5)
This commit is contained in:
arnaucube
2020-11-09 14:03:13 +01:00
parent 4aa686797d
commit ce772b1d19
15 changed files with 501 additions and 52 deletions

View File

@@ -153,9 +153,11 @@ func (tx L1Tx) Tx() Tx {
func (tx *L1Tx) BytesGeneric() ([]byte, error) {
var b [L1UserTxBytesLen]byte
copy(b[0:20], tx.FromEthAddr.Bytes())
pkCompL := tx.FromBJJ.Compress()
pkCompB := SwapEndianness(pkCompL[:])
copy(b[20:52], pkCompB[:])
if tx.FromBJJ != nil {
pkCompL := tx.FromBJJ.Compress()
pkCompB := SwapEndianness(pkCompL[:])
copy(b[20:52], pkCompB[:])
}
fromIdxBytes, err := tx.FromIdx.Bytes()
if err != nil {
return nil, err