expose custom PVM settings in the standard json interface (#318)

Exposes the following PolkaVM specific options via the standard json
interface:
- Heap size
- Stack size
- Whether to emit source level debug information

Additionally it is now forbidden to specify those as CLI option in
standard JSON mode. They are bytecode altering options and having
multiple ways to specify them creates unnecessary room for confusion:
The standard JSON input description should be sufficient and succint for
reproducible builds.

Closes #290

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
This commit is contained in:
xermicus
2025-05-13 15:19:00 +02:00
committed by GitHub
parent 1b8fcc4649
commit bb2f829361
16 changed files with 102 additions and 29 deletions
@@ -3,6 +3,7 @@
pub mod metadata;
pub mod metadata_hash;
pub mod optimizer;
pub mod polkavm;
pub mod selection;
use std::collections::BTreeMap;
@@ -13,6 +14,7 @@ use serde::Serialize;
use self::metadata::Metadata;
use self::optimizer::Optimizer;
use self::polkavm::PolkaVM;
use self::selection::Selection;
/// The `solc --standard-json` input settings.
@@ -43,6 +45,9 @@ pub struct Settings {
/// The metadata settings.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
/// The resolc custom PolkaVM settings.
#[serde(skip_serializing)]
pub polkavm: Option<PolkaVM>,
}
impl Settings {
@@ -54,6 +59,7 @@ impl Settings {
output_selection: Selection,
optimizer: Optimizer,
metadata: Option<Metadata>,
polkavm: Option<PolkaVM>,
) -> Self {
Self {
evm_version,
@@ -63,6 +69,7 @@ impl Settings {
optimizer,
metadata,
via_ir: Some(true),
polkavm,
}
}