Skip to content

Commit

Permalink
feat: Introduce high-level types for templates
Browse files Browse the repository at this point in the history
  • Loading branch information
igamigo committed Feb 5, 2025
1 parent 723e47c commit fe41fde
Show file tree
Hide file tree
Showing 9 changed files with 1,391 additions and 1,268 deletions.
28 changes: 14 additions & 14 deletions crates/miden-objects/src/account/component/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ use vm_processor::MastForest;

mod template;
pub use template::{
AccountComponentMetadata, AccountComponentTemplate, FeltRepresentation, InitStorageData,
MapRepresentation, PlaceholderType, StorageEntry, StoragePlaceholder, StorageValue,
WordRepresentation,
AccountComponentMetadata, AccountComponentTemplate, FeltRepresentation, MapRepresentation,
StorageEntry, WordRepresentation,
};

use crate::{
Expand Down Expand Up @@ -103,18 +102,19 @@ impl AccountComponent {
/// they are not of a valid type)
pub fn from_template(
template: &AccountComponentTemplate,
init_storage_data: &InitStorageData,
//init_storage_data: &InitStorageData,
) -> Result<AccountComponent, AccountError> {
let mut storage_slots = vec![];
for storage_entry in template.metadata().storage_entries() {
let entry_storage_slots = storage_entry
.try_build_storage_slots(init_storage_data)
.map_err(AccountError::AccountComponentTemplateInstantiationError)?;
storage_slots.extend(entry_storage_slots);
}

Ok(AccountComponent::new(template.library().clone(), storage_slots)?
.with_supported_types(template.metadata().targets().clone()))
todo!();
// let mut storage_slots = vec![];
// for storage_entry in template.metadata().storage_entries() {
// let entry_storage_slots = storage_entry
// .try_build_storage_slots(init_storage_data)
// .map_err(AccountError::AccountComponentTemplateInstantiationError)?;
// storage_slots.extend(entry_storage_slots);
// }

// Ok(AccountComponent::new(template.library().clone(), storage_slots)?
// .with_supported_types(template.metadata().targets().clone()))
}

// ACCESSORS
Expand Down
Loading

0 comments on commit fe41fde

Please sign in to comment.