Skip to content

Commit

Permalink
Merge pull request #177 from EYBlockchain/miranda/join-fix
Browse files Browse the repository at this point in the history
Quick commitment storage fix for joined commitments
  • Loading branch information
MirandaWood authored Feb 20, 2023
2 parents 726426f + c22d015 commit b1c54cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/boilerplate/common/commitment-storage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,16 @@ export async function joinCommitments(

let tx = await instance.getPastEvents("allEvents");

tx = tx[0];
tx = tx[0];

await markNullified(generalise(commitments[0]._id), secretKey.hex(32));
await markNullified(generalise(commitments[1]._id), secretKey.hex(32));
await storeCommitment({
hash: newCommitment,
name: statename,
mappingKey: fromID,
preimage: {
stateVarId: generalise(stateVarID),
stateVarId: generalise(oldCommitment_stateVarId),
value: newCommitment_value,
salt: newCommitment_newSalt,
publicKey: publicKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class BoilerplateGenerator {
\n${stateName}_witness_0 = await getMembershipWitness('${contractName}', generalise(${stateName}_0_oldCommitment._id).integer);
\n${stateName}_witness_1 = await getMembershipWitness('${contractName}', generalise(${stateName}_1_oldCommitment._id).integer);
\n const tx = await joinCommitments('${contractName}', '${mappingName}${mappingKey}', secretKey, publicKey, [${stateVarId.join(' , ')}], [${stateName}_0_oldCommitment, ${stateName}_1_oldCommitment], [${stateName}_witness_0, ${stateName}_witness_1], instance, contractAddr, web3);
\n const tx = await joinCommitments('${contractName}', '${mappingName}', secretKey, publicKey, [${stateVarId.join(' , ')}], [${stateName}_0_oldCommitment, ${stateName}_1_oldCommitment], [${stateName}_witness_0, ${stateName}_witness_1], instance, contractAddr, web3);
${stateName}_preimage = await getCommitmentsById(${stateName}_stateVarId);
Expand Down

0 comments on commit b1c54cc

Please sign in to comment.