Skip to content

Commit

Permalink
Merge branch 'master' into 557-fixecdata-call-calltoc1membershipwcp
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzogentile404 committed Jan 14, 2025
2 parents a66570e + 2a343fa commit 763a0e9
Show file tree
Hide file tree
Showing 27 changed files with 485 additions and 315 deletions.
23 changes: 16 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CORSET ?= corset
GO_CORSET ?= go-corset

HUB_COLUMNS := $(wildcard hub/columns/*lisp)

Expand Down Expand Up @@ -61,13 +62,15 @@ BLOCKDATA_FOR_REFERENCE_TESTS := $(wildcard blockdata/*.lisp) \
$(wildcard blockdata/lookups/*.lisp)

# with gaslimit for linea file
BLOCKDATA := $(wildcard blockdata/*.lisp) \
$(wildcard blockdata/processing/*.lisp) \
$(wildcard blockdata/processing/gaslimit/common.lisp) \
$(wildcard blockdata/processing/gaslimit/linea.lisp) \
$(wildcard blockdata/lookups/*.lisp)
BLOCKDATA_FOR_LINEA := $(wildcard blockdata/*.lisp) \
$(wildcard blockdata/processing/*.lisp) \
$(wildcard blockdata/processing/gaslimit/common.lisp) \
$(wildcard blockdata/processing/gaslimit/linea.lisp) \
$(wildcard blockdata/lookups/*.lisp)

BLOCKHASH := blockhash
BLOCKHASH := $(wildcard blockhash/columns/*.lisp) \
$(wildcard blockhash/lookups/*.lisp) \
$(wildcard blockhash/*.lisp)

CONSTANTS := constants/constants.lisp

Expand Down Expand Up @@ -137,7 +140,7 @@ WCP := wcp
ZKEVM_MODULES := ${ALU} \
${BIN} \
${BLAKE2f_MODEXP_DATA} \
${BLOCKDATA} \
${BLOCKDATA_FOR_LINEA} \
${BLOCKHASH} \
${CONSTANTS} \
${EC_DATA} \
Expand Down Expand Up @@ -173,6 +176,9 @@ define.go: ${ZKEVM_MODULES}
zkevm.bin: ${ZKEVM_MODULES}
${CORSET} compile -vv -o $@ ${ZKEVM_MODULES}

zkevm.go.bin: ${ZKEVM_MODULES}
${GO_CORSET} compile -o $@ ${ZKEVM_MODULES}


ZKEVM_MODULES_FOR_REFERENCE_TESTS := ${ALU} \
${BIN} \
Expand Down Expand Up @@ -211,5 +217,8 @@ ZKEVM_MODULES_FOR_REFERENCE_TESTS := ${ALU} \
zkevm_for_reference_tests.bin: ${ZKEVM_MODULES_FOR_REFERENCE_TESTS}
${CORSET} compile -vv -o $@ ${ZKEVM_MODULES_FOR_REFERENCE_TESTS}

zkevm_for_reference_tests.go.bin: ${ZKEVM_MODULES_FOR_REFERENCE_TESTS}
${GO_CORSET} compile -o $@ ${ZKEVM_MODULES_FOR_REFERENCE_TESTS}



2 changes: 1 addition & 1 deletion bin/lookups/bin_into_binreftable.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defpurefun (selector-bin-to-binreftable)
(defun (selector-bin-to-binreftable)
(+ bin.IS_AND bin.IS_OR bin.IS_XOR bin.IS_NOT))

(deflookup
Expand Down
2 changes: 1 addition & 1 deletion blockdata/processing/gaslimit/common.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun (gaslimit-precondition) (* (- 1 (prev IS_GL)) IS_GL))
(defun (prev-gas-limit) (shift BLOCK_GAS_LIMIT (* nROWS_DEPTH -1)))
(defun (prev-gas-limit) (shift BLOCK_GAS_LIMIT (- 0 nROWS_DEPTH)))
(defun (curr-GASLIMIT-hi) (curr-data-hi))
(defun (curr-GASLIMIT-lo) (curr-data-lo))
(defun (prev-GASLIMIT-hi) (prev-data-hi))
Expand Down
8 changes: 6 additions & 2 deletions blockdata/processing/gaslimit/ethereum.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
(module blockdata)

;; TODO add reference to global constants
(defconst GAS_LIMIT_MINIMUM 5000)
(defconst GAS_LIMIT_MAXIMUM 0xffffffffffffffff)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 3 Computations and checks ;;
Expand All @@ -14,7 +18,7 @@
(curr-GASLIMIT-hi)
(curr-GASLIMIT-lo)
0
ETHEREUM_GAS_LIMIT_MINIMUM))
GAS_LIMIT_MINIMUM))

(defconstraint gaslimit---upper-bound---ETHEREUM
(:guard (gaslimit-precondition))
Expand All @@ -23,4 +27,4 @@
(curr-GASLIMIT-hi)
(curr-GASLIMIT-lo)
0
ETHEREUM_GAS_LIMIT_MAXIMUM))
GAS_LIMIT_MAXIMUM))
8 changes: 6 additions & 2 deletions blockdata/processing/gaslimit/linea.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
(module blockdata)

;; TODO add reference to global constants
(defconst GAS_LIMIT_MINIMUM 61000000)
(defconst GAS_LIMIT_MAXIMUM 2000000000)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 3 Computations and checks ;;
Expand All @@ -14,7 +18,7 @@
(curr-GASLIMIT-hi)
(curr-GASLIMIT-lo)
0
LINEA_GAS_LIMIT_MINIMUM))
GAS_LIMIT_MINIMUM))

(defconstraint gaslimit---upper-bound---LINEA
(:guard (gaslimit-precondition))
Expand All @@ -23,4 +27,4 @@
(curr-GASLIMIT-hi)
(curr-GASLIMIT-lo)
0
LINEA_GAS_LIMIT_MAXIMUM))
GAS_LIMIT_MAXIMUM))
50 changes: 36 additions & 14 deletions blockhash/columns.lisp
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
(module blockhash)

(defcolumns
(IOMF :binary)
(BLOCK_NUMBER_HI :i128)
(BLOCK_NUMBER_LO :i128)
(RES_HI :i128)
(RES_LO :i128)
(REL_BLOCK :i8)
(ABS_BLOCK :i48)
(LOWER_BOUND_CHECK :binary)
(UPPER_BOUND_CHECK :binary)
(IN_RANGE :binary)
(BLOCK_HASH_HI :i128)
(BLOCK_HASH_LO :i128)
(BYTE_HI :array [0:15] :byte@prove)
(BYTE_LO :array [0:15] :byte@prove))
(IOMF :binary@prove)
(MACRO :binary@prove)
(PRPRC :binary@prove)
(CT :i8)
(CT_MAX :i8))

(defperspective macro
;; selector
MACRO
;; macro-instruction fields
(
(REL_BLOCK :i16)
(ABS_BLOCK :i48)
(BLOCKHASH_VAL_HI :i128)
(BLOCKHASH_VAL_LO :i128)
(BLOCKHASH_ARG_HI :i128)
(BLOCKHASH_ARG_LO :i128)
(BLOCKHASH_RES_HI :i128)
(BLOCKHASH_RES_LO :i128)
)
)

(defperspective preprocessing
;; selector
PRPRC
;; instruction pre-processing fields
(
(EXO_ARG_1_HI :i128)
(EXO_ARG_1_LO :i128)
(EXO_ARG_2_HI :i128)
(EXO_ARG_2_LO :i128)
(EXO_INST :i8)
(EXO_RES :binary@prove)
)
)

13 changes: 13 additions & 0 deletions blockhash/constants.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(module blockhash)

(defconst
nROWS_MACRO 1
nROWS_PRPRC 5
BLOCKHASH_DEPTH (+ nROWS_MACRO nROWS_PRPRC)
NEGATIVE_OF_BLOCKHASH_DEPTH (- 0 BLOCKHASH_DEPTH)
ROFF___BLOCKHASH_arguments___monotony 1
ROFF___BLOCKHASH_arguments___equality_test 2
ROFF___ABS___comparison_to_256 3
ROFF___curr_BLOCKHASH_argument___comparison_to_max 4
ROFF___curr_BLOCKHASH_argument___comparison_to_min 5
)
Loading

0 comments on commit 763a0e9

Please sign in to comment.