Skip to content

Commit

Permalink
iface: automatically generate asset tags if they are not manually pro…
Browse files Browse the repository at this point in the history
…vided
  • Loading branch information
dr-orlovsky committed Nov 18, 2023
1 parent 0fc2677 commit 8614070
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions src/interface/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,17 @@ impl<Seal: ExposedSeal> OperationBuilder<Seal> {
.assignments_type(&name, ty)
.ok_or(BuilderError::AssignmentNotFound(name))?;

let tag = *self
.asset_tags
.get(&type_id)
.ok_or(BuilderError::AssetTagUnknown(type_id))?;
let tag = match self.asset_tags.get(&type_id) {
Some(asset_tag) => *asset_tag,
None => {
let asset_tag = AssetTag::new_random(
&format!("{}/{}", self.schema.schema_id(), self.iface.iface_id()),
type_id,
);
self.asset_tags.insert(type_id, asset_tag)?;
asset_tag
}
};

let state = RevealedValue::new_random_blinding(value, tag);

Expand Down

0 comments on commit 8614070

Please sign in to comment.