@@ -564,13 +564,16 @@ impl<F: Field> ModExpGasCost<F> {
564
564
fn construct (
565
565
cb : & mut EVMConstraintBuilder < F > ,
566
566
b_size : & SizeRepresent < F > ,
567
- exp : & [ Cell < F > ; N_BYTES_WORD ] ,
567
+ exp : & [ Cell < F > ; MODEXP_SIZE_LIMIT ] ,
568
568
m_size : & SizeRepresent < F > ,
569
569
) -> Self {
570
570
let max_length = MinMaxGadget :: construct ( cb, b_size. value ( ) , m_size. value ( ) ) ;
571
571
let words = ConstantDivisionGadget :: construct ( cb, max_length. max ( ) + 7 . expr ( ) , 8 ) ;
572
572
let multiplication_complexity = words. quotient ( ) * words. quotient ( ) ;
573
- let exp_is_zero = IsZeroGadget :: construct ( cb, expr_from_bytes ( exp) ) ;
573
+ let exp_is_zero = IsZeroGadget :: construct (
574
+ cb,
575
+ rlc:: expr ( & exp. clone ( ) . map ( |c| c. expr ( ) ) , cb. challenges ( ) . evm_word ( ) ) ,
576
+ ) ;
574
577
575
578
let ( exp_byte_size, exp_msb, exp_msb_bit_length) =
576
579
cb. condition ( not:: expr ( exp_is_zero. expr ( ) ) , |cb| {
@@ -645,12 +648,13 @@ impl<F: Field> ModExpGasCost<F> {
645
648
self . words
646
649
. assign ( region, offset, b_size. max ( m_size) . as_u128 ( ) + 7u128 ) ?;
647
650
let exp_word = U256 :: from_big_endian ( exponent) ;
648
- self . exp_is_zero . assign (
651
+ self . exp_is_zero . assign_value (
649
652
region,
650
653
offset,
651
- exp_word
652
- . to_scalar ( )
653
- . expect ( "exponent is within scalar field" ) ,
654
+ region
655
+ . challenges ( )
656
+ . evm_word ( )
657
+ . map ( |r| rlc:: value ( exponent, r) ) ,
654
658
) ?;
655
659
self . exp_byte_size
656
660
. assign ( region, offset, ByteOrWord :: Word ( exp_word) ) ?;
0 commit comments