Documentation ¶
Overview ¶
All the functionalities when only pruned proof and pruned UPK tree is available. UPKs are technically not sent around as a tree, as UPK is fixed prefetching all UPKs for all indices of interest saves the time to fetch UPK from its tree. Same trick does not work for proof trees as we need to update them often.
Index ¶
- Constants
- Variables
- func BoundsPrint(start, stop uint64) string
- func FindTreeGPS(k uint64, L int) []uint64
- func GenerateVector(N uint64) []mcl.Fr
- func GetFrByteSize() int
- func GetG1ByteSize() int
- func GetG2ByteSize() int
- func GetGTByteSize() int
- func GetProofVecFromDb(proofs_db map[uint64][]mcl.G1, indexVec []uint64) [][]mcl.G1
- func IndexInTheLevel(n uint64) (uint8, uint64)
- func IsEqual(a, b *VCS) bool
- func LoadVector(N uint64, folderPath string) []mcl.Fr
- func ReverseSliceBool(a []bool) []bool
- func ReverseSliceUint64(a []uint64) []uint64
- func SaveVector(N uint64, aFr []mcl.Fr)
- func SliceIsEqual(a, b []mcl.G1) bool
- func ToBinary(index uint64, L uint8) []bool
- type TreeGPS
- type VCS
- func (vcs *VCS) AggProve(indexVec []uint64, proofVec [][]mcl.G1) batch.Proof
- func (vcs *VCS) AggVerify(proof batch.Proof, digest mcl.G1, indexVec []uint64, a_i []mcl.Fr) bool
- func (vcs *VCS) Commit(a []mcl.Fr, L uint64) mcl.G1
- func (vcs *VCS) GenAggGipa()
- func (vcs *VCS) GenProofsTreeFake(count uint64) (mcl.G1, []uint64, []mcl.Fr, map[uint64][]mcl.G1, [][]mcl.G1, ...)
- func (vcs *VCS) GenUpkFake(index uint64) []mcl.G1
- func (vcs *VCS) GetProofPath(index uint64) []mcl.G1
- func (vcs *VCS) GetProofPathDB(proofTree []map[uint64]mcl.G1, index uint64) []mcl.G1
- func (vcs *VCS) GetUpk(i uint64) []mcl.G1
- func (vcs *VCS) Init(L uint8, folder string, txnLimit uint64)
- func (vcs *VCS) KeyGen(ncores uint8, L uint8, folder string, txnLimit uint64)
- func (vcs *VCS) KeyGenFake(ncores uint8, L uint8, folder string, txnLimit uint64)
- func (vcs *VCS) KeyGenLoad(ncores uint8, L uint8, folder string, txnLimit uint64)
- func (vcs *VCS) KeyGenLoadFake(ncores uint8, L uint8, folder string, txnLimit uint64)
- func (self *VCS) LoadAggGipa()
- func (vcs *VCS) LoadTrapdoor(L uint8)
- func (vcs *VCS) MallocUpk()
- func (vcs *VCS) OpenAll(a []mcl.Fr)
- func (vcs *VCS) OpenAllRec(a []mcl.Fr, start uint64, end uint64, L uint8)
- func (vcs *VCS) PrkGen(index uint8, start uint64, stop uint64, wg *sync.WaitGroup)
- func (vcs *VCS) PrkGenDriver()
- func (vcs *VCS) PrkLoad(fileName string, index uint8, start uint64, stop uint64, wg *sync.WaitGroup)
- func (vcs *VCS) PrkLoadDriver()
- func (vcs *VCS) PrkUpkGen()
- func (vcs *VCS) PrkUpkLoad()
- func (self *VCS) ResizeAgg(txnLimit uint64)
- func (vcs *VCS) SaveTrapdoor()
- func (vcs *VCS) SelectPRK(index uint64) mcl.Fr
- func (vcs *VCS) SelectUPK(L uint8, index uint64) mcl.Fr
- func (vcs *VCS) TrapdoorsGen()
- func (vcs *VCS) UpdateCom(digest mcl.G1, updateindex uint64, delta mcl.Fr) mcl.G1
- func (vcs *VCS) UpdateComVec(digest mcl.G1, updateindex []uint64, delta []mcl.Fr) mcl.G1
- func (vcs *VCS) UpdateComVecDB(upk_db map[uint64][]mcl.G1, digest mcl.G1, updateindex []uint64, ...) mcl.G1
- func (vcs *VCS) UpdateProof(proof []mcl.G1, localindex uint64, updateindex uint64, delta mcl.Fr) []mcl.G1
- func (vcs *VCS) UpdateProofTree(updateindex uint64, delta mcl.Fr)
- func (vcs *VCS) UpdateProofTreeBulk(updateindexVec []uint64, deltaVec []mcl.Fr) int
- func (vcs *VCS) UpdateProofTreeBulkDB(proofTree []map[uint64]mcl.G1, upk_db map[uint64][]mcl.G1, ...) ([]map[uint64]mcl.G1, int)
- func (vcs *VCS) UpkGen(index uint8, start uint64, stop uint64, wg *sync.WaitGroup)
- func (vcs *VCS) UpkGenDriver()
- func (vcs *VCS) UpkLoad(fileName string, index uint8, start uint64, stop uint64, wg *sync.WaitGroup)
- func (vcs *VCS) UpkLoadDriver()
- func (vcs *VCS) Verify(digest mcl.G1, index uint64, a_i mcl.Fr, proof []mcl.G1) bool
- func (vcs *VCS) VerifyMemoized(digest mcl.G1, indexVec []uint64, a_i []mcl.Fr, proofVec [][]mcl.G1) (bool, int)
- func (vcs *VCS) VerifyUPK(index uint64, upkProof []mcl.G1) bool
Constants ¶
const MAX_AGG_SIZE = 1 << 19
const SEP = "\n========================================================================================"
Variables ¶
var NCORES uint8
var NFILES uint8
var PRKNAME string
var TRAPDOORNAME string
var UPKNAME string
var VRKNAME string
Functions ¶
func BoundsPrint ¶
func FindTreeGPS ¶
Index at each level of the proof tree. Ex: 33 will be [0:0, 1:0, 2:0, 3:1, 4:2, 5:4, 6:8, 7:16]
func GenerateVector ¶
func GenerateVector(N uint64) []mcl.Fr
func GetFrByteSize ¶
func GetFrByteSize() int
func GetG1ByteSize ¶
func GetG1ByteSize() int
func GetG2ByteSize ¶
func GetG2ByteSize() int
func GetGTByteSize ¶
func GetGTByteSize() int
func GetProofVecFromDb ¶
Export the proofs in the 2D format for the VCS API
func IndexInTheLevel ¶
Converts 1D to 2D n = 7 the it corresponds to a value in [lg][start] in the tree. Say, when indexed from 0, [10] element in a 1D array is same as [3][3]
func LoadVector ¶
func ReverseSliceBool ¶
func ReverseSliceUint64 ¶
func SaveVector ¶
func SaveVector(N uint64, aFr []mcl.Fr)
func SliceIsEqual ¶
func SliceIsEqual(a, b []mcl.G1) bool
Types ¶
type VCS ¶
type VCS struct { PRK []mcl.G1 // PRK is technically not needed for our experiments UPK [][]mcl.G1 // UPK forms a tree. The UPK API in code is different from the paper. VRK []mcl.G2 VRKSubOne []mcl.G2 // h^(1-s_1) VRKSubOneRev []mcl.G2 // h^(s_1 - 1) N uint64 L uint8 G mcl.G1 //Generator H mcl.G2 //Generator ProofTree [][]mcl.G1 // Figure 2 from the paper is illustrative of how the ProofTree is saved. // GIPA Stuff MN uint64 // Power of 2 which is nearest to TxnLimit * L. In GIPA notation let M = L, n = TxnLimit = 1024 TxnLimit uint64 // Number of txns in a block that needs to be aggregated DISCARD_PRK bool // We do not use: g, g^{s_1}, g^{s_2}, g^{s_1}{s_2}, g^{s_3}..... // Thus, PRK is discarded by default // UPK tree is enough for the prover PARAM_TOO_LARGE bool // contains filtered or unexported fields }
func (*VCS) GenAggGipa ¶
func (vcs *VCS) GenAggGipa()
func (*VCS) GenProofsTreeFake ¶
func (vcs *VCS) GenProofsTreeFake(count uint64) (mcl.G1, []uint64, []mcl.Fr, map[uint64][]mcl.G1, [][]mcl.G1, []map[uint64]mcl.G1)
Goal is to generate a proof tree using trapdoors
func (*VCS) GenUpkFake ¶
Given an index in the vector, get its upk. This goes from top of the tree to leaf.
func (*VCS) GetProofPath ¶
Proof 1...l Index 0 has one 0-variables, index L - 1 has L-1 variable
func (*VCS) GetProofPathDB ¶
Proof 1...l Index 0 has one 0-variables, index L - 1 has L-1 variable
func (*VCS) Init ¶
Instantiate a new vector commitment instance Space for UPK and PRK will be created when keys are created and saved. This reduces the memory footprint.
func (*VCS) KeyGenFake ¶
Generate the trapdoors Generate the keys for aggregation PRK and UPK is generated only during runtime using GenUpkFake
func (*VCS) KeyGenLoad ¶
Defacto entry to VCS. Use this to load the files always
func (*VCS) KeyGenLoadFake ¶
func (*VCS) LoadAggGipa ¶
func (self *VCS) LoadAggGipa()
func (*VCS) LoadTrapdoor ¶
func (*VCS) MallocUpk ¶
func (vcs *VCS) MallocUpk()
Allocate space for UPK. This is not done with Init, as UPK and PRK may not fit in memory together.
func (*VCS) PrkGenDriver ¶
func (vcs *VCS) PrkGenDriver()
func (*VCS) PrkLoadDriver ¶
func (vcs *VCS) PrkLoadDriver()
func (*VCS) PrkUpkLoad ¶
func (vcs *VCS) PrkUpkLoad()
func (*VCS) ResizeAgg ¶
This resets the variable MN and txnLimit. Be sure to load the data from disk
func (*VCS) SaveTrapdoor ¶
func (vcs *VCS) SaveTrapdoor()
func (*VCS) SelectPRK ¶
Use selector function to compute the powers of g. 101 => (s_3 * s_1) It is a worker to compute g, g^{s_1}, g^{s_2}, g^{s_1 s_2}, g^{s_3}, , g^{s_3 s_1} ...
func (*VCS) SelectUPK ¶
Compute the UPK located in a specific coordinate of the tree Say 3, 3 => g^{}
func (*VCS) TrapdoorsGen ¶
func (vcs *VCS) TrapdoorsGen()
Generate trapdoors for the VCS. Be sure to run this after ```Init```.
func (*VCS) UpdateComVec ¶
func (*VCS) UpdateComVecDB ¶
func (*VCS) UpdateProof ¶
func (*VCS) UpdateProofTree ¶
func (*VCS) UpdateProofTreeBulk ¶
func (*VCS) UpdateProofTreeBulkDB ¶
func (vcs *VCS) UpdateProofTreeBulkDB(proofTree []map[uint64]mcl.G1, upk_db map[uint64][]mcl.G1, updateindexVec []uint64, deltaVec []mcl.Fr) ([]map[uint64]mcl.G1, int)
This is analogous to the UpdateProofTree. UpdateProofTree uses the struct variable ProofTree to import all updates. Where as this code updates a pruned Proof tree. For ell = 30, it is not possible to store the entire proof tree in memory. Thus a pruned proof tree is only stored in-memory.
func (*VCS) UpkGenDriver ¶
func (vcs *VCS) UpkGenDriver()
func (*VCS) UpkLoadDriver ¶
func (vcs *VCS) UpkLoadDriver()