Skip to content

Commit

Permalink
Merge pull request #231 from 0xPolygonHermez/feature/reduce-max-steps
Browse files Browse the repository at this point in the history
reduce steps max limit
  • Loading branch information
krlosMata authored Jan 18, 2023
2 parents 5099172 + b18005b commit 0b2d675
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions main/constants.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,19 @@ CONST %SSTORE_CLEARS_SCHEDULE = 15000

; COUNTERS
CONST %MIN_STEPS_FINISH_BATCH = 200 ; min steps to finish tx
CONST %TOTAL_STEPS = 2**23
CONST %MAX_CNT_STEPS = %TOTAL_STEPS - %MIN_STEPS_FINISH_BATCH
CONST %TOTAL_STEPS_LIMIT = 2**23

CONST %MAX_CNT_ARITH_LIMIT = %TOTAL_STEPS / 32
CONST %MAX_CNT_BINARY_LIMIT = %TOTAL_STEPS / 16
CONST %MAX_CNT_MEM_ALIGN_LIMIT = %TOTAL_STEPS / 32
CONST %MAX_CNT_KECCAK_F_LIMIT = (%TOTAL_STEPS / 155286) * 44
CONST %MAX_CNT_PADDING_PG_LIMIT = (%TOTAL_STEPS / 56)
CONST %MAX_CNT_POSEIDON_G_LIMIT = (%TOTAL_STEPS / 30)
CONST %MAX_CNT_STEPS_LIMIT = %TOTAL_STEPS_LIMIT - %MIN_STEPS_FINISH_BATCH
CONST %MAX_CNT_ARITH_LIMIT = %TOTAL_STEPS_LIMIT / 32
CONST %MAX_CNT_BINARY_LIMIT = %TOTAL_STEPS_LIMIT / 16
CONST %MAX_CNT_MEM_ALIGN_LIMIT = %TOTAL_STEPS_LIMIT / 32
CONST %MAX_CNT_KECCAK_F_LIMIT = (%TOTAL_STEPS_LIMIT / 155286) * 44
CONST %MAX_CNT_PADDING_PG_LIMIT = (%TOTAL_STEPS_LIMIT / 56)
CONST %MAX_CNT_POSEIDON_G_LIMIT = (%TOTAL_STEPS_LIMIT / 30)

CONST %SAFE_RANGE = 20 ; safe guard counters to not take into account (%RANGE = 1 / SAFE_RANGE)

CONST %MAX_CNT_STEPS = %MAX_CNT_STEPS_LIMIT - (%MAX_CNT_STEPS_LIMIT / %SAFE_RANGE)
CONST %MAX_CNT_ARITH = %MAX_CNT_ARITH_LIMIT - (%MAX_CNT_ARITH_LIMIT / %SAFE_RANGE)
CONST %MAX_CNT_BINARY = %MAX_CNT_BINARY_LIMIT - (%MAX_CNT_BINARY_LIMIT / %SAFE_RANGE)
CONST %MAX_CNT_MEM_ALIGN = %MAX_CNT_MEM_ALIGN_LIMIT - (%MAX_CNT_MEM_ALIGN_LIMIT / %SAFE_RANGE)
Expand Down

0 comments on commit 0b2d675

Please sign in to comment.