-
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
9632a61
commit 47964cf
Showing
8 changed files
with
183 additions
and
16 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,31 @@ | ||
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 {} | ||
pub struct GatewayCompilerConfig { | ||
pub max_bytecode_size: usize, | ||
pub max_raw_class_size: usize, | ||
} | ||
|
||
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