Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"proof_facts": [
"0x50524f4f4630",
"0x5649525455414c5f534e4f53",
"0x130206a40921880628605041292e995870334451179c63090221210893986a2",
"0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421",
"0x5649525455414c5f534e4f5330",
"0x7a0",
"0x2fa80",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"proof_facts": [
"0x50524f4f4630",
"0x5649525455414c5f534e4f53",
"0x130206a40921880628605041292e995870334451179c63090221210893986a2",
"0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421",
"0x5649525455414c5f534e4f5330",
"0x7a0",
"0x2fa80",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"proof_facts": [
"0x50524f4f4630",
"0x5649525455414c5f534e4f53",
"0x130206a40921880628605041292e995870334451179c63090221210893986a2",
"0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421",
"0x5649525455414c5f534e4f5330",
"0x7a0",
"0x2fa80",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"proof_facts": [
"0x50524f4f4630",
"0x5649525455414c5f534e4f53",
"0x130206a40921880628605041292e995870334451179c63090221210893986a2",
"0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421",
"0x5649525455414c5f534e4f5330",
"0x7a0",
"0x2fa80",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const STORED_BLOCK_HASH_BUFFER = 10;

// Allowed virtual OS program hashes for client-side proving.
const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_0 = (
0x0130206a40921880628605041292e995870334451179c63090221210893986a2
0x056cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421
);
const ALLOWED_VIRTUAL_OS_PROGRAM_HASHES_LEN = 1;

Expand Down
2 changes: 1 addition & 1 deletion crates/apollo_starknet_os_program/src/program_hash.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"os": "0x1f6ae914829a65d7714150b8443e176e5856f1f21decafdd3e7fcc943ebd2c3",
"os": "0x65dfb0432c7c59c63cdee238eef7cfe5116799eaf4bdc479ef840e627d500b0",
"virtual_os": "0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421",
"aggregator": "0x4a50066445fdceb87b7ed1211dbff1f544ad4fa879a678a79355ed812dea346",
"aggregator_with_prefix": "0x5af6c0904619be30798f335358f96ba742a8f23c7b0df1080d0c24e2224c6f6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"segment_arena_cells": false,
"os_constants": {
"allowed_virtual_os_program_hashes": [
"0x130206a40921880628605041292e995870334451179c63090221210893986a2"
"0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421"
],
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"default_entry_point_selector": "0x0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
~ /deprecated_l2_resource_gas_costs/gas_per_proof/0: 1000000000
~ /enable_casm_hash_migration: false
~ /gateway/max_proof_size: 90000
+ /os_constants/allowed_virtual_os_program_hashes/0: "0x130206a40921880628605041292e995870334451179c63090221210893986a2"
+ /os_constants/allowed_virtual_os_program_hashes/0: "0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421"
1 change: 0 additions & 1 deletion crates/blockifier/src/blockifier_versioned_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ pub struct RawVersionedConstants {
#[serde(deny_unknown_fields)]
pub struct RawOsConstants {
// Allowed virtual OS program hashes for client-side proving.
// TODO(Meshi): Add a test that the latest virtual OS program hash is in this list.
pub allowed_virtual_os_program_hashes: Vec<StarkHash>,

// Selectors.
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_api/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub const MAX_FEE: Fee = DEFAULT_L1_GAS_AMOUNT.nonzero_saturating_mul(DEFAULT_ET
// Virtual OS program hash for testing. Should match one of the allowed virtual OS program hashes in
// the current versioned constants.
pub const VIRTUAL_OS_PROGRAM_HASH: StarkHash = StarkHash::from_hex_unchecked(
"0x130206a40921880628605041292e995870334451179c63090221210893986a2",
"0x56cb82807b5af2736cee1da0919bc265b499836623bd32265eacc8c8dc98421",
);

/// Computes a deterministic block hash for testing purposes.
Expand Down
25 changes: 24 additions & 1 deletion crates/starknet_os/src/constants_test.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use apollo_starknet_os_program::OS_PROGRAM;
use apollo_starknet_os_program::{OS_PROGRAM, PROGRAM_HASHES};
use blockifier::abi::constants::{L1_TO_L2_MSG_HEADER_SIZE, L2_TO_L1_MSG_HEADER_SIZE};
use blockifier::blockifier_versioned_constants::VersionedConstants;
use starknet_api::block::StarknetVersion;
use starknet_api::contract_class::compiled_class_hash::COMPILED_CLASS_V1;
use starknet_api::core::{
GLOBAL_STATE_VERSION,
L2_ADDRESS_UPPER_BOUND,
STARKNET_OS_CONFIG_HASH_VERSION,
};
use starknet_api::transaction::fields::{PROOF_VERSION, VIRTUAL_OS_OUTPUT_VERSION, VIRTUAL_SNOS};
use starknet_api::versioned_constants_logic::VersionedConstantsTrait;
use starknet_committer::hash_function::hash::CONTRACT_CLASS_LEAF_V0;
use starknet_types_core::felt::Felt;

Expand Down Expand Up @@ -90,3 +93,23 @@ fn test_starknet_os_config_hash_version() {
STARKNET_OS_CONFIG_HASH_VERSION
);
}

/// Verifies that the virtual OS program hash from PROGRAM_HASHES is in the list of
/// allowed virtual OS program hashes in the latest versioned constants.
#[test]
fn test_virtual_os_program_hash_is_allowed() {
let virtual_os_hash = PROGRAM_HASHES.virtual_os;

// Get the latest versioned constants
let latest_constants = VersionedConstants::get(&StarknetVersion::LATEST).unwrap();

// Check if the virtual OS program hash is in the allowed list
let allowed_hashes = &latest_constants.os_constants.allowed_virtual_os_program_hashes;

assert!(
allowed_hashes.contains(&virtual_os_hash),
"Virtual OS program hash {:#x} is not in the allowed list: {:?}",
virtual_os_hash,
allowed_hashes.iter().map(|h| format!("{:#x}", h)).collect::<Vec<_>>()
);
}
Loading