mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-02-23 15:23:09 +00:00
Fix Wcopy when size=0 (#944)
This commit is contained in:
parent
9f1a5f975c
commit
a0d04ca3d8
@ -122,7 +122,12 @@ sys_calldataload_after_mload_packing:
|
||||
// Macro for {CALLDATA,CODE,RETURNDATA}COPY (W_copy in Yellow Paper).
|
||||
%macro wcopy(segment)
|
||||
// stack: kexit_info, dest_offset, offset, size
|
||||
DUP4 %num_bytes_to_num_words %mul_const(@GAS_COPY) %add_const(@GAS_VERYLOW) %charge_gas
|
||||
PUSH @GAS_VERYLOW
|
||||
DUP5
|
||||
// stack: size, Gverylow, kexit_info, dest_offset, offset, size
|
||||
ISZERO %jumpi(%%wcopy_empty)
|
||||
// stack: Gverylow, kexit_info, dest_offset, offset, size
|
||||
DUP5 %num_bytes_to_num_words %mul_const(@GAS_COPY) ADD %charge_gas
|
||||
|
||||
%stack (kexit_info, dest_offset, offset, size) -> (dest_offset, size, kexit_info, dest_offset, offset, size)
|
||||
ADD // TODO: check for overflow, see discussion here https://github.com/mir-protocol/plonky2/pull/930/files/a4ea0965d79561c345e2f77836c07949c7e0bc69#r1143630253
|
||||
@ -137,6 +142,11 @@ sys_calldataload_after_mload_packing:
|
||||
%%after:
|
||||
// stack: kexit_info
|
||||
EXIT_KERNEL
|
||||
%%wcopy_empty:
|
||||
// stack: Gverylow, kexit_info, dest_offset, offset, size
|
||||
%charge_gas
|
||||
%stack (kexit_info, dest_offset, offset, size) -> (kexit_info)
|
||||
EXIT_KERNEL
|
||||
%endmacro
|
||||
|
||||
global sys_calldatacopy:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user