mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-16 02:31:03 +00:00
Add PVM heap-size and stack-size configuration for resolc
This commit is contained in:
@@ -42,6 +42,10 @@ struct ResolcInner {
|
|||||||
solc: Solc,
|
solc: Solc,
|
||||||
/// Path to the `resolc` executable
|
/// Path to the `resolc` executable
|
||||||
resolc_path: PathBuf,
|
resolc_path: PathBuf,
|
||||||
|
/// The PVM heap size in bytes.
|
||||||
|
pvm_heap_size: u32,
|
||||||
|
/// The PVM stack size in bytes.
|
||||||
|
pvm_stack_size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Resolc {
|
impl Resolc {
|
||||||
@@ -68,26 +72,32 @@ impl Resolc {
|
|||||||
Self(Arc::new(ResolcInner {
|
Self(Arc::new(ResolcInner {
|
||||||
solc,
|
solc,
|
||||||
resolc_path: resolc_configuration.path.clone(),
|
resolc_path: resolc_configuration.path.clone(),
|
||||||
|
pvm_heap_size: resolc_configuration
|
||||||
|
.heap_size
|
||||||
|
.unwrap_or(PolkaVMDefaultHeapMemorySize),
|
||||||
|
pvm_stack_size: resolc_configuration
|
||||||
|
.stack_size
|
||||||
|
.unwrap_or(PolkaVMDefaultStackMemorySize),
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
.clone())
|
.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn polkavm_settings() -> SolcStandardJsonInputSettingsPolkaVM {
|
fn polkavm_settings(&self) -> SolcStandardJsonInputSettingsPolkaVM {
|
||||||
SolcStandardJsonInputSettingsPolkaVM::new(
|
SolcStandardJsonInputSettingsPolkaVM::new(
|
||||||
Some(SolcStandardJsonInputSettingsPolkaVMMemory::new(
|
Some(SolcStandardJsonInputSettingsPolkaVMMemory::new(
|
||||||
Some(PolkaVMDefaultHeapMemorySize),
|
Some(self.0.pvm_heap_size),
|
||||||
Some(PolkaVMDefaultStackMemorySize),
|
Some(self.0.pvm_stack_size),
|
||||||
)),
|
)),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inject_polkavm_settings(input: &SolcStandardJsonInput) -> Result<serde_json::Value> {
|
fn inject_polkavm_settings(&self, input: &SolcStandardJsonInput) -> Result<serde_json::Value> {
|
||||||
let mut input_value = serde_json::to_value(&input)
|
let mut input_value = serde_json::to_value(input)
|
||||||
.context("Failed to serialize Standard JSON input for resolc")?;
|
.context("Failed to serialize Standard JSON input for resolc")?;
|
||||||
if let Some(settings) = input_value.get_mut("settings") {
|
if let Some(settings) = input_value.get_mut("settings") {
|
||||||
settings["polkavm"] = serde_json::to_value(&Self::polkavm_settings()).unwrap();
|
settings["polkavm"] = serde_json::to_value(self.polkavm_settings()).unwrap();
|
||||||
}
|
}
|
||||||
Ok(input_value)
|
Ok(input_value)
|
||||||
}
|
}
|
||||||
@@ -171,13 +181,13 @@ impl SolidityCompiler for Resolc {
|
|||||||
Optimizer::default_mode(),
|
Optimizer::default_mode(),
|
||||||
Details::disabled(&Version::new(0, 0, 0)),
|
Details::disabled(&Version::new(0, 0, 0)),
|
||||||
),
|
),
|
||||||
polkavm: Self::polkavm_settings(),
|
polkavm: self.polkavm_settings(),
|
||||||
metadata: SolcStandardJsonInputSettingsMetadata::default(),
|
metadata: SolcStandardJsonInputSettingsMetadata::default(),
|
||||||
detect_missing_libraries: false,
|
detect_missing_libraries: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// Manually inject polkavm settings since it's marked skip_serializing in the upstream crate
|
// Manually inject polkavm settings since it's marked skip_serializing in the upstream crate
|
||||||
let std_input_json = Self::inject_polkavm_settings(&input)?;
|
let std_input_json = self.inject_polkavm_settings(&input)?;
|
||||||
|
|
||||||
Span::current().record(
|
Span::current().record(
|
||||||
"json_in",
|
"json_in",
|
||||||
|
|||||||
@@ -800,6 +800,17 @@ pub struct ResolcConfiguration {
|
|||||||
/// provided in the user's $PATH.
|
/// provided in the user's $PATH.
|
||||||
#[clap(id = "resolc.path", long = "resolc.path", default_value = "resolc")]
|
#[clap(id = "resolc.path", long = "resolc.path", default_value = "resolc")]
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
|
|
||||||
|
/// Specifies the PVM heap size in bytes.
|
||||||
|
///
|
||||||
|
/// If unspecified, the revive compiler default is used
|
||||||
|
#[clap(id = "resolc.heap-size", long = "resolc.heap-size")]
|
||||||
|
pub heap_size: Option<u32>,
|
||||||
|
/// Specifies the PVM stack size in bytes.
|
||||||
|
///
|
||||||
|
/// If unspecified, the revive compiler default is used
|
||||||
|
#[clap(id = "resolc.stack-size", long = "resolc.stack-size")]
|
||||||
|
pub stack_size: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A set of configuration parameters for Polkadot Parachain.
|
/// A set of configuration parameters for Polkadot Parachain.
|
||||||
|
|||||||
Reference in New Issue
Block a user