gnark icon indicating copy to clipboard operation
gnark copied to clipboard

Multidimensional arrays support problem

Open SherLzp opened this issue 3 years ago • 5 comments

Are multidimensional arrays not supported? I remember it was supported in older versions.

come up with this error for Merkle Proofs:

when parsing variable MerkleProofsAccountBefore_0_0: can't set fr.Element from type []frontend.Variable

MerkleProofsAccountBefore is this:

MerkleProofsAccountBefore [NbAccountsPerTx][AccountMerkleLevels]Variable

@gbotrel

SherLzp avatar Jan 16 '22 14:01 SherLzp

Hi -- which version are you using ? Can you describe the issue with a reproductible code snippet?

On v0.6.0 seems to work fine, on develop too. Some commits in between may not be stable on that front.

gbotrel avatar Jan 17 '22 02:01 gbotrel

@SherLzp can I close this issue ?

gbotrel avatar Jan 19 '22 15:01 gbotrel

Hi, I find the problem but I'm not sure if it is a problem.

The problem comes from here:

type Proof struct {
....
MerkleProofs [FixedCount][FixedCount]Variable
}

// when we have a function to get something like []Variable
func ConstructFixedProof() [FixedCount]Variable {.....}

// then if we set it into the merkle proofs, for example
Proof.MerkleProofs[index] =  ConstructFixedProof()

// then it will occur errors we mentioned

@gbotrel

SherLzp avatar Jan 21 '22 09:01 SherLzp

@SherLzp when do this happens:

// then if we set it into the merkle proofs, for example
Proof.MerkleProofs[index] =  ConstructFixedProof()

Inside the Define() ? Witness creation? Please submit enough code to reproduce the issue 👍

What gnark version do you use?

gbotrel avatar Jan 25 '22 16:01 gbotrel

@gbotrel gnark version is 0.6.0

The function ConstructFixedProof() is out of Define(), just used for set witness.

SherLzp avatar Jan 29 '22 07:01 SherLzp