Skip to content

Commit f169af4

Browse files
committed
fix(orchestration): ensure that for functions with shared secrets that also fix the owner via the require statement, the sharedPublicKey is used for new commitments
1 parent b8dafb8 commit f169af4

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/boilerplate/orchestration/javascript/raw/toOrchestration.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,14 @@ export const preimageBoilerPlate = (node: any) => {
371371
default:
372372
// TODO - this is the case where the owner is an admin (state var)
373373
// we have to let the user submit the key and check it in the contract
374-
if (!stateNode.ownerIsSecret && !stateNode.ownerIsParam) {
374+
if (stateNode.isSharedSecret) {
375+
newOwnerStatment = `_${privateStateName}_newOwnerPublicKey === 0 ? sharedPublicKey : ${privateStateName}_newOwnerPublicKey;`;
376+
} else if (!stateNode.ownerIsSecret && !stateNode.ownerIsParam) {
375377
newOwnerStatment = `_${privateStateName}_newOwnerPublicKey === 0 ? generalise(await instance.methods.zkpPublicKeys(await instance.methods.${newOwner}().call()).call()) : ${privateStateName}_newOwnerPublicKey;`;
376378
} else if (stateNode.ownerIsParam && newOwner) {
377379
newOwnerStatment = `_${privateStateName}_newOwnerPublicKey === 0 ? ${newOwner} : ${privateStateName}_newOwnerPublicKey;`;
378380
} else {
379381
// is secret - we just use the users to avoid revealing the secret owner
380-
if(stateNode.isSharedSecret)
381-
newOwnerStatment = `_${privateStateName}_newOwnerPublicKey === 0 ? sharedPublicKey : ${privateStateName}_newOwnerPublicKey;`;
382-
else
383382
newOwnerStatment = `_${privateStateName}_newOwnerPublicKey === 0 ? publicKey : ${privateStateName}_newOwnerPublicKey;`
384383

385384
// BELOW reveals the secret owner as we check the public key in the contract

0 commit comments

Comments
 (0)