Commit Graph

103 Commits

Author SHA1 Message Date
arnaucube
fe435211c9 add collision check at test TestHashMoreThan32BytesMiMC 2025-01-27 13:36:48 +01:00
arnaucube
5a0f6981f7 add hash bytes collision test 2025-01-09 08:57:28 +01:00
p4u
a7c0c5f8c3 implement modulo chunking on mimc hashing
Signed-off-by: p4u <pau@dabax.net>
2024-12-17 11:28:05 +01:00
p4u
e64315269b update deps
Signed-off-by: p4u <pau@dabax.net>
2024-12-16 11:39:34 +01:00
Gui Iribarren
4aa3818aa9 add HashFunctionMiMC_BN254
mimc hash implementation over bn254 ecc from gnark
2024-12-16 11:33:45 +01:00
Gui Iribarren
cfebf3e7fd add HashMultiPoseidon 2024-12-16 11:33:45 +01:00
Lucas Menéndez
8e1cc943f4 feature: mimc bls12 377 (#31)
add mimc hash implementation over bls12_377 ecc from gnark
2024-11-20 12:26:23 +01:00
p4u
ffd61a98c8 update node version on github workflow
Signed-off-by: p4u <pau@dabax.net>
2024-11-06 10:05:29 +01:00
p4u
9388fcd6e4 update go version on github workflow
Signed-off-by: p4u <pau@dabax.net>
2024-11-06 09:51:02 +01:00
p4u
015a3c8d9a update README archive notice
Signed-off-by: p4u <pau@dabax.net>
2024-11-06 09:48:40 +01:00
p4u
3554342282 update dependencies, upgrade code and add a memory database
Signed-off-by: p4u <pau@dabax.net>
2024-11-06 09:45:28 +01:00
arnaucube
8a3b3769d1 Merge pull request #30 from vocdoni/mvdan-patch-1
README: note the archival
2023-01-28 08:34:09 +01:00
Daniel Martí
6abaac3b84 README: note the archival 2023-01-27 21:54:55 +00:00
arnaucube
c3e910e2af Update value len limit,add checks on leaf addition
Update value length limit to 2^16-1, add checks on leaf addition for key
& value length.
2022-09-03 16:42:04 +02:00
arnaucube
c31f1a57c1 Merge pull request #29 from vocdoni/use_io_writer
use io.Writer interface for Dump methods
2022-08-26 08:52:15 +02:00
p4u
c9650553a1 use io.Writer interface for Dump methods
Signed-off-by: p4u <pau@dabax.net>
2022-08-25 22:36:28 +02:00
Pau
40a0fb9bff Merge pull request #28 from vocdoni/feature/dump-writer-reader
Extend Dump methods to work with Writer&Reader
2022-08-25 16:27:37 +02:00
arnaucube
2380214412 Extend Dump methods to work with Writer&Reader
Add methods DumpWriter & ImportDumpReader to allow generating tree
dumps and reading them working with Reader & Writer, in order to write
and read them directly from a file (internally line by line).
2022-08-25 10:31:22 +02:00
arnaucube
688a2e814d Update README.md 2022-02-04 11:12:22 +01:00
arnaucube
a5eeb50d5e Upgrade to last goff version
Upgrade to last go-iden3-crypto, which has been upgraded to the new goff
(https://github.com/ConsenSys/goff) version used for the finite fields
arithmetic, which has been significantly optimized.

Previous:
TestAddBatchBench: nCPU: 4, nLeafs: 50000, hash: Poseidon, db: badgerdb
        Add loop:       44.043418294s
        AddBatch:       3.219378868s

New:
TestAddBatchBench: nCPU: 4, nLeafs: 50000, hash: Poseidon, db: badgerdb
        Add loop:       30.915348956s
        AddBatch:       2.289317479s

Improvement (using arbo with Poseidon hash): 1.40x
2022-01-07 11:33:41 +01:00
arnaucube
d56ab859f1 Use DefaultThresholdNLeafs if cfg.ThresholdNLeafs is not defined 2021-12-17 09:57:03 +01:00
arnau
96ccfdb50f Merge pull request #26 from vocdoni/feature/addbatch-bigtrees-indisk
Feature/addbatch bigtrees indisk
2021-12-17 09:42:07 +01:00
arnaucube
e8094038ee Complete upFromSubRoots cases & add test 2021-11-23 13:33:40 +01:00
arnaucube
4b6d6efdca Add thresholdNLeafs configurable
ThresholdNLeafs defines the threshold number of leafs in the tree that
determines if AddBatch will work in memory or in disk. It is defined
when calling NewTree, and if set to 0 it will work always in disk.
2021-11-23 06:59:33 +01:00
arnaucube
17bf867f61 Add bytes-bitmap test vectors 2021-11-12 18:59:08 +01:00
arnaucube
fc45fbde3f Add Pack & Unpack siblings test vectors 2021-11-11 11:40:11 +01:00
arnaucube
6cf1e58d9f Implement addBatchInDisk for big trees
Implement addBatchInDisk for big trees, which does not puts the tree in
memory, and works directly over the db data, parallelizing for each CPU.
2021-10-25 14:55:42 +02:00
arnau
3f7e769974 Merge pull request #24 from vocdoni/feature/addbatch-invalids-error-struct
Update AddBatch to return invalids index + error
2021-10-11 15:45:49 +02:00
arnaucube
7c6316dcbd Update AddBatch to return invalids index + error 2021-10-06 19:19:16 +02:00
arnau
63f7e8866e Merge pull request #21 from vocdoni/feature/keyPath-key-len-check
Update keyPath to ceil(maxLvl/8), add checks that len(key)<=maxKeyLen
2021-10-05 18:08:55 +02:00
arnaucube
e8404e16f3 Fix oldLeafKeyFull size at method tree.down 2021-10-05 18:06:11 +02:00
arnaucube
30d8b42fd3 Add checks that len(key)<=maxKeyLen
Add checks that the key is not bigger than maximum key length for the tree
maxLevels size, where maximum key len = ceil(maxLevels/8).

This is because if the key bits length is bigger than the maxLevels of the
tree, two different keys that their difference is at the end, will collision in
the same leaf of the tree (at the max depth).
2021-10-04 14:33:49 +02:00
arnaucube
0921cac304 Update keyPath to be ceil(maxLevels/8) 2021-10-01 10:57:50 +02:00
arnau
9eb7c8e265 Merge pull request #19 from vocdoni/feature/panic-toobig
Return err before silently discarding bytes
2021-09-30 17:31:44 +02:00
arnaucube
cb14f1c75b Update err msgs,update maxUint8&16, comment checks
- Update err msgs
- Update maxUint8&16
- Comment the keyPath len checks temporary to avoid external usage
errors (will be refactored in a near-future commit)
- Add missing len check on GetWithTx (commented)
2021-09-30 16:25:24 +02:00
Eduard S
a8c13ab0db Return err before silently discarding bytes 2021-09-30 16:15:51 +02:00
arnau
d7c7563413 Merge pull request #20 from vocdoni/feature/SetRoot
Add tree.SetRoot (& WithTx)
2021-09-27 15:14:31 +02:00
arnaucube
6062549cf0 Add tree.SetRoot (& WithTx) 2021-09-27 13:46:53 +02:00
arnau
4227039df1 Merge pull request #16 from vocdoni/feature/rlocks
Update VT goroutines errs & Update Pack&UnpackSibl
2021-09-21 17:40:09 +02:00
arnaucube
ed0cf70d57 Update VT goroutines errs & Update Pack&UnpackSibl
- Update VT goroutines errs to avoid race condition
- Update pack & unpack siblings to use 2-byte for full length & bitmap
bytes length
- Add check in UnpackSiblings to avoid panic
2021-09-21 17:37:11 +02:00
arnau
f09b0b0392 Merge pull request #14 from vocdoni/fix/missing-emptyHash-in-snapshottree
Add missing emptyHash in Snapshot Tree
2021-09-09 12:29:59 +02:00
arnaucube
64c8f8d0bc Add missing emptyHash in Snapshot Tree 2021-09-09 11:42:41 +02:00
arnau
de5914f453 Merge pull request #11 from vocdoni/fix/incNLeafs
Fix: Use GetNLeafsWithTx in incNLeafs
2021-08-31 16:15:31 +02:00
Eduard S
baa1d7af48 Fix: Use GetNLeafsWithTx in incNLeafs 2021-08-31 14:40:35 +02:00
arnau
4836f19755 Merge pull request #9 from vocdoni/fix/level
Fix level when going down & in computeHashes
2021-08-31 12:37:21 +02:00
arnaucube
dff11f4a7f Fix level when going down & in computeHashes
Fix level when going down & in computeHashes, this affected the methods
Get, GenProof & AddBatch.
2021-08-31 11:59:38 +02:00
arnau
61b823d444 Merge pull request #8 from vocdoni/fix/vt-addbatch
Fix/vt addbatch
2021-08-30 12:42:59 +02:00
arnaucube
01408fba86 Use Prefix consts instead of hardcoded values in newLeafValue & newIntermediate methods 2021-08-30 11:27:59 +02:00
arnaucube
1638860da0 Fix VirtualTree.addBatch bucket levels 2021-08-29 23:38:41 +02:00
arnaucube
bc23beb813 Add NewTreeWithTx function 2021-08-25 10:50:41 +02:00