-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: post compilation size limit validation
- Loading branch information
1 parent
132a963
commit 91a59d3
Showing
8 changed files
with
179 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
use std::collections::BTreeMap; | ||
|
||
use papyrus_config::dumping::SerializeConfig; | ||
use papyrus_config::{ParamPath, SerializedParam}; | ||
use papyrus_config::dumping::{ser_param, SerializeConfig}; | ||
use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam}; | ||
use serde::{Deserialize, Serialize}; | ||
use validator::Validate; | ||
|
||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Validate, PartialEq)] | ||
pub struct GatewayCompilerConfig {} | ||
#[derive(Clone, Debug, Serialize, Deserialize, Validate, PartialEq)] | ||
pub struct GatewayCompilerConfig { | ||
pub max_bytecode_size: usize, | ||
pub max_raw_class_size: usize, | ||
} | ||
|
||
impl Default for GatewayCompilerConfig { | ||
fn default() -> Self { | ||
Self { max_bytecode_size: 81920, max_raw_class_size: 4089446 } | ||
} | ||
} | ||
|
||
impl SerializeConfig for GatewayCompilerConfig { | ||
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> { | ||
BTreeMap::new() | ||
BTreeMap::from_iter([ | ||
ser_param( | ||
"max_bytecode_size", | ||
&self.max_bytecode_size, | ||
"The maximum bytecode size allowed for a contract.", | ||
ParamPrivacyInput::Public, | ||
), | ||
ser_param( | ||
"max_raw_class_size", | ||
&self.max_raw_class_size, | ||
"The maximum raw class size allowed for a contract.", | ||
ParamPrivacyInput::Public, | ||
), | ||
]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters