diff --git a/src/transformers/visitors/checks/unsupportedVisitor.ts b/src/transformers/visitors/checks/unsupportedVisitor.ts index 4385335da..d91131121 100644 --- a/src/transformers/visitors/checks/unsupportedVisitor.ts +++ b/src/transformers/visitors/checks/unsupportedVisitor.ts @@ -107,6 +107,12 @@ export default { `Zokrates does not support variables that begin with an underscore such as as _value.`, node ); + if (node.name === 'key'){ + throw new ZKPError( + `Zokrates does not support variables with the name key, please choose a different name.`, + node + ); + } }, }, }; diff --git a/test/contracts/increments.zol b/test/contracts/increments.zol index 58550fed5..752f9fe89 100644 --- a/test/contracts/increments.zol +++ b/test/contracts/increments.zol @@ -7,17 +7,17 @@ contract MyContract { secret uint256 private a; secret mapping(uint256 => uint256) private b; - function assign(secret uint256 param1, uint256 key, secret uint256 c) public { + function assign(secret uint256 param1, uint256 ky, secret uint256 c) public { unknown a += param1; - unknown b[key] += c; + unknown b[ky] += c; } function decra(secret uint256 param2) public { a -= param2; } - function decrb(secret uint256 param2, uint256 key) public { - b[key] -= param2; + function decrb(secret uint256 param2, uint256 ky) public { + b[ky] -= param2; } function incra(secret uint256 param3) public {