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

feat(starknet_class_manager): adding config to class_manager #3809

Closed
wants to merge 1 commit into from

Conversation

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @lev-starkware)


crates/starknet_class_manager/src/class_storage.rs line 243 at r1 (raw file):

        ])
    }
}

Please move to config.rs.

Code quote:

// TODO(Elin): all this values are actually for papyrus_storage::StorageConfig.
// Check what batcher did for the same config: starknet_batcher/src/config.rs.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ClassHashStorageConfig {
    pub path_prefix: PathBuf,
    pub enforce_file_exists: bool,
    pub max_size: usize,
}

impl Default for ClassHashStorageConfig {
    fn default() -> Self {
        Self {
            path_prefix: "/data".into(),
            enforce_file_exists: false,
            max_size: 1 << 40, // 1TB.
        }
    }
}

impl SerializeConfig for ClassHashStorageConfig {
    fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
        BTreeMap::from([
            ser_param(
                "path_prefix",
                &self.path_prefix,
                "Prefix of the path of the node's storage directory",
                ParamPrivacyInput::Public,
            ),
            ser_param(
                "enforce_file_exists",
                &self.enforce_file_exists,
                "Whether to enforce that the path exists.",
                ParamPrivacyInput::Public,
            ),
            ser_param(
                "max_size",
                &self.max_size,
                "The maximum size of the node's storage in bytes.",
                ParamPrivacyInput::Public,
            ),
        ])
    }
}

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, 3 unresolved discussions (waiting on @lev-starkware)


crates/starknet_class_manager/src/class_storage.rs line 201 at r1 (raw file):

}

// TODO(Elin): all this values are actually for papyrus_storage::StorageConfig.

Please:

  1. move this comment to be near the impl Default for ClassHashStorageConfig value
  2. rephrase to // TODO(Elin): set appropriate default values.

Code quote:

// TODO(Elin): all this values are actually for papyrus_storage::StorageConfig.

crates/starknet_class_manager/src/class_storage.rs line 202 at r1 (raw file):

// TODO(Elin): all this values are actually for papyrus_storage::StorageConfig.
// Check what batcher did for the same config: starknet_batcher/src/config.rs.

Delete this comment please.

Code quote:

// Check what batcher did for the same config: starknet_batcher/src/config.rs.

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, 4 unresolved discussions (waiting on @lev-starkware)


crates/starknet_class_manager/src/class_manager.rs line 27 at r2 (raw file):

        storage: S,
    ) -> Self {
        let cached_class_storage_config = config.cached_class_storage_config.clone();

Something is misaligned w.r.t. to the config definitions here
If the function requires a storage: S object then the passed config config: ClassManagerConfig should not contain config values of that storage, but only values relevant to the component.

There should be 3 config objects as far as I understand:

  1. a config for the storage (its type should be CachedClassStorageConfig, right?). This config is used when creating the storage.
  2. a config for the component (I'd expect its type to be ClassManagerConfig, but currently this name represents something else). This config is used for the component ctor, as in this function.
  3. a config holding both 1 and 2 -- this config should be included in the node config (e.g., like the gateway config), and passed to the create_class_manager fn.

Code quote:

    pub fn new(
        config: ClassManagerConfig,
        compiler: SharedSierraCompilerClient,
        storage: S,
    ) -> Self {
        let cached_class_storage_config = config.cached_class_storage_config.clone();

Copy link
Contributor Author

@lev-starkware lev-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 7 files reviewed, 4 unresolved discussions (waiting on @Itay-Tsabary-Starkware)


crates/starknet_class_manager/src/class_manager.rs line 27 at r2 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Something is misaligned w.r.t. to the config definitions here
If the function requires a storage: S object then the passed config config: ClassManagerConfig should not contain config values of that storage, but only values relevant to the component.

There should be 3 config objects as far as I understand:

  1. a config for the storage (its type should be CachedClassStorageConfig, right?). This config is used when creating the storage.
  2. a config for the component (I'd expect its type to be ClassManagerConfig, but currently this name represents something else). This config is used for the component ctor, as in this function.
  3. a config holding both 1 and 2 -- this config should be included in the node config (e.g., like the gateway config), and passed to the create_class_manager fn.

This config holds a config for a storage and a config for a cache.
I am adding this config to the node_config in the next PR.


crates/starknet_class_manager/src/class_storage.rs line 201 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Please:

  1. move this comment to be near the impl Default for ClassHashStorageConfig value
  2. rephrase to // TODO(Elin): set appropriate default values.

Done.


crates/starknet_class_manager/src/class_storage.rs line 202 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Delete this comment please.

Done.


crates/starknet_class_manager/src/class_storage.rs line 243 at r1 (raw file):

Previously, Itay-Tsabary-Starkware wrote…

Please move to config.rs.

Done.

Copy link
Contributor

@Itay-Tsabary-Starkware Itay-Tsabary-Starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 7 files at r1, 1 of 3 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lev-starkware)


crates/starknet_class_manager/src/class_manager.rs line 27 at r2 (raw file):

Previously, lev-starkware wrote…

This config holds a config for a storage and a config for a cache.
I am adding this config to the node_config in the next PR.

I am not convinced, but let's handle that later.

@lev-starkware
Copy link
Contributor Author

✓ Commit merged in pull request #3839

@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants