Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ft/os upgrade #453

Merged
merged 19 commits into from
Dec 31, 2024
Merged

Ft/os upgrade #453

merged 19 commits into from
Dec 31, 2024

Conversation

ftheirs
Copy link
Collaborator

@ftheirs ftheirs commented Dec 26, 2024

Upgrade to OS version V0.13.3. This PR includes the minimal changes that are needed to execute SNOS for blocks with the latest OS version.

Changes on deserialization from OS output
Some new hints that are needed for deserialization
Disable test that compares SNOS with reference PIE ---> Need to update the reference PIE with a new one (changes in output structure)

Issue Number: N/A

Type

  • feature
  • bugfix
  • dev (no functional changes, no API changes)
  • fmt (formatting, renaming)
  • build
  • docs
  • testing

Description

Breaking changes?

  • yes
  • no

@ftheirs ftheirs marked this pull request as ready for review December 27, 2024 14:02
@@ -215,6 +215,7 @@ pub(crate) fn get_starknet_version(block_with_txs: &BlockWithTxs) -> blockifier:
"0.13.1.1" => blockifier::versioned_constants::StarknetVersion::V0_13_1_1,
"0.13.2" => blockifier::versioned_constants::StarknetVersion::V0_13_2,
"0.13.2.1" => blockifier::versioned_constants::StarknetVersion::Latest,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this for:
StarknetVersion::V0_13_2_1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not available in the Blockifier version that we're using. I can double check this but updating Blockifier to a commit where it's defined lead to some extra changes that are meant for os v0.13.4 and are not needed

Copy link
Collaborator

@HermanObst HermanObst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job man, I left some changes requested

Comment on lines 35 to 37
pub const DEFAULT_FEE_TOKEN_ADDR: &str = "7ce4aa542d72a82662cda96b147da9b041ecf8c61f67ef657f3bbb852fc698f";
pub const DEFAULT_DEPRECATED_FEE_TOKEN_ADDR: &str = "5195ba458d98a8d5a390afa87e199566e473d1124c07a3c57bf19813255ac41";
pub const SEQUENCER_ADDR_0_13_2: &str = "0x31c641e041f8d25997985b0efe68d0c5ce89d418ca9a127ae043aebed6851c5";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is changing? could you point to where you are getting the information?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -49,7 +49,7 @@ const DEFAULT_COMPILED_OS: &[u8] = include_bytes!("../../../../build/os_latest.j
#[case::inconsistent_cairo0_class_hash_1(204936)]
#[case::no_possible_convertion_1(155007)]
#[case::no_possible_convertion_2(155029)]
#[case::reference_pie_with_full_output_enabled(173404)]
// #[case::reference_pie_with_full_output_enabled(173404)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont remove this test:
The failure is related to the fact that this test is also comparing output and in this version the output structure has changed.

Fix: Find a new v0.13.3 PIE (we need them form Starkware) and modify this test to check that Block and output.

@@ -114,8 +112,7 @@ impl StarknetGeneralConfig {

pub fn empty_block_context(&self) -> BlockContext {
let mut versioned_constants = VersionedConstants::default();
versioned_constants.invoke_tx_max_n_steps = self.invoke_tx_max_n_steps;
versioned_constants.validate_max_n_steps = self.validate_max_n_steps;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont you need to change it for:
pub validate_max_n_steps_override: u32 ?

Comment on lines +171 to +186
pub fn set_compressed_start(
vm: &mut VirtualMachine,
exec_scopes: &mut ExecutionScopes,
ids_data: &HashMap<String, HintReference>,
ap_tracking: &ApTracking,
_constants: &HashMap<String, Felt252>,
) -> Result<(), HintError> {
let use_kzg_da_felt = exec_scopes.get::<Felt252>(vars::scopes::USE_KZG_DA)?;

let use_kzg_da = if use_kzg_da_felt == Felt252::ONE {
Ok(true)
} else if use_kzg_da_felt == Felt252::ZERO {
Ok(false)
} else {
Err(HintError::CustomHint("ids.use_kzg_da is not a boolean".to_string().into_boxed_str()))
}?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add unit test for this hint

let n_updates_small_packing_bound = get_constant(vars::ids::N_UPDATES_SMALL_PACKING_BOUND, constants)?;

let is_n_updates_small =
if n_actual_updates < *n_updates_small_packing_bound { Felt252::ZERO } else { Felt252::ONE };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the other way around

Suggested change
if n_actual_updates < *n_updates_small_packing_bound { Felt252::ZERO } else { Felt252::ONE };
if n_actual_updates < *n_updates_small_packing_bound { Felt252::ONE } else { Felt252::ZERO };

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed this one and the deserialize_output that was comparing the wrong value 💪

Comment on lines 293 to 297
#[case(10, 0)]
#[case(255, 0)]
// big updates
#[case(256, 1)]
#[case(1024, 1)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conditions are also the other way around, right?

Copy link
Collaborator

@GMKrieger GMKrieger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find anything to comment on the code, but the CI tests are failing on the tests test_kzg_da_cairo_0 and test_kzg_da_cairo_1

@ftheirs
Copy link
Collaborator Author

ftheirs commented Dec 30, 2024

I didn't find anything to comment on the code, but the CI tests are failing on the tests test_kzg_da_cairo_0 and test_kzg_da_cairo_1

Those tests depends on some hints that will be merge in the following PRs and that's why they are not passing!

Copy link
Collaborator

@HermanObst HermanObst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job!!!! LGTM

@ftheirs ftheirs merged commit 0028b5e into os_v0_13_3 Dec 31, 2024
4 of 6 checks passed
@ftheirs ftheirs deleted the ft/os_upgrade branch December 31, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants