Skip to content

Commit 890493a

Browse files
committed
feat: appropriate guards on various defproperty's for common precompiles
1 parent 1dba760 commit 890493a

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

hub/osaka/constraints/instruction-handling/call/precompiles/common/generalities.lisp

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,14 @@
224224

225225
(defproperty precompile-processing---common---address-recovery-success-shorthands-sanity-checks
226226
(if-not-zero (precompile-processing---common---precondition)
227-
(begin
228-
(is-binary (precompile-processing---common---address-recovery-failure))
229-
(is-binary (precompile-processing---common---address-recovery-success))
230-
(eq! (precompile-processing---common---OOB-hub-success)
231-
(+ (precompile-processing---common---address-recovery-failure)
232-
(precompile-processing---common---address-recovery-success)
233-
)))))
227+
(if-not-zero scenario/PRC_ECRECOVER
228+
(begin
229+
(is-binary (precompile-processing---common---address-recovery-failure))
230+
(is-binary (precompile-processing---common---address-recovery-success))
231+
(eq! (precompile-processing---common---OOB-hub-success)
232+
(+ (precompile-processing---common---address-recovery-failure)
233+
(precompile-processing---common---address-recovery-success)
234+
))))))
234235

235236

236237
;;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;;
@@ -247,15 +248,23 @@
247248
;; ECADD, ECMUL, ECPAIRING and BLS related shorthands sanity checks ;;
248249
;;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;;
249250

251+
(defun (common-precompiles-where-wellformed-and-malformed-data-matters) (+ scenario/PRC_ECADD
252+
scenario/PRC_ECMUL
253+
scenario/PRC_ECPAIRING
254+
(scenario-shorthand---PRC---common-BLS-address-bit-sum)
255+
))
256+
257+
250258
(defproperty precompile-processing---common---well-and-mal-formed-data-shorthands-sanity-checks
251259
(if-not-zero (precompile-processing---common---precondition)
252-
(begin
253-
(is-binary (precompile-processing---common---malformed-data))
254-
(is-binary (precompile-processing---common---wellformed-data))
255-
(eq! (precompile-processing---common---OOB-hub-success)
256-
(+ (precompile-processing---common---malformed-data)
257-
(precompile-processing---common---wellformed-data)
258-
)))))
260+
(if-not-zero (common-precompiles-where-wellformed-and-malformed-data-matters)
261+
(begin
262+
(is-binary (precompile-processing---common---malformed-data))
263+
(is-binary (precompile-processing---common---wellformed-data))
264+
(eq! (precompile-processing---common---OOB-hub-success)
265+
(+ (precompile-processing---common---malformed-data)
266+
(precompile-processing---common---wellformed-data)
267+
))))))
259268

260269
;;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;;
261270
;; P256_VERIFY related shorthands ;;
@@ -277,15 +286,16 @@
277286

278287
(defproperty precompile-processing---common---signature-verification-success-shorthands-sanity-checks
279288
(if-not-zero (precompile-processing---common---precondition)
280-
(begin
281-
(is-binary (precompile-processing---common---p256-sufficient-gas-wrong-cds))
282-
(is-binary (precompile-processing---common---p256-sig-verification-failure))
283-
(is-binary (precompile-processing---common---p256-sig-verification-success))
284-
(eq! (precompile-processing---common---OOB-hub-success)
285-
(+ (precompile-processing---common---p256-sufficient-gas-wrong-cds)
286-
(precompile-processing---common---p256-sig-verification-failure)
287-
(precompile-processing---common---p256-sig-verification-success)
288-
)))))
289+
(if-not-zero scenario/PRC_P256_VERIFY
290+
(begin
291+
(is-binary (precompile-processing---common---p256-sufficient-gas-wrong-cds))
292+
(is-binary (precompile-processing---common---p256-sig-verification-failure))
293+
(is-binary (precompile-processing---common---p256-sig-verification-success))
294+
(eq! (precompile-processing---common---OOB-hub-success)
295+
(+ (precompile-processing---common---p256-sufficient-gas-wrong-cds)
296+
(precompile-processing---common---p256-sig-verification-failure)
297+
(precompile-processing---common---p256-sig-verification-success)
298+
))))))
289299

290300

291301

0 commit comments

Comments
 (0)