Skip to content

Commit

Permalink
fix(cargo-tangle): bake blueprint json (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekohex authored Oct 24, 2024
1 parent 0a06ad9 commit ea0aadb
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
Submodule forge-std updated 4 files
+193 −0 CONTRIBUTING.md
+16 −0 README.md
+73 −8 src/Vm.sol
+2 −2 test/Vm.t.sol
2 changes: 1 addition & 1 deletion blueprints/incredible-squaring/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ default = ["std"]
std = []

[package.metadata.blueprint]
manager = { evm = "IncredibleSquaringBlueprint" }
manager = { Evm = "IncredibleSquaringBlueprint" }
2 changes: 1 addition & 1 deletion blueprints/incredible-squaring/contracts/lib/forge-std
Submodule forge-std updated 4 files
+193 −0 CONTRIBUTING.md
+16 −0 README.md
+73 −8 src/Vm.sol
+2 −2 test/Vm.t.sol
8 changes: 7 additions & 1 deletion cli/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,16 @@ fn bake_blueprint(
convert_to_bytes_or_null(&mut blueprint_json["metadata"]["website"]);
convert_to_bytes_or_null(&mut blueprint_json["metadata"]["code_repository"]);
convert_to_bytes_or_null(&mut blueprint_json["metadata"]["category"]);

// Set the Hooks to be empty to be compatible with the old blueprint format.
// This is because the new blueprint format has manager field instead of different hooks.
blueprint_json["registration_hook"] = serde_json::json!("None");
blueprint_json["request_hook"] = serde_json::json!("None");
for job in blueprint_json["jobs"].as_array_mut().unwrap() {
convert_to_bytes_or_null(&mut job["metadata"]["name"]);
convert_to_bytes_or_null(&mut job["metadata"]["description"]);
// Set an empty verifier to be compatible with the old blueprint format.
job["verifier"] = serde_json::json!("None");
}

// Retrieves the Gadget information from the blueprint.json file.
Expand Down Expand Up @@ -308,7 +315,6 @@ fn bake_blueprint(
}
}

println!("Job: {blueprint_json}");
let blueprint = serde_json::from_value(blueprint_json)?;
Ok(blueprint)
}
Expand Down
1 change: 0 additions & 1 deletion macros/blueprint-proc-macro-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ pub struct ReportMetadata<'a> {

/// Service Blueprint Manager is a smart contract that will manage the service lifecycle.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum BlueprintManager {
/// A Smart contract that will manage the service lifecycle.
Expand Down
2 changes: 1 addition & 1 deletion macros/playground/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository.workspace = true
publish = false

[package.metadata.blueprint]
manager = { evm = "" }
manager = { Evm = "" }

[[package.metadata.gadget.Native.sources]]
owner = "tangle-network"
Expand Down

0 comments on commit ea0aadb

Please sign in to comment.