diff --git a/crates/blockifier/resources/versioned_constants_0_13_0.json b/crates/blockifier/resources/versioned_constants_0_13_0.json index be639a429a..6f52d6cb43 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_0.json +++ b/crates/blockifier/resources/versioned_constants_0_13_0.json @@ -9,9 +9,16 @@ "disable_cairo0_redeclaration": false, "enable_stateful_compression": false, "allocation_cost": { - "l1_gas": 0, - "l1_data_gas": 0, - "l2_gas": 0 + "blob_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + }, + "gas_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + } }, "ignore_inner_event_resources": false, "enable_reverts": false, diff --git a/crates/blockifier/resources/versioned_constants_0_13_1.json b/crates/blockifier/resources/versioned_constants_0_13_1.json index 918492d0bb..1be6a8686f 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1.json @@ -42,9 +42,16 @@ "disable_cairo0_redeclaration": false, "enable_stateful_compression": false, "allocation_cost": { - "l1_gas": 0, - "l1_data_gas": 0, - "l2_gas": 0 + "blob_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + }, + "gas_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + } }, "ignore_inner_event_resources": true, "enable_reverts": false, diff --git a/crates/blockifier/resources/versioned_constants_0_13_1_1.json b/crates/blockifier/resources/versioned_constants_0_13_1_1.json index 884485717b..782d3ca130 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1_1.json @@ -42,9 +42,16 @@ "disable_cairo0_redeclaration": false, "enable_stateful_compression": false, "allocation_cost": { - "l1_gas": 0, - "l1_data_gas": 0, - "l2_gas": 0 + "blob_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + }, + "gas_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + } }, "ignore_inner_event_resources": false, "enable_reverts": false, diff --git a/crates/blockifier/resources/versioned_constants_0_13_2.json b/crates/blockifier/resources/versioned_constants_0_13_2.json index 091f563da4..86ab5aeb02 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2.json @@ -40,9 +40,16 @@ "disable_cairo0_redeclaration": true, "enable_stateful_compression": false, "allocation_cost": { - "l1_gas": 0, - "l1_data_gas": 0, - "l2_gas": 0 + "blob_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + }, + "gas_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + } }, "ignore_inner_event_resources": false, "enable_reverts": false, diff --git a/crates/blockifier/resources/versioned_constants_0_13_2_1.json b/crates/blockifier/resources/versioned_constants_0_13_2_1.json index e2f0e5011b..0b740a1205 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2_1.json @@ -40,9 +40,16 @@ "disable_cairo0_redeclaration": true, "enable_stateful_compression": false, "allocation_cost": { - "l1_gas": 0, - "l1_data_gas": 0, - "l2_gas": 0 + "blob_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + }, + "gas_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + } }, "ignore_inner_event_resources": false, "max_recursion_depth": 50, diff --git a/crates/blockifier/resources/versioned_constants_0_13_3.json b/crates/blockifier/resources/versioned_constants_0_13_3.json index e2f0e5011b..0b740a1205 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_3.json +++ b/crates/blockifier/resources/versioned_constants_0_13_3.json @@ -40,9 +40,16 @@ "disable_cairo0_redeclaration": true, "enable_stateful_compression": false, "allocation_cost": { - "l1_gas": 0, - "l1_data_gas": 0, - "l2_gas": 0 + "blob_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + }, + "gas_cost": { + "l1_gas": 0, + "l1_data_gas": 0, + "l2_gas": 0 + } }, "ignore_inner_event_resources": false, "max_recursion_depth": 50, diff --git a/crates/blockifier/resources/versioned_constants_0_13_4.json b/crates/blockifier/resources/versioned_constants_0_13_4.json index e1f80463f3..3c1703482b 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_4.json +++ b/crates/blockifier/resources/versioned_constants_0_13_4.json @@ -40,9 +40,16 @@ "disable_cairo0_redeclaration": true, "enable_stateful_compression": true, "allocation_cost": { - "l1_gas": 0, - "l1_data_gas": 32, - "l2_gas": 0 + "blob_cost": { + "l1_gas": 0, + "l1_data_gas": 32, + "l2_gas": 0 + }, + "gas_cost": { + "l1_gas": 551, + "l1_data_gas": 0, + "l2_gas": 0 + } }, "ignore_inner_event_resources": false, "enable_reverts": true, diff --git a/crates/blockifier/src/versioned_constants.rs b/crates/blockifier/src/versioned_constants.rs index 6b58f5eb54..6d18bca5e8 100644 --- a/crates/blockifier/src/versioned_constants.rs +++ b/crates/blockifier/src/versioned_constants.rs @@ -138,6 +138,21 @@ pub struct VmResourceCosts { pub builtins: HashMap, } +#[derive(Clone, Debug, Default, Deserialize)] +pub struct AllocationCost { + pub blob_cost: GasVector, + pub gas_cost: GasVector, +} + +impl AllocationCost { + pub const ZERO: AllocationCost = + AllocationCost { blob_cost: GasVector::ZERO, gas_cost: GasVector::ZERO }; + + pub fn get_cost(&self, use_kzg_da: bool) -> &GasVector { + if use_kzg_da { &self.blob_cost } else { &self.gas_cost } + } +} + // TODO: This (along with the Serialize impl) is implemented in pub(crate) scope in the VM (named // serde_generic_map_impl); use it if and when it's public. fn builtin_map_from_string_map<'de, D: Deserializer<'de>>( @@ -186,7 +201,7 @@ pub struct VersionedConstants { // Fee related. pub(crate) vm_resource_fee_cost: Arc, // Cost of allocating a storage cell. - pub allocation_cost: GasVector, + pub allocation_cost: AllocationCost, // Resources. os_resources: Arc,