mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Update ZKInputs for empty batches
- Add TestZKInputsEmpty circom test vectors - Fix ZKInputsHash OldLastIdx bytearray
This commit is contained in:
@@ -431,8 +431,9 @@ func (z ZKInputs) ToHashGlobalData() ([]byte, error) {
|
|||||||
|
|
||||||
// [MAX_NLEVELS bits] oldLastIdx
|
// [MAX_NLEVELS bits] oldLastIdx
|
||||||
oldLastIdx := make([]byte, bytesMaxLevels)
|
oldLastIdx := make([]byte, bytesMaxLevels)
|
||||||
copy(oldLastIdx, z.OldLastIdx.Bytes())
|
oldLastIdxBytes := z.OldLastIdx.Bytes()
|
||||||
b = append(b, SwapEndianness(oldLastIdx)...)
|
copy(oldLastIdx[len(oldLastIdx)-len(oldLastIdxBytes):], oldLastIdxBytes)
|
||||||
|
b = append(b, oldLastIdx...)
|
||||||
|
|
||||||
// [MAX_NLEVELS bits] newLastIdx
|
// [MAX_NLEVELS bits] newLastIdx
|
||||||
newLastIdx := make([]byte, bytesMaxLevels)
|
newLastIdx := make([]byte, bytesMaxLevels)
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ func (s *StateDB) ProcessTxs(ptc ProcessTxsConfig, coordIdxs []common.Idx, l1use
|
|||||||
s.zki = common.NewZKInputs(ptc.MaxTx, ptc.MaxL1Tx, ptc.MaxTx, ptc.MaxFeeTx, ptc.NLevels, s.currentBatch.BigInt())
|
s.zki = common.NewZKInputs(ptc.MaxTx, ptc.MaxL1Tx, ptc.MaxTx, ptc.MaxFeeTx, ptc.NLevels, s.currentBatch.BigInt())
|
||||||
s.zki.OldLastIdx = s.idx.BigInt()
|
s.zki.OldLastIdx = s.idx.BigInt()
|
||||||
s.zki.OldStateRoot = s.mt.Root().BigInt()
|
s.zki.OldStateRoot = s.mt.Root().BigInt()
|
||||||
|
s.zki.Metadata.NewLastIdxRaw = s.idx
|
||||||
}
|
}
|
||||||
|
|
||||||
// TBD if ExitTree is only in memory or stored in disk, for the moment
|
// TBD if ExitTree is only in memory or stored in disk, for the moment
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user