diff --git a/src/boilerplate/common/commitment-storage.mjs b/src/boilerplate/common/commitment-storage.mjs index 955f77b47..6b7d6bcdb 100644 --- a/src/boilerplate/common/commitment-storage.mjs +++ b/src/boilerplate/common/commitment-storage.mjs @@ -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, diff --git a/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts b/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts index 9a44fe850..3c5b67098 100644 --- a/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts +++ b/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts @@ -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);