@@ -28,7 +28,12 @@ use starknet_api::transaction::{L2ToL1Payload, MessageToL1};
2828use starknet_api:: versioned_constants_logic:: VersionedConstantsTrait ;
2929use starknet_api:: { calldata, declare_tx_args, invoke_tx_args} ;
3030use starknet_os:: hint_processor:: os_logger:: ResourceFinalizer ;
31- use starknet_os:: test_utils:: { SHA256_BATCH_RESOURCES_LINEAR_UNSCALED , SHA256_BATCH_SIZE } ;
31+ use starknet_os:: test_utils:: {
32+ SHA256_BATCH_RESOURCES_LINEAR_UNSCALED ,
33+ SHA256_BATCH_SIZE ,
34+ SHA512_BATCH_RESOURCES_LINEAR_UNSCALED ,
35+ SHA512_BATCH_SIZE ,
36+ } ;
3237use starknet_types_core:: felt:: Felt ;
3338use strum:: IntoEnumIterator ;
3439
@@ -49,7 +54,7 @@ use crate::test_manager::{
4954use crate :: tests:: NON_TRIVIAL_RESOURCE_BOUNDS ;
5055
5156// TODO(Dori): Delete this, or at least reduce it to a minimal set of unmeasurable syscalls.
52- const UNMEASURABLE_SYSCALLS : [ Selector ; 13 ] = [
57+ const UNMEASURABLE_SYSCALLS : [ Selector ; 12 ] = [
5358 Selector :: DelegateCall ,
5459 Selector :: DelegateL1Handler ,
5560 Selector :: GetBlockNumber ,
@@ -59,7 +64,6 @@ const UNMEASURABLE_SYSCALLS: [Selector; 13] = [
5964 Selector :: GetSequencerAddress ,
6065 Selector :: GetTxInfo ,
6166 Selector :: GetTxSignature ,
62- Selector :: Sha512ProcessBlock ,
6367 Selector :: LibraryCallL1Handler ,
6468 Selector :: StorageRead ,
6569 Selector :: StorageWrite ,
@@ -87,7 +91,8 @@ static SYSCALLS_WITH_LINEAR_FACTOR: LazyLock<HashMap<Selector, usize>> = LazyLoc
8791/// Syscalls that are implemented using virtual builtins. Such syscalls have their "heavy lifting"
8892/// executed after the execute_syscalls part of the OS, so the consumed resources are not captured
8993/// by the OsLogger.
90- const SYSCALLS_WITH_VIRTUAL_BUILTINS : [ Selector ; 1 ] = [ Selector :: Sha256ProcessBlock ] ;
94+ const SYSCALLS_WITH_VIRTUAL_BUILTINS : [ Selector ; 2 ] =
95+ [ Selector :: Sha256ProcessBlock , Selector :: Sha512ProcessBlock ] ;
9196
9297/// Expected syscalls in the fee transfer call. Should be removed from the list of syscalls during
9398/// measurement iteration - only the syscalls called during __execute__ should be measured.
@@ -117,6 +122,9 @@ fn update_resources_for_virtual_builtin_syscall(
117122 Selector :: Sha256ProcessBlock => ( & measured_base
118123 + & SHA256_BATCH_RESOURCES_LINEAR_UNSCALED . div_ceil ( SHA256_BATCH_SIZE ) )
119124 . filter_unused_builtins ( ) ,
125+ Selector :: Sha512ProcessBlock => ( & measured_base
126+ + & SHA512_BATCH_RESOURCES_LINEAR_UNSCALED . div_ceil ( SHA512_BATCH_SIZE ) )
127+ . filter_unused_builtins ( ) ,
120128 _ => panic ! ( "Resource update not implemented for virtual builtin syscall: {selector:?}." ) ,
121129 }
122130}
0 commit comments