From f26561cd08ca8d2af574ba9789a35c42193308af Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Fri, 28 Jun 2024 10:12:01 +0100 Subject: [PATCH] fix: error in Bucket of Balls --- .../javascript/raw/boilerplate-generator.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts b/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts index f4353d6cc..7b7cf8b8b 100644 --- a/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts +++ b/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts @@ -582,10 +582,17 @@ encryptBackupPreimage = { let plainText; let varName = mappingName ? mappingName : stateName; if (mappingKey){ - plainText = `[BigInt(${saltName}.hex(32)), BigInt(${mappingKey}.hex(32)), - BigInt(generalise(${stateName}_stateVarIdInit).hex(32)), - ${valueName}]`; - varName += ` a`; + if (mappingKey === 'msg'){ + plainText = `[BigInt(${saltName}.hex(32)), BigInt(${stateName}_stateVarId_key.hex(32)), + BigInt(generalise(${stateName}_stateVarIdInit).hex(32)), + ${valueName}]`; + varName += ` a`; + } else { + plainText = `[BigInt(${saltName}.hex(32)), BigInt(${mappingKey}.hex(32)), + BigInt(generalise(${stateName}_stateVarIdInit).hex(32)), + ${valueName}]`; + varName += ` a`; + } } else{ plainText = `[BigInt(${saltName}.hex(32)), BigInt(${stateName}_stateVarId), ${valueName}]`;