@@ -42,6 +42,10 @@ struct ResolcInner {
4242 solc : Solc ,
4343 /// Path to the `resolc` executable
4444 resolc_path : PathBuf ,
45+ /// The PVM heap size in bytes.
46+ pvm_heap_size : u32 ,
47+ /// The PVM stack size in bytes.
48+ pvm_stack_size : u32 ,
4549}
4650
4751impl Resolc {
@@ -68,26 +72,32 @@ impl Resolc {
6872 Self ( Arc :: new ( ResolcInner {
6973 solc,
7074 resolc_path : resolc_configuration. path . clone ( ) ,
75+ pvm_heap_size : resolc_configuration
76+ . heap_size
77+ . unwrap_or ( PolkaVMDefaultHeapMemorySize ) ,
78+ pvm_stack_size : resolc_configuration
79+ . stack_size
80+ . unwrap_or ( PolkaVMDefaultStackMemorySize ) ,
7181 } ) )
7282 } )
7383 . clone ( ) )
7484 }
7585
76- fn polkavm_settings ( ) -> SolcStandardJsonInputSettingsPolkaVM {
86+ fn polkavm_settings ( & self ) -> SolcStandardJsonInputSettingsPolkaVM {
7787 SolcStandardJsonInputSettingsPolkaVM :: new (
7888 Some ( SolcStandardJsonInputSettingsPolkaVMMemory :: new (
79- Some ( PolkaVMDefaultHeapMemorySize ) ,
80- Some ( PolkaVMDefaultStackMemorySize ) ,
89+ Some ( self . 0 . pvm_heap_size ) ,
90+ Some ( self . 0 . pvm_stack_size ) ,
8191 ) ) ,
8292 false ,
8393 )
8494 }
8595
86- fn inject_polkavm_settings ( input : & SolcStandardJsonInput ) -> Result < serde_json:: Value > {
87- let mut input_value = serde_json:: to_value ( & input)
96+ fn inject_polkavm_settings ( & self , input : & SolcStandardJsonInput ) -> Result < serde_json:: Value > {
97+ let mut input_value = serde_json:: to_value ( input)
8898 . context ( "Failed to serialize Standard JSON input for resolc" ) ?;
8999 if let Some ( settings) = input_value. get_mut ( "settings" ) {
90- settings[ "polkavm" ] = serde_json:: to_value ( & Self :: polkavm_settings ( ) ) . unwrap ( ) ;
100+ settings[ "polkavm" ] = serde_json:: to_value ( self . polkavm_settings ( ) ) . unwrap ( ) ;
91101 }
92102 Ok ( input_value)
93103 }
@@ -171,13 +181,13 @@ impl SolidityCompiler for Resolc {
171181 Optimizer :: default_mode ( ) ,
172182 Details :: disabled ( & Version :: new ( 0 , 0 , 0 ) ) ,
173183 ) ,
174- polkavm : Self :: polkavm_settings ( ) ,
184+ polkavm : self . polkavm_settings ( ) ,
175185 metadata : SolcStandardJsonInputSettingsMetadata :: default ( ) ,
176186 detect_missing_libraries : false ,
177187 } ,
178188 } ;
179189 // Manually inject polkavm settings since it's marked skip_serializing in the upstream crate
180- let std_input_json = Self :: inject_polkavm_settings ( & input) ?;
190+ let std_input_json = self . inject_polkavm_settings ( & input) ?;
181191
182192 Span :: current ( ) . record (
183193 "json_in" ,
0 commit comments