Skip to content

Commit

Permalink
Remove test in PublicVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
kKahina committed Jul 12, 2024
1 parent 7724c84 commit 0291c98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
27 changes: 1 addition & 26 deletions src/transformers/visitors/toCircuitVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,7 @@ const publicVariables = (path: NodePath, state: any, IDnode: any) => {

// If there is a statment where a secret variable interacts with a public one, we need to adjust previous statements where the public variable was modified.

// New test starts from here

const interactsWithSecret = node.interactsWithSecret || node.baseExpression?.interactsWithSecret;
const interactsWithPublic = node.interactsWithPublic || node.baseExpression?.interactsWithPublic;

// Journalisation pour le débogage
console.log(`Node: ${node.name}, interactsWithSecret: ${interactsWithSecret}, interactsWithPublic: ${interactsWithPublic}`);

// Traiter seulement si la variable interagit avec les variables secrètes et publiques
// if (
// binding instanceof VariableBinding &&
// interactsWithSecret &&
// interactsWithPublic &&
// binding.stateVariable && !binding.isSecret
// )


if (
binding instanceof VariableBinding &&
(node.interactsWithSecret || node.baseExpression?.interactsWithSecret) &&
Expand Down Expand Up @@ -941,16 +926,6 @@ const visitor = {
if (!lhs) lhs = node.expression.subExpression;
const referencedIndicator = scope.getReferencedIndicator(lhs, true);

// if (expression.nodeType === 'UnaryOperation') {
// const { operator, subExpression } = expression;
// if ((operator === '++' || operator === '--') && subExpression.nodeType === 'Identifier') {
// const referencedIndicator = scope.getReferencedIndicator(subExpression);
// if (referencedIndicator?.interactsWithSecret) {
// state.thisState.interactsWithSecretInScope = true;
// }
// }
// }

const name = referencedIndicator?.isMapping
? referencedIndicator.name
.replace('[', '_')
Expand Down
1 change: 1 addition & 0 deletions test/contracts/c-circuit.zol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ uint256 public c;
function addB( uint256 value) public {
c += value;
known a += value;
c= c+1;
}

}

0 comments on commit 0291c98

Please sign in to comment.