Skip to content

Commit

Permalink
Merge pull request #52 from 0xPolygonHermez/fix/constraint-inccounter…
Browse files Browse the repository at this point in the history
…-zero

add constraint to force that incCounter is zero on first row
  • Loading branch information
krlosMata committed Dec 20, 2023
2 parents c461923 + 715cb46 commit 43c1633
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pil/padding_kk.pil
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ namespace PaddingKK(%N);
// if lastHash=0 && lastBLock=1 then incCounter'=incCounter+1
// if lastHash=1 && lastBlock=1 then incCounter'=1
incCounter' = incCounter*(1-lastBlock) + (incCounter +1)*(lastBlock-lastHash) + lastHash;
incCounter * Global.L1 = 0;


// chunkReader generator
Expand Down
1 change: 1 addition & 0 deletions pil/padding_pg.pil
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace PaddingPG(%N);
// if lastHash=0 && lastBLock=1 then incCounter'=incCounter+1
// if lastHash=1 && lastBlock=1 then incCounter'=1
incCounter' = incCounter*(1-lastBlock) + (incCounter +1)*(lastBlock-lastHash) + lastHash;
incCounter * Global.L1 = 0;



Expand Down
1 change: 1 addition & 0 deletions pil/padding_sha256.pil
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ namespace PaddingSha256(%N);
// if lastHash=0 && lastBLock=1 then incCounter'=incCounter+1
// if lastHash=1 && lastBlock=1 then incCounter'=1
incCounter' = incCounter*(1-lastBlock) + (incCounter +1)*(lastBlock-lastHash) + lastHash;
incCounter * Global.L1 = 0;


// chunkReader generator
Expand Down
1 change: 1 addition & 0 deletions pil/storage.pil
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ namespace Storage(%N);
pol doJump = jmp + jmpz * opIsZero + jmpnz * (1 - opIsZero);
pc' = doJump * (jmpAddress - pc - 1) + pc + 1;
pc * Global.L1 = 0;
incCounter * Global.L1 = 0;

// Last pc' must return to be pc=0 in order to close the program loop
// Once the work is done, the rest of instructions must be:
Expand Down

0 comments on commit 43c1633

Please sign in to comment.